analytics-ios
analytics-ios copied to clipboard
Segment Crash issue!
Receiving the following crash from some users. The cause of this crash remains unclear, since it’s occurring within the Segment Library. App is running on latest iOS, application written in latest Swift, Cocoa-pods Analytics library install on 4.1.3.
Segment
-[SEGFileStorage dataFromJSON:] at SEGFileStorage.m:232
Segment
-[SEGFileStorage setJSON:forKey:] at SEGFileStorage.m:221
Segment
-[SEGSegmentIntegration persistQueue] SEGSegmentIntegration.m:475
Segment
-[SEGSegmentIntegration sendData:]_block_invoke_2 at SEGSegmentIntegration.m:405
Segment
_seg_dispatch_specific_block_invoke at SEGUtils.m:494
dispatch_block_t autoreleasing_block
We have the same issue, is there any progress on this?
In my case, it's due to some unexpected NaN values in my tracking data. So I ended up creating the below extension for dictionary
extension Dictionary where Key == String, Value == Any {
func removeInvalidValues() -> [String : Any]? {
return filter { (_, value) in
if let numberValue = value as? NSNumber {
return !numberValue.floatValue.isNaN
}
return !(value is NSNull)
}
}
}
Usage:
var properties: [String: Any] = myTrackingData
Analytics.shared().track(event, properties: properties.removeInvalidValues())