dji-sdk / Mobile-SDK-iOS

DJI Mobile SDK for iOS: http://developer.dji.com/mobile-sdk/
Other
581 stars 256 forks source link

Swift demo crashes on device connection on iOS 16 #545

Open danei opened 1 year ago

danei commented 1 year ago

Tried on ipad mini 5 @ iPadOS 16.3 & iphone 12 pro max @ iOS 16.2. Both crash upon device (phantom 4 pro or its remote only) is connected. I don't recall such issue before iOS update. Crash point is AppDelegate Thread 1: EXC_BAD_ACCESS (code=1, address=0x0)

Vanilla iOS mobile SDK 4.16.2 except setting app key.

Here's lldb output:

Thread Performance Checker: Thread running at QOS_CLASS_USER_INTERACTIVE waiting on a lower QoS thread running at QOS_CLASS_DEFAULT. Investigate ways to avoid priority inversions
PID: 3294, TID: 178994
Backtrace
=================================================================
3   GPUToolsCore                        0x00000001036bd6b8 _ZN8GPUTools9Interpose15DYInitInterposeEPFP16DYGuestAppClientvEi + 404
4   dyld                                0x00000001a8314280 7B63C573-6161-3B33-A3A2-9944BA59722F + 29312
5   dyld                                0x00000001a836a360 7B63C573-6161-3B33-A3A2-9944BA59722F + 381792
6   dyld                                0x00000001a8312968 7B63C573-6161-3B33-A3A2-9944BA59722F + 22888
7   dyld                                0x00000001a8311cd8 7B63C573-6161-3B33-A3A2-9944BA59722F + 19672
8   dyld                                0x00000001a831117c 7B63C573-6161-3B33-A3A2-9944BA59722F + 16764
9   dyld                                0x00000001a831cd5c 7B63C573-6161-3B33-A3A2-9944BA59722F + 64860
10  dyld                                0x00000001a8319788 7B63C573-6161-3B33-A3A2-9944BA59722F + 51080
11  dyld                                0x00000001a8315ccc 7B63C573-6161-3B33-A3A2-9944BA59722F + 36044
12  dyld                                0x00000001a831b33c 7B63C573-6161-3B33-A3A2-9944BA59722F + 58172
13  dyld                                0x00000001a834f244 7B63C573-6161-3B33-A3A2-9944BA59722F + 270916
14  dyld                                0x00000001a832466c 7B63C573-6161-3B33-A3A2-9944BA59722F + 95852
15  dyld                                0x00000001a83228d4 7B63C573-6161-3B33-A3A2-9944BA59722F + 88276
2023-02-03 01:40:11.942251-0600 DJISDKSwiftDemo[3294:178994] [SceneConfiguration] Info.plist contained no UIScene configuration dictionary (looking for configuration named "(no name)")
2023-02-03 01:40:11.962971-0600 DJISDKSwiftDemo[3294:178994] [Assert] UINavigationBar decoded as unlocked for UINavigationController, or navigationBar delegate set up incorrectly. Inconsistent configuration may cause problems. navigationController=<UINavigationController: 0x10781f000>, navigationBar=<UINavigationBar: 0x103e090c0; frame = (0 0; 0 50); autoresize = W; layer = <CALayer: 0x280af6ac0>> delegate=0x10781f000
2023-02-03 01:40:12.304105-0600 DJISDKSwiftDemo[3294:178994] IAPAppRegisterClient: capabilities 0x8020
2023-02-03 01:40:12.304778-0600 DJISDKSwiftDemo[3294:178994] IAPAppRegisterClient: __eaClientRegisterediapd 0 -> 1
2023-02-03 01:40:12.304851-0600 DJISDKSwiftDemo[3294:178994] IAPAppRegisterClient: __eaClientRegisterediap2d 0 -> 1
2023-02-03 01:40:12.305118-0600 DJISDKSwiftDemo[3294:178994] IAPDHasLaunched: kIAPAvailableNotification iapdAvailableState 100 -> 0
2023-02-03 01:40:12.305191-0600 DJISDKSwiftDemo[3294:178994] IAPAppRegisterClient: __eaiapdHasClientID 0, IAPDHasLaunched 0
2023-02-03 01:40:12.305506-0600 DJISDKSwiftDemo[3294:178994] IAP2DHasLaunched: kIAP2AvailableNotification iap2dAvailableState 100 -> 0
2023-02-03 01:40:12.305570-0600 DJISDKSwiftDemo[3294:178994] IAPAppRegisterClient: __eaiap2dHasClientID 0, IAP2DHasLaunched 0
2023-02-03 01:40:12.305721-0600 DJISDKSwiftDemo[3294:178994] IAPAppRegisterClient: registerWasSuccessful 0
2023-02-03 01:40:12.306018-0600 DJISDKSwiftDemo[3294:178994] -[EAAccessoryManager _initFromSingletonCreationMethod] initializing (0x282ed8960) with uuid ABF49659-7F2F-4365-BE87-0990AF82B15A
2023-02-03 01:40:12.306085-0600 DJISDKSwiftDemo[3294:178994] -[EAAccessoryManager _initFromSingletonCreationMethod] isRunningOnMac
2023-02-03 01:40:12.318752-0600 DJISDKSwiftDemo[3294:178994] initialConnectedAccessories count 0
2023-02-03 01:40:12.318792-0600 DJISDKSwiftDemo[3294:178994] _connectedAccessories (0)
2023-02-03 01:40:12.318821-0600 DJISDKSwiftDemo[3294:178994] Done attaching initialConnectedAccessories
2023-02-03 01:40:12.318876-0600 DJISDKSwiftDemo[3294:178994] IAPAppConnectedAccessories: __eaClientHasCheckedForConnectedAccessories 0 -> 1
2023-02-03 01:40:12.319093-0600 DJISDKSwiftDemo[3294:178994] IAPAppConnectedAccessories: IAPDHasLaunched 0, IAP2DHasLaunched 0
2023-02-03 01:40:12.319885-0600 DJISDKSwiftDemo[3294:178994] On: 1050 RegisteredForLocalNotifications Count: 1
2023-02-03 01:40:12.319937-0600 DJISDKSwiftDemo[3294:178994] Returning connectedAccessories count 0
2023-02-03 01:40:12.319971-0600 DJISDKSwiftDemo[3294:178994] Returning connectedAccessories count 0
2023-02-03 01:40:12.320391-0600 DJISDKSwiftDemo[3294:178994] Returning connectedAccessories count 0
2023-02-03 01:40:12.320457-0600 DJISDKSwiftDemo[3294:178994] Returning connectedAccessories count 0
2023-02-03 01:40:12.320521-0600 DJISDKSwiftDemo[3294:178994] Returning connectedAccessories count 0
2023-02-03 01:40:13.070269-0600 DJISDKSwiftDemo[3294:178994] [Security] This method should not be called on the main thread as it may lead to UI unresponsiveness.
2023-02-03 01:40:13.073575-0600 DJISDKSwiftDemo[3294:178994] [Security] This method should not be called on the main thread as it may lead to UI unresponsiveness.
2023-02-03 01:40:13.074565-0600 DJISDKSwiftDemo[3294:178994] [Security] This method should not be called on the main thread as it may lead to UI unresponsiveness.
2023-02-03 01:40:13.075468-0600 DJISDKSwiftDemo[3294:178994] [Security] This method should not be called on the main thread as it may lead to UI unresponsiveness.
2023-02-03 01:40:13.352032-0600 DJISDKSwiftDemo[3294:178994] [Security] This method should not be called on the main thread as it may lead to UI unresponsiveness.
2023-02-03 01:40:13.353750-0600 DJISDKSwiftDemo[3294:179215] [connection] nw_proxy_resolver_create_parsed_array [C1.1.1 proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:13.355110-0600 DJISDKSwiftDemo[3294:178994] [Security] This method should not be called on the main thread as it may lead to UI unresponsiveness.
2023-02-03 01:40:13.357013-0600 DJISDKSwiftDemo[3294:178994] [Security] This method should not be called on the main thread as it may lead to UI unresponsiveness.
2023-02-03 01:40:13.358945-0600 DJISDKSwiftDemo[3294:178994] [Security] This method should not be called on the main thread as it may lead to UI unresponsiveness.
2023-02-03 01:40:13.360809-0600 DJISDKSwiftDemo[3294:178994] [Security] This method should not be called on the main thread as it may lead to UI unresponsiveness.
2023-02-03 01:40:13.376393-0600 DJISDKSwiftDemo[3294:178994] open on /var/mobile/Containers/Data/Application/8CE3E5BC-DDA3-4DA1-A264-C9C94047F85F/Library/.space_db/flysafe_areas_djigo_en.db: No such file or directory
2023-02-03 01:40:13.397975-0600 DJISDKSwiftDemo[3294:179239] [connection] nw_proxy_resolver_create_parsed_array [C2.1.1 proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:13.400024-0600 DJISDKSwiftDemo[3294:179239] [connection] nw_proxy_resolver_create_parsed_array [C3.1 proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:13.409380-0600 DJISDKSwiftDemo[3294:179239] [connection] nw_proxy_resolver_create_parsed_array [C4.1 proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:13.956164-0600 DJISDKSwiftDemo[3294:179248] [connection] nw_proxy_resolver_create_parsed_array [C5.1.1 proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:13.957300-0600 DJISDKSwiftDemo[3294:179248] [connection] nw_proxy_resolver_create_parsed_array [C6.1.1 proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:13.997914-0600 DJISDKSwiftDemo[3294:179218] [connection] nw_proxy_resolver_create_parsed_array [C7.1.1 proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:14.001291-0600 DJISDKSwiftDemo[3294:179218] [connection] nw_proxy_resolver_create_parsed_array [C8.1.1 proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:14.001808-0600 DJISDKSwiftDemo[3294:179218] [connection] nw_proxy_resolver_create_parsed_array [C9.1.1 proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:14.003861-0600 DJISDKSwiftDemo[3294:179218] [connection] nw_proxy_resolver_create_parsed_array [C10.1.1 proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:14.041406-0600 DJISDKSwiftDemo[3294:179219] [connection] nw_proxy_resolver_create_parsed_array [C11.1 proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:14.222903-0600 DJISDKSwiftDemo[3294:179218] [connection] nw_proxy_resolver_create_parsed_array [C12.1 proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:14.584083-0600 DJISDKSwiftDemo[3294:179240] [connection] nw_proxy_resolver_create_parsed_array [C13.1 proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:14.629938-0600 DJISDKSwiftDemo[3294:178994] SDK Registered with error 
2023-02-03 01:40:14.630622-0600 DJISDKSwiftDemo[3294:179264] Returning connectedAccessories count 0
2023-02-03 01:40:15.214453-0600 DJISDKSwiftDemo[3294:179219] [connection] nw_proxy_resolver_create_parsed_array [C14.1.1 proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:15.530384-0600 DJISDKSwiftDemo[3294:179281] Returning connectedAccessories count 0
2023-02-03 01:40:15.530499-0600 DJISDKSwiftDemo[3294:179283] Returning connectedAccessories count 0
2023-02-03 01:40:15.830404-0600 DJISDKSwiftDemo[3294:179286] Returning connectedAccessories count 0
2023-02-03 01:40:16.364449-0600 DJISDKSwiftDemo[3294:179235] [] nw_path_necp_check_for_updates Failed to copy updated result (22)
2023-02-03 01:40:16.365499-0600 DJISDKSwiftDemo[3294:179235] [connection] nw_proxy_resolver_create_parsed_array [C15.1.1 proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:17.519960-0600 DJISDKSwiftDemo[3294:179219] [connection] nw_proxy_resolver_create_parsed_array [C16.1.1 proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:18.316340-0600 DJISDKSwiftDemo[3294:179218] [connection] nw_proxy_resolver_create_parsed_array [C17.1 dry-run proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:18.316860-0600 DJISDKSwiftDemo[3294:179218] [connection] nw_proxy_resolver_create_parsed_array [C18.1 dry-run proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:18.318049-0600 DJISDKSwiftDemo[3294:179218] [connection] nw_proxy_resolver_create_parsed_array [C19 dry-run proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:18.319054-0600 DJISDKSwiftDemo[3294:179218] [connection] nw_proxy_resolver_create_parsed_array [C20.1 dry-run proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:18.319827-0600 DJISDKSwiftDemo[3294:179218] [connection] nw_proxy_resolver_create_parsed_array [C21.1 dry-run proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:18.320719-0600 DJISDKSwiftDemo[3294:179218] [connection] nw_proxy_resolver_create_parsed_array [C22.1 dry-run proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:18.321612-0600 DJISDKSwiftDemo[3294:179218] [connection] nw_proxy_resolver_create_parsed_array [C23.1 dry-run proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:18.321928-0600 DJISDKSwiftDemo[3294:179218] [connection] nw_proxy_resolver_create_parsed_array [C24.1 dry-run proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:18.322856-0600 DJISDKSwiftDemo[3294:179218] [connection] nw_proxy_resolver_create_parsed_array [C25.1 dry-run proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:18.323157-0600 DJISDKSwiftDemo[3294:179218] [connection] nw_proxy_resolver_create_parsed_array [C26 dry-run proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:18.323764-0600 DJISDKSwiftDemo[3294:179218] [connection] nw_proxy_resolver_create_parsed_array [C27 dry-run proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:18.324024-0600 DJISDKSwiftDemo[3294:179218] [connection] nw_proxy_resolver_create_parsed_array [C28.1 dry-run proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:18.325169-0600 DJISDKSwiftDemo[3294:179218] [connection] nw_proxy_resolver_create_parsed_array [C29.1 dry-run proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:18.325988-0600 DJISDKSwiftDemo[3294:179218] [connection] nw_proxy_resolver_create_parsed_array [C30 dry-run proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:18.327073-0600 DJISDKSwiftDemo[3294:179218] [connection] nw_proxy_resolver_create_parsed_array [C31 dry-run proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:18.328080-0600 DJISDKSwiftDemo[3294:179218] [connection] nw_proxy_resolver_create_parsed_array [C32.1 dry-run proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:18.329192-0600 DJISDKSwiftDemo[3294:179218] [connection] nw_proxy_resolver_create_parsed_array [C33.1.1 proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:18.329784-0600 DJISDKSwiftDemo[3294:179218] [connection] nw_proxy_resolver_create_parsed_array [C34.1.1 proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:19.472800-0600 DJISDKSwiftDemo[3294:179214] [connection] nw_proxy_resolver_create_parsed_array [C35.1.1 proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:20.659779-0600 DJISDKSwiftDemo[3294:179239] [connection] nw_proxy_resolver_create_parsed_array [C36.1.1 proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:21.821797-0600 DJISDKSwiftDemo[3294:179214] [connection] nw_proxy_resolver_create_parsed_array [C37.1.1 proxy pac] Evaluation error: NSURLErrorDomain: -1004
2023-02-03 01:40:27.304500-0600 DJISDKSwiftDemo[3294:178994] CoreAccessories accessoryInfo for arrival = {
...ignored...
}
2023-02-03 01:40:27.306997-0600 DJISDKSwiftDemo[3294:178994] _externalAccessoryConnected: userInfo {
...ignored...
}
2023-02-03 01:40:27.307694-0600 DJISDKSwiftDemo[3294:178994] For C1 - 49390175 (transport 8), Found initialVehicleInfoDictionary {
}
2023-02-03 01:40:27.308560-0600 DJISDKSwiftDemo[3294:178994] eaAccessory CoreAccessoryPrimaryUUID = A052E381-11E2-4040-A53B-928525311931
2023-02-03 01:40:27.309143-0600 DJISDKSwiftDemo[3294:178994] Added accessory connectionID 49390175, UUID A052E381-11E2-4040-A53B-928525311931
2023-02-03 01:40:27.309234-0600 DJISDKSwiftDemo[3294:178994] On: 1559 Accessory Connected with UUID A052E381-11E2-4040-A53B-928525311931 connectionID 49390175 createdByCoreAccessories 1. RegisteredForLocalNotifications Count: 1
2023-02-03 01:40:27.309317-0600 DJISDKSwiftDemo[3294:179218] On: 1598 Accessory Connected. InternalNotPresentIniAPAccArray: 0
2023-02-03 01:40:27.309403-0600 DJISDKSwiftDemo[3294:178994] On: 1623 Posting EA DidConnect Notification for Accessory with UUID: A052E381-11E2-4040-A53B-928525311931 connectionID 49390175 createdByCoreAccessories 1
2023-02-03 01:40:28.313178-0600 DJISDKSwiftDemo[3294:179264] Returning connectedAccessories count 1
2023-02-03 01:40:28.313366-0600 DJISDKSwiftDemo[3294:179283] Returning connectedAccessories count 1
2023-02-03 01:40:28.313540-0600 DJISDKSwiftDemo[3294:179281] Returning connectedAccessories count 1
2023-02-03 01:40:28.313646-0600 DJISDKSwiftDemo[3294:179286] Returning connectedAccessories count 1
2023-02-03 01:40:28.320828-0600 DJISDKSwiftDemo[3294:179286] accessoryd sessionResult = 1, useSocketInterace = 1, sessionID = 0x4
2023-02-03 01:40:28.320937-0600 DJISDKSwiftDemo[3294:179286] socketPath from app = /var/mobile/Library/ExternalAccessory/ea.9899120457695347405
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000105f7c90c DJISDK`___lldb_unnamed_symbol68526 + 216
    frame #1: 0x0000000105e0b050 DJISDK`___lldb_unnamed_symbol59969 + 60
    frame #2: 0x000000010360c5a8 libdispatch.dylib`_dispatch_call_block_and_release + 32
    frame #3: 0x000000010360e05c libdispatch.dylib`_dispatch_client_callout + 20
    frame #4: 0x000000010361e810 libdispatch.dylib`_dispatch_main_queue_drain + 1196
    frame #5: 0x000000010361e354 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 44
    frame #6: 0x0000000189b1a6d8 CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
    frame #7: 0x0000000189afc03c CoreFoundation`__CFRunLoopRun + 2036
    frame #8: 0x0000000189b00ec0 CoreFoundation`CFRunLoopRunSpecific + 612
    frame #9: 0x00000001c3b57368 GraphicsServices`GSEventRunModal + 164
    frame #10: 0x000000018bff686c UIKitCore`-[UIApplication _run] + 888
    frame #11: 0x000000018bff64d0 UIKitCore`UIApplicationMain + 340
  * frame #12: 0x0000000102fad56c DJISDKSwiftDemo`main at AppDelegate.swift:12:7
    frame #13: 0x00000001a8322960 dyld`start + 2528
(lldb)

This could related to #540 except it points to main thread.

image image image image
DJI-William commented 1 year ago

Probs a violation between the new iOS version with iOS MSDK v4.16.2. Unfortunately, there is no iOS dev team for iOS MSDK anymore so I would suggest you downgrade the iOS device for the work around.

danei commented 1 year ago

I downgraded to 15.6RC (the only signed IPSW option) but still got same error.

danei commented 1 year ago

OK further investigation. The problem is wired. Just took a look on RC info which I thought trivial:

CoreAccessories accessoryInfo for arrival = {
    ACCExternalAccessoryPPIDKey = "<null>";
    ACCExternalAccessoryPrimaryUUID = "E1EE500F-09D7-41A2-976B-6EB8C7CD669D";
    ACCExternalAccessoryProtocolDetailsKey =     {
        "com.dji.common" =         {
            ACCExternalAccessoryMatchAction = 1;
            ACCExternalAccessoryProtocolEndpointUUID = "1071CBD7-758E-4713-AED8-619615CDF9CD";
            ACCExternalAccessoryProtocolIndex = 0;
            ACCExternalAccessoryProtocolType = 2;
            ACCExternalAccessorySessionUsesSocketInterfaceKey = 1;
        };
    };
    ACCExternalAccessoryRegionCodeKey = "<null>";
    IAPAppAccessoryCapabilitiesKey = 1;
    IAPAppAccessoryCertDataKey = "908 bytes";
    IAPAppAccessoryCertSerialNumberKey = "15 bytes";
    IAPAppAccessoryDockTypeKey = "";
    IAPAppAccessoryFirmwareRevisionKey = "v2.0.0.7";
    IAPAppAccessoryFirmwareRevisionPendingKey = "<null>";
    IAPAppAccessoryHardwareRevisionKey = "v1.0.0.0";
    IAPAppAccessoryManufacturerKey = DJI;
    IAPAppAccessoryModelNumberKey = GL300B;
    IAPAppAccessoryNameKey = C1;
    IAPAppAccessoryProtocolsKey =     {
        "com.dji.common" = 0;
    };
    IAPAppAccessorySerialNumberKey = 0CKJ2042CV;
    IAPAppAccessoryTransportType = 8;
    IAPAppAccessoryVehicleInfoInitialDataKey =     {
    };
    IAPAppConnectionIDKey = 42964521;
}

The Phantom 4 pro controller is GL300F, I can confirm that on sticker, not GL300B. So I tried DJI Go 4 with remote only, and it detects Inspire 2...

DJI-William commented 1 year ago

Something wrong with the RC.

danei commented 1 year ago

Bought another RC, same weired output (showed GL300B rather than GL300F) but sample didn't crash...