Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

ARKit XR Plugin 100% Crash on iOS 11.0

Discussion in 'Handheld AR' started by nfomichev, Sep 23, 2019.

  1. nfomichev

    nfomichev

    Joined:
    Aug 29, 2019
    Posts:
    1
    Hello everyone,

    ARKit XR Plugin is causing app to crash on iOS 11.0 in 100%, because it is using newer API that was introduced in later versions of iOS. This is reproducible in our released app and in AR Foundation samples.

    How to reproduce:
    • download AR Foundation samples - https://github.com/Unity-Technologies/arfoundation-samples/tree/2.1
    • build SimpleAR scene for iOS using Xcode 11 (no changes to the sample is needed), the resulted project will be targeting iOS 11.0
    • build and deploy resulted Xcode project on a real device running iOS 11.0, using Xcode 11
    • terminate the app in app switcher, ([UnityAppController -applicationWillTerminate] will be called, etc)

    The app will crash with the following message in the Xcode console:

    2019-09-23 20:13:09.119948+0300 samples[1161:3786176] -[ARWorldTrackingConfiguration setDetectionImages:]: unrecognized selector sent to instance 0x1c0097480
    2019-09-23 20:13:09.271182+0300 samples[1161:3786176] Uncaught exception: NSInvalidArgumentException: -[ARWorldTrackingConfiguration setDetectionImages:]: unrecognized selector sent to instance 0x1c0097480
    (
    0 CoreFoundation 0x0000000182033d50 <redacted> + 148
    1 libobjc.A.dylib 0x0000000181548528 objc_exception_throw + 56
    2 CoreFoundation 0x00000001820411f8 <redacted> + 0
    3 CoreFoundation 0x00000001820396e4 <redacted> + 1380
    4 CoreFoundation 0x0000000181f1f0dc _CF_forwarding_prep_0 + 92
    5 samples 0x000000010623385c _ZN21ImageTrackingProvider4StopEv + 284
    6 samples 0x00000001062339b8 _ZN21ImageTrackingProvider9OnDestroyEv + 20
    7 samples 0x000000010623437c _ZN21ImageTrackingProviderD2Ev + 20
    8 libsystem_c.dylib 0x0000000181abdbd8 __cxa_finalize_ranges + 384
    9 libsystem_c.dylib 0x0000000181a670c0 exit + 24
    10 UIKit 0x000000018b4cacf4 <redacted> + 0
    11 UIKit 0x000000018b939b04 <redacted> + 344
    12 UIKit 0x000000018b6b3680 <redacted> + 292
    13 UIKit 0x000000018b6a6b24 <redacted> + 288
    14 UIKit 0x000000018b435808 <redacted> + 132
    15 CoreFoundation 0x0000000181fdb8b8 <redacted> + 32
    16 CoreFoundation 0x0000000181fd9270 <redacted> + 412
    17 CoreFoundation 0x0000000181fd982c <redacted> + 1292
    18 CoreFoundation 0x0000000181efa2d8 CFRunLoopRunSpecific + 436
    19 GraphicsServices 0x0000000183d8bf84 GSEventRunModal + 100
    20 UIKit 0x000000018b4a6880 UIApplicationMain + 208
    21 samples 0x0000000104f17540 main + 208
    22 libdyld.dylib 0x0000000181a1e56c <redacted> + 4
    )
    2019-09-23 20:13:09.275515+0300 samples[1161:3786176] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ARWorldTrackingConfiguration setDetectionImages:]: unrecognized selector sent to instance 0x1c0097480'


    The most important line here is
    -[ARWorldTrackingConfiguration setDetectionImages:]: unrecognized selector sent to instance 0x1c0097480
    . Apparently, an instance of ImageTrackingProvider is trying to unset the detection images in its destructor. I'm not sure why ARKit XR/AR Foundation is trying to (un-)set detection images in SimpleAR scene (as it doesn't use this functionality), but I'm definitely sure that it should not try to use this API on the iOS version where it is not available. Detection images property was introduced in iOS 11.3 - https://developer.apple.com/documentation/arkit/arworldtrackingconfiguration/2941063-detectionimages. We don't use detection images in our app as well.

    Looks like this code is called during app termination process, so users don't see it, thus it is not as severe as usual 100% crash, but it floods the crash reports, making it harder to find our own app's crashes.

    Prerequisites:
    • Xcode 11.0 (11A420a)
    • Unity 2019.2.3.f1
    • ARKit XR Plugin 2.2.0 preview 5 (we are also getting this crash on 2.1.0 version released in AppStore)
    • AR Foundation 2.2.0 preview 3
    Expected behavior: the app doesn't crash on iOS 11.0
    Actual behavior: the app crashes on iOS 11.0
     
  2. zhouchaozhi

    zhouchaozhi

    Joined:
    Sep 1, 2019
    Posts:
    2
    Thanks!
    I also encountered such a problem, may I ask how to solve it
     
  3. mdurand

    mdurand

    Unity Technologies

    Joined:
    Aug 1, 2016
    Posts:
    39
    This issue should be addressed in the 3.0.x versions of the ARKit & ARKit plugins and later. Please test again using those versions.

    -Mike
     
  4. hungvt_unity

    hungvt_unity

    Joined:
    Apr 28, 2020
    Posts:
    5
    Hi,
    I still got this error on Unity 2019.2.21f1 + AR Foundation 3.0.1 + AR Subsystems 3.0.2 + ARCore XR 3.0.4 + ARKit XR 3.0.4.
    I built my project using Xcode 11.2.1 and tested on iPhone 6s iOS 11.4.1. The game crash every time it recognized image. This is logs from device, please take a look:
     
  5. hungvt_unity

    hungvt_unity

    Joined:
    Apr 28, 2020
    Posts:
    5
    any help please?
     
  6. todds_unity

    todds_unity

    Unity Technologies

    Joined:
    Aug 1, 2018
    Posts:
    147
  7. hungvt_unity

    hungvt_unity

    Joined:
    Apr 28, 2020
    Posts:
    5
    submitted a bug (Case 1256545) Image Tracking crash only on iPhone 6s ios 11.4.1 please check
     
unityunity