sdk iOS17 - crash on iOS 15 and iOS 16
lboneoside opened this issue ยท 12 comments
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:
fluttercommunity/plus_plugins#1955 (comment)
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
DataDog/dd-sdk-ios#1509
I'm going to keep the comment for someone like me - who get lost ๐