urbanairship / ios-library

Urban Airship iOS SDK
http://urbanairship.com
Apache License 2.0
478 stars 265 forks source link

The app crash if iOS is <17.0 #387

Closed Yoplait15 closed 7 months ago

Yoplait15 commented 8 months ago

Preliminary Info

What Airship dependencies are you using?

Airship: 16.12.5 Airship/Accengage: 16.12.5

What are the versions of any relevant development tools you are using?

XCode 15.2 ℹ iOS 16.2

Report

What unexpected behavior are you seeing?

Crash when launching the app.

MicrosoftTeams-image (9)

What is the expected behavior?

When launching the app for iOS17+ there is no crash, this issue only happens for <iOS17

What are the steps to reproduce the unexpected behavior?

Call the method "Airship.takeOff(config, launchOptions: launchOptions)" at the entry method app of the application: "func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool", the app will crash.

Do you have logging for the issue?

There is no log.

rlepinski commented 8 months ago

Could you make sure you are linking Network framework?

Yoplait15 commented 8 months ago

The app still crash after linking the Network framework.

rlepinski commented 8 months ago

@Yoplait15 could you provide the full stack trace?

Yoplait15 commented 8 months ago
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000000000000
  * frame #1: 0x000000010ca9455d AirshipKit`NetworkMonitor.init() at NetworkMonitor.swift:42:27
    frame #2: 0x000000010ca947ff AirshipKit`@objc NetworkMonitor.init() at <compiler-generated>:0
    frame #3: 0x000000010ca943eb AirshipKit`NetworkMonitor.__allocating_init() at NetworkMonitor.swift:0
    frame #4: 0x000000010cb92848 AirshipKit`one-time initialization function for shared at TaskManager.swift:34:60
    frame #5: 0x00000001157def5b libdispatch.dylib`_dispatch_client_callout + 8
    frame #6: 0x00000001157e05b5 libdispatch.dylib`_dispatch_once_callout + 66
    frame #7: 0x000000010cb92921 AirshipKit`TaskManager.shared.unsafeMutableAddressor at TaskManager.swift:31:23
    frame #8: 0x000000010c8e6853 AirshipKit`ChannelAudienceManager.init(dataStore=0x0000600000eb0b80, config=0x0000600001cb2200, privacyManager=0x0000600001290bd0) at ChannelAudienceManager.swift:147:44
    frame #9: 0x000000010c8e67a5 AirshipKit`ChannelAudienceManager.__allocating_init(dataStore:config:privacyManager:) at ChannelAudienceManager.swift:0
    frame #10: 0x000000010c8d8f52 AirshipKit`Channel.init(dataStore=0x0000600000eb0b80, config=0x0000600001cb2200, privacyManager=0x0000600001290bd0, localeManager=(object = 0x00006000020ae140 -> 0x000000010ce373e8 (void *)0x000000010ce48f48: UALocaleManager)) at Channel.swift:256:36
    frame #11: 0x000000010c8d8e12 AirshipKit`Channel.__allocating_init(dataStore:config:privacyManager:localeManager:) at Channel.swift:0
    frame #12: 0x000000010c860d4d AirshipKit`AirshipInstance.init(config=0x00007fe6ada0e000, self=0x0000600001290b40) at AirshipInstance.swift:65:23
    frame #13: 0x000000010c8608e4 AirshipKit`AirshipInstance.__allocating_init(config:) at AirshipInstance.swift:0
    frame #14: 0x000000010c845f6f AirshipKit`static Airship.commonTakeOff(config=0x00007fe6ada0de90, self=@thick AirshipKit.Airship.Type) at Airship.swift:321:37
    frame #15: 0x000000010c8449f4 AirshipKit`static Airship.takeOff(config=0x00007fe6ada0de90, launchOptions=nil, self=@thick AirshipKit.Airship.Type) at Airship.swift:210:9
    frame #16: 0x0000000100967a96
    frame #17: 0x00000001009a013c
    frame #18: 0x0000000100c52303
    frame #19: 0x0000000100c529f7
    frame #20: 0x000000012b6a8663 UIKitCore`-[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 271
    frame #21: 0x000000012b6aa507 UIKitCore`-[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 4257
    frame #22: 0x000000012b6b02e3 UIKitCore`-[UIApplication _runWithMainScene:transitionContext:completion:] + 1236
    frame #23: 0x000000012aadc8ac UIKitCore`-[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 122
    frame #24: 0x000000012b1511e1 UIKitCore`_UIScenePerformActionsWithLifecycleActionMask + 88
    frame #25: 0x000000012aadd3a6 UIKitCore`__101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 198
    frame #26: 0x000000012aadcde3 UIKitCore`-[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 252
    frame #27: 0x000000012aadd1dc UIKitCore`-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 831
    frame #28: 0x000000012aadca89 UIKitCore`-[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 354
    frame #29: 0x000000012aaeb8f5 UIKitCore`__186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 178
    frame #30: 0x000000012b021947 UIKitCore`+[BSAnimationSettings(UIKit) tryAnimatingWithSettings:fromCurrentState:actions:completion:] + 833
    frame #31: 0x000000012b16f2a3 UIKitCore`_UISceneSettingsDiffActionPerformChangesWithTransitionContextAndCompletion + 257
    frame #32: 0x000000012aaeb575 UIKitCore`-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 348
    frame #33: 0x000000012a8ce5ae UIKitCore`__64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.594 + 815
    frame #34: 0x000000012a8ccfc4 UIKitCore`-[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 245
    frame #35: 0x000000012a8ce15b UIKitCore`-[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 255
    frame #36: 0x000000012b6aeae9 UIKitCore`-[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 733
    frame #37: 0x000000012b05436b UIKitCore`-[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 350
    frame #38: 0x0000000123641b3b FrontBoardServices`-[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 415
    frame #39: 0x00000001236707ba FrontBoardServices`__92-[FBSWorkspaceScenesClient createSceneWithIdentity:parameters:transitionContext:completion:]_block_invoke.187 + 102
    frame #40: 0x000000012364fb8a FrontBoardServices`-[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 209
    frame #41: 0x00000001236703af FrontBoardServices`__92-[FBSWorkspaceScenesClient createSceneWithIdentity:parameters:transitionContext:completion:]_block_invoke + 344
    frame #42: 0x00000001157def5b libdispatch.dylib`_dispatch_client_callout + 8
    frame #43: 0x00000001157e28d2 libdispatch.dylib`_dispatch_block_invoke_direct + 496
    frame #44: 0x0000000123696bb8 FrontBoardServices`__FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
    frame #45: 0x0000000123696aae FrontBoardServices`-[FBSSerialQueue _targetQueue_performNextIfPossible] + 174
    frame #46: 0x0000000123696be0 FrontBoardServices`-[FBSSerialQueue _performNextFromRunLoopSource] + 19
    frame #47: 0x00000001183d1fe5 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    frame #48: 0x00000001183d1f24 CoreFoundation`__CFRunLoopDoSource0 + 157
    frame #49: 0x00000001183d1721 CoreFoundation`__CFRunLoopDoSources0 + 212
    frame #50: 0x00000001183cbe23 CoreFoundation`__CFRunLoopRun + 927
    frame #51: 0x00000001183cb6a7 CoreFoundation`CFRunLoopRunSpecific + 560
    frame #52: 0x000000011e81128a GraphicsServices`GSEventRunModal + 139
    frame #53: 0x000000012b6acad3 UIKitCore`-[UIApplication _run] + 994
    frame #54: 0x000000012b6b19ef UIKitCore`UIApplicationMain + 123
    frame #55: 0x0000000100c5f27f
    frame #56: 0x000000010a6152bf
    frame #57: 0x0000000201d81386 dyld`start + 1942
Yoplait15 commented 7 months ago

Hi, any news about this crash?

rlepinski commented 7 months ago

@Yoplait15 We were able to reproduce the issue if we set our min deployment target to 11, setting it to 12 fixed the issue. Could you try upping your min deployment target to see if the issue goes away?

mohamed-abdelli95 commented 7 months ago

Hi, Thank you for your help I confirm that it no longer crashes. I modified the minimum target of Airship in the Podfile:

post_install do |installer|
    installer.pods_project.targets.each do |target|
        if target.name == 'Airship'
            target.build_configurations.each do |config|
                config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
            end
        end
    end
end

For now this is a work around until "Airship/Accengage" is updated or if we no longer support iOS16

rlepinski commented 7 months ago

You no longer need the Airship/Accengage module, that is only useful during the transition from Accengage to Airship. You should be safe to remove.

This looks like its just Xcode 15 not supporting iOS 11 anymore. Its not an option anymore in the UI. Its an issue elsewhere as well - https://github.com/DataDog/dd-sdk-ios/issues/1509