简体   繁体   English

Xcode 10,带有CoreNFC的Swift 4应用在iOS 12上发生崩溃

[英]Xcode 10, Swift 4 app with CoreNFC crashes in review on iOS 12

My app created for iOS submitted to Appstoreconnect gets rejected as it crashes on launch in their review process. 我为iOS创建的提交给Appstoreconnect的应用在审核过程中由于崩溃而被拒绝。

My app uses CoreNFC framework . 我的应用程序使用CoreNFC框架 So this app is compatible with devices iPhone 7, 8, X.. with iOS 11 or higher. 因此,此应用程序与具有iOS 11或更高版本的iPhone 7、8,X ..设备兼容。 App was tested by me on physical device, working fine. 我在物理设备上对App进行了测试,效果很好。 Also launching on simulators was fine (NFC functions not working, but app didn't crash). 在模拟器上启动也很好(NFC功能不起作用,但应用程序没有崩溃)。

Crashlog contains info where I can see that CoreNFC framework was not loaded on their launch: Crashlog包含的信息可让我看到CoreNFC框架在启动时未加载:

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. 我试图将CoreNFC框架嵌入应用程序的“常规”选项卡-“嵌入式二进制文件”中,但它给我带来构建错误,因此我不确定是否有可能。

So my questions are: 所以我的问题是:

  • Is it possible to embed CoreNFC framework in Embedded Binaries section in Xcode? 是否可以在Xcode的“嵌入式二进制文件”部分中嵌入CoreNFC框架?
  • Is it possible to check whether device supports this framework before loading it? 加载之前是否可以检查设备是否支持此框架?

Any help or workaround would be much appreciated.. 任何帮助或解决方法将不胜感激。

Go to Project settings -> General -> Linked Frameworks and Libraries 转到项目设置->常规->链接的框架和库

Add CoreNFC.framework with status optional 添加CoreNFC.framework,状态为可选

I had the same problem with my NFC Reader. 我的NFC阅读器也有同样的问题。 It looks like iOS12 does not include CoreNFC for older devices (iPhone 6s, SE and older). 看来iOS12不包含适用于旧设备(iPhone 6s,SE和旧版本)的CoreNFC。

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 要查看示例,以下是该应用程序的链接: https : //itunes.apple.com/us/app/nfc-reader-for-iphone/id1249686798

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. 就我而言,我们不能只限于具有NFC的设备,因为我们上传了没有该要求的应用程序的原始版本,并且Apple不允许您为以前版本中不存在的新版本的应用程序添加新的限制。

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. 在我键入此内容的同时,在项目设置->常规->链接的框架和库下上传带有CoreNFC.framework的新版本,并在我们知道它是否起作用后立即更新此注释。

edit it worked. 编辑它的工作。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM