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..

deevee
  • 1,550
  • 15
  • 21
  • 1
    You can check this answer here https://stackoverflow.com/questions/44946057/dyld-library-not-loaded-rpath-corenfc-framework-corenfc-ios11-and-xcode-9-be/52868674#52868674 – Khaled Annajar Oct 18 '18 at 07:11

3 Answers3

19

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

Add CoreNFC.framework with status optional

Nikhil Patel
  • 206
  • 2
  • 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!! – deevee Sep 29 '18 at 12:26
  • 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? – Alex Oct 21 '18 at 01:21
  • 1
    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. – Nikhil Patel Oct 21 '18 at 02:50
  • 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. – Alex Oct 22 '18 at 02:15
  • I hope this will help you out – Nikhil Patel Oct 22 '18 at 02:41
  • On XCode14, this option is available at: Project Settings -> Build Phases -> Link Binary with Libraries. https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WeakLinking.html – Kishore A Jun 01 '23 at 20:51
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

Nico S.
  • 3,056
  • 1
  • 30
  • 64
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. :)

James Tice
  • 29
  • 1
  • 6