Xcode 10, Swift 4 app with CoreNFC crashes in review on iOS 12
Asked Answered
C

3

10

My app created for iOS submitted to Appstoreconnect gets rejected as it crashes on launch in their review process.

My app uses CoreNFC framework. So this app is compatible with devices iPhone 7, 8, X.. with iOS 11 or higher. App was tested by me on physical device, working fine. Also launching on simulators was fine (NFC functions not working, but app didn't crash).

Crashlog contains info where I can see that CoreNFC framework was not loaded on their launch:

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Termination Description: DYLD, Library not loaded: /System/Library/Frameworks/CoreNFC.framework/CoreNFC | Referenced from: /var/containers/Bundle/Application/223F146A-DF69-43CC-89A1-CFDF323ACB45/SharpEnd NFC Scanner.app/SharpEnd NFC Scanner | Reason: image not found

I tried to embed CoreNFC framework in app General tab -- Embedded Binaries, but it gives me build errors so I'm not sure it is possible.

So my questions are:

  • Is it possible to embed CoreNFC framework in Embedded Binaries section in Xcode?
  • Is it possible to check whether device supports this framework before loading it?

Any help or workaround would be much appreciated..

Cask answered 28/9, 2018 at 21:2 Comment(1)
You can check this answer here #44946557Nausea
P
19

Go to Project settings -> General -> Linked Frameworks and Libraries

Add CoreNFC.framework with status optional

Phototelegraph answered 29/9, 2018 at 8:52 Comment(6)
Yes, I guess this is it. I just get to test on physical device with iOS 12 and without NFC module and managed to avoid crash. Thanks so much!!Cask
But that does not make any sense since the flag nfc in Required device capabilities does not allow this app to be launched on anything that does not have NFC module. So this is AppStore review error, right?Gnatcatcher
Yes, you are right but if the flag was not added on app first release, we cannot added it in another version, to do so we must have to upload a completely new app, so for avoiding that we can have optional framework, which prevents app crash if device is not capable of nfc.Phototelegraph
That makes complete sense but I always had this flag on and still encountered this problem with an update. Will set CoreNFC to optional, see what happens.Gnatcatcher
I hope this will help you outPhototelegraph
On XCode14, this option is available at: Project Settings -> Build Phases -> Link Binary with Libraries. developer.apple.com/library/archive/documentation/MacOSX/…Carola
W
4

I had the same problem with my NFC Reader. It looks like iOS12 does not include CoreNFC for older devices (iPhone 6s, SE and older).

I managed to fix it with device checks. In case an old device is trying to open the app I show a completely different storyboard with an error message that the device is not supported.

To see an example, here is a link to the app: https://itunes.apple.com/us/app/nfc-reader-for-iphone/id1249686798

Wager answered 7/11, 2018 at 10:51 Comment(0)
C
1

In my case, we couldn't restrict to only devices with NFC because we uploaded the original build of the app without that requirement and Apple does not allow you to add new restrictions for new versions of apps that didn't exist in previous versions.

Uploading a new build with the CoreNFC.framework under Project settings -> General -> Linked Frameworks and Libraries while I type this up and will update this comment as soon as we know whether or not it worked.

edit it worked. :)

Cohlier answered 7/11, 2018 at 7:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.