sdk iOS17 - crash on iOS 15 and iOS 16
Hello,
Since xcode15 and iOS sdk 17 we cannot launch our app on "old" iOS version (15.6 with a real device iPhone, 16.4 for simulator). The issue is localized in datadog core at initialization stage (DatadogContextProvider):
if #available(iOS 12, tvOS 12, *) {
subscribe(\.networkConnectionInfo, to: NWPathMonitorPublisher())
} else {
assign(reader: SCNetworkReachabilityReader(), to: \.networkConnectionInfo)
}
Bad access on NWPathMonitorPublisher().
The stack trace:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 ??? 0x0 ???
1 <translation info unavailable> 0x102c91e2c ???
2 Datadog 0x10a018da0 DatadogContextProvider.__allocating_init(configuration:device:serverDateProvider:) + 2272 (DatadogCore.swift:549)
3 Datadog 0x109fead88 static Datadog.initializeOrThrow(initialTrackingConsent:configuration:) + 1816 (Datadog.swift:198)
4 Datadog 0x109fe939e static Datadog.initialize(appContext:trackingConsent:configuration:) + 334 (Datadog.swift:84)
5 Runner 0x100188b2f SwiftDatadogSdkPlugin.initialize(configuration:) + 2607
6 Runner 0x100184f82 SwiftDatadogSdkPlugin.handle(_:result:) + 2130
7 Runner 0x1001880d6 @objc SwiftDatadogSdkPlugin.handle(_:result:) + 118
8 Flutter 0x1138a023b __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 104
9 Flutter 0x1132ac6a4 invocation function for block in flutter::PlatformMessageHandlerIos::HandlePlatformMessage(std::_LIBCPP_ABI_NAMESPACE::unique_ptr<flutter::PlatformMessage, std::_LIBCPP_ABI_NAMESPACE::default_delete<flutter::PlatformMessage>>) + 94
10 libdispatch.dylib 0x10d36fe40 _dispatch_call_block_and_release + 12
11 libdispatch.dylib 0x10d3710d9 _dispatch_client_callout + 8
12 libdispatch.dylib 0x10d380b86 _dispatch_main_queue_drain + 1330
13 libdispatch.dylib 0x10d380646 _dispatch_main_queue_callback_4CF + 31
14 CoreFoundation 0x1093706cc __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
15 CoreFoundation 0x10936afbe __CFRunLoopRun + 2429
16 CoreFoundation 0x10936a264 CFRunLoopRunSpecific + 560
17 GraphicsServices 0x1127bb24e GSEventRunModal + 139
18 UIKitCore 0x1265267bf -[UIApplication _run] + 994
19 UIKitCore 0x12652b5de UIApplicationMain + 123
20 Runner 0x1000ff7ff main + 63 (AppDelegate.swift:8)
21 dyld_sim 0x108856384 start_sim + 10
22 dyld 0x20029e41f start + 1903
The app ran correctly before the update to xcode15 and sdk iOS17. The app run correctly on iOS17.
the piece of code where we insert datadog:
await DatadogSdk.runApp(configuration, () async {
logMessage("Starting app ...");
runApp(
MultiBlocProvider(
providers: [
BlocProvider(create: (_) => TabbarCubit()),
...
],
child: App(),
),
);
});
We tried to upgrade the plugin version but no fix was found: datadog_tracking_http_client: ^1.3.0 => datadog_tracking_http_client: ^1.4.0 datadog_flutter_plugin: ^1.4.0 => datadog_flutter_plugin: ^1.6.2
Dart SDK version: 2.19.6 Flutter 3.7.12
Thanks for your answers.
HI @lboneoside ,
I've been unable to replicate this locally with simulators on iOS 16.4 with the released version fox XCode 15. I've attempted in both our iOS SDK and with Flutter. Are you on an XCode 15 Beta perchance?
However, I am seeing other folks have a similar issue, especially with Flutter, which recommend increasing your deployment target. This comment gives you a script you can add to your Podfile which will increase the deployment target for all Pods, which might fix your issue: https://github.com/fluttercommunity/plus_plugins/issues/1955#issuecomment-1725339762
Others have been reporting just changing your minimum deployment to 12+ also works. Not sure why we can't replicate though, as I have everything set to 11 at the moment.
Let me know if any of that works for you or if you need us to continue investigating.
Hi @lboneoside ,
A co-worker was able to reproduce. We think the workaround mentioned in the plus_plugins will work for you while we look into a more permanent solution. Let us know if that's not the case.
Hi @fuzzybinary We have just tested your solution with updating the podfile (thing we didn't want to do while flutter manage it well). => It works :)
In the podfile, the hook is now :
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 12.0
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
end
end
end
end
(+ flutter clean, flutter pub get and pod install)
Thanks a lot 👍
the workaround is not working for me, I don't use Flutter and the crash happened at the same place
I'm using the code to initialize DataDog
Datadog.initialize(
appContext: .init(),
trackingConsent: .granted,
configuration: Datadog.Configuration
.builderUsing(
rumApplicationID: appID,
clientToken: clientToken,
environment: environment
)
.set(serviceName: "MyServiceName")
.set(endpoint: .us1)
.trackUIKitRUMViews() // Viewing Station has only one ViewController, so we may not need it for now
.trackUIKitRUMActions()
.trackRUMLongTasks()
// Disabling tracer can give additional efficiency, to use tracer, need to define `Tracer`
// https://docs.datadoghq.com/getting_started/tracing/
// https://docs.datadoghq.com/tracing/trace_collection/dd_libraries/ios/?tab=us&tabs=cocoapods
.enableTracing(false)
.build()
)
the crash happening on tvOS 16.4, and interestingly, simulator will not causing crash, only on real device
can someone give me an advice?
it seems my case not the same, could be this https://github.com/DataDog/dd-sdk-ios/issues/1509
I'm going to keep the comment for someone like me - who get lost 😅
Any update on this? the proposed workaround causes issues with other packages and extensions we use.
Hi @10ndavis,
What type of issues? This should be a fairly safe change to make, as it should just update the minimum supported version of all pods to 12.0.
The problem is that this isn't really an issue in the Flutter SDK or the iOS Native SDK, but something that broke in the iOS runtimes specifically when setting your supported target to iOS 11 in XCode 15 (which technically dropped support for iOS 11).
The fix from our side would be for the native iOS SDK to change its minimum supported target to 12, but I can't give a definitive timeline on that at the moment.
@fuzzybinary it caused compiling issues with AwesomeNotificationsFCM for flutter. Sorry, I don't have the exact errors on hand as it's been a few weeks since I touched this.
I'll give it another shot and see if I can do the proposed with some conditional logic around the awesome notification extension.
@fuzzybinary We are writing to express our deep concern regarding the recent issues with your platform, which resulted in significant disruptions to our Flutter app on older versions of iOS (specifically iOS 15 and 16). As a result of these disruptions, our clients experienced a loss of users, which has had a detrimental impact on their business.
While we understand that technical issues can arise, we believe it is important to address the responsibility of service providers in ensuring the reliability and stability of their platforms, particularly when these platforms are critical components of third-party applications.
In this instance, the crashes experienced by our app were directly attributable to issues with the Data Dog integration, specifically in its role as a crash reporting tool akin to Crashlytics for our Flutter app. As such, we believe that Data Dog bears a degree of responsibility for the adverse effects experienced by our clients.
Moving forward, we would like to work collaboratively with your team to identify measures that can be implemented to prevent similar incidents in the future. This may include:
- Conducting thorough testing across various iOS versions to ensure compatibility and stability.
- Implementing robust monitoring and alerting systems to detect and address issues promptly.
- Providing clear communication channels for developers to report issues and receive timely support.
- Offering fallback mechanisms or alternative solutions to mitigate the impact of platform failures on app performance.
Regarding the last point, we would like to explore the possibility of implementing a failover mechanism that allows our app to continue functioning even in the event of a Data Dog failure. This could involve temporarily disabling the Data Dog integration or switching to a backup crash reporting solution until the issue is resolved.
We believe that by working together to address these concerns and implement proactive measures, we can ensure a more stable and reliable experience for our clients and their users.
We appreciate your attention to this matter and look forward to discussing potential solutions with you.
Sincerely, Denys Diachenko / Attract Group
Hi @Den-creator,
We’re sorry you feel this way. And while we're not 100% happy with the workaround that we suggested earlier, fixing this particular issue would require dropping support for iOS 11, which is not an option for many customers of ours. This is why we have not bumped the minimum supported version in Cocoapods yet.
To address your individual points:
- Conducting thorough testing across various iOS versions to ensure compatibility and stability.
We are constantly working to improve this and value the feedback we get from our customers. Though we try to do our best, cases can happen that something slipped through the cracks as it did in this particular case. When such (hopefully rare) situations occur, we again do our best to find workarounds and more durable solutions when possible.
- Implementing robust monitoring and alerting systems to detect and address issues promptly.
Datadog does collect telemetry on its own SDKs, and we have alerts concerning new errors. We've already addressed several bugs that we found through telemetry and before they were reported by our customers. We will keep on improving our coverage on this front.
- Providing clear communication channels for developers to report issues and receive timely support.
Besides GitHub issues (which we watch very closely, and to which we try to respond as promptly as we can), there are also official Datadog support channels. If you have specific concerns with our responsiveness, we strongly recommend that you reach out to your CSM / sales person directly to see how we can more adequately address your needs.
- Offering fallback mechanisms or alternative solutions to mitigate the impact of platform failures on app performance.
We understand your frustration, but there is only so much we can do on our customers’ behalf on this front, and we believe it is up to the developers using any 3rd party SDK to implement such a fallback mechanism. Unless there are specific APIs you think we should add? In which case we’d love to get a feature request describing how you would want the SDK to behave under what circumstances.
We’re again very sorry to have reached this point of discontent, and we understand how frustrating it can be, but we can’t drop support of iOS 11 just yet.
Hello, good afternoon!
I am facing the same error with Flutter. I tested changing the IPHONEOS_DEPLOYMENT_TARGET to 12 and it work, however this is not and option for us at the moment. We still have to support customers on version 11. Any suggestions on waht can be done? Please help me with a solution. We have thousands of users with IOS 11, we are a financial application, we cannot simply do this.
Flutter version"3.13.19 Xcode version: 15
@ggsant
The answer is don't upgrade to XCode 15, as it does not support iOS 11. This is an Apple compatibility requirement, and has nothing to do with Datadog.
Datadog Flutter SDK has set its minimum supported version to iOS 12, and this should no longer occur.