xcode 应用程序在设备上崩溃,但在模拟器 iOS 上运行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40886484/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
App crash on device but works on simulator iOS
提问by Ossir
App wasn't developed by me, but now I have to add some features. Code compiles add launches on simulator but immediately crash on real device (didFinishLaunchingWithOptions never calls). Xcode doesn't show any errors. I think the problem may be in pods and frameworks but don't know how to check if this so. I reinstalled pods and recreated framework dependences in project but no app still crash. I have only this info from Xcode
应用程序不是我开发的,但现在我必须添加一些功能。代码编译添加在模拟器上启动,但在真实设备上立即崩溃(didFinishLaunchingWithOptions 从不调用)。Xcode 没有显示任何错误。我认为问题可能出在 pod 和框架中,但不知道如何检查是否如此。我在项目中重新安装了 pod 并重新创建了框架依赖项,但没有应用程序仍然崩溃。我只有来自 Xcode 的这个信息
How this info can help me? Any help appreciated.
这些信息如何帮助我?任何帮助表示赞赏。
UPD2: App crash on iOS9 and iOS10 so NSCameraUsageDescription isn't the problem
UPD2:iOS9 和 iOS10 上的应用程序崩溃,因此 NSCameraUsageDescription 不是问题
采纳答案by Ossir
The problem was in pods frameworks. Script generated by pods can't embed some frameworks correctly. I removed "[CP] Embed Pods Frameworks" script and add frameworks to "Embedded Binaries" by myself. And problem was solved.
问题出在 pods 框架中。Pod 生成的脚本无法正确嵌入某些框架。我删除了“[CP] Embed Pods Frameworks”脚本并自己将框架添加到“Embedded Binaries”。问题解决了。
回答by PhilippeAuriach
had the same problem, worked on simulator but not on device and got this wonderful but minimalist stacktrace "abort_with_payload"
有同样的问题,在模拟器上工作但不在设备上工作,得到了这个美妙但极简的堆栈跟踪“abort_with_payload”
Turns out I just needed the "NSMicrophoneUsageDescription" key in my plist
结果我只需要 plist 中的“NSMicrophoneUsageDescription”键
回答by Varun Naharia
If abort_with_payload
error occurred then chances are the Info.plist is missing UsageDescription
of any Privacy key so check is there any thing missing or apple changed/added new UsageDescription for camera, photos, location etc that you are using.
如果abort_with_payload
发生错误,则 Info.plist 可能缺少UsageDescription
任何隐私密钥,因此请检查是否缺少任何内容或苹果更改/添加了您正在使用的相机、照片、位置等的新 UsageDescription。
回答by Jiang Wang
Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Termination Description: DYLD, Library not loaded: @rpath/libswiftCoreGraphics.dylib | Referenced from: /var/containers/Bundle/Application/7208AD66-5D56-4973-88A9-8D22D7E541DB/myapp.app/myapp | Reason: no suitable image found. Did find: | /private/var/containers/Bundle/Application/7208AD66-5D56-4973-88A9-8D22D7E541DB/myapp.app/Frameworks/libswiftCoreGraphics.dylib: code signing blocked mmap() '/private/var/containers/Bundle/Application/7208AD66-5D56-4973-88A9-8D22D7E541DB/myapp.app/Frameworks/libswiftCoreGraphics.dylib'
Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Termination Description: DYLD, Library not loaded: @rpath/libswiftCoreGraphics.dylib | Referenced from: /var/containers/Bundle/Application/7208AD66-5D56-4973-88A9-8D22D7E541DB/myapp.app/myapp | Reason: no suitable image found. Did find: | /private/var/containers/Bundle/Application/7208AD66-5D56-4973-88A9-8D22D7E541DB/myapp.app/Frameworks/libswiftCoreGraphics.dylib: code signing blocked mmap() '/private/var/containers/Bundle/Application/7208AD66-5D56-4973-88A9-8D22D7E541DB/myapp.app/Frameworks/libswiftCoreGraphics.dylib'
When crashed on 'abort_with_payload', I also got the above output from the console. I think the most important message is "code signing blocked mmap()", which indicates the problem was probably caused by code signing.
当在“abort_with_payload”上崩溃时,我也从控制台得到了上述输出。我认为最重要的消息是“代码签名被阻止的 mmap()”,这表明问题可能是由代码签名引起的。
My solution was to delete the apple WWDR certificate and downloaded it from Apple. And MAKE SURE when trusting the certificate, use the "use system defaults" option.
我的解决方案是删除苹果WWDR证书并从Apple下载。并确保在信任证书时,使用“使用系统默认值”选项。
Then QUIT the XCode, reopened it, cleaned the project and rebuilt. It works for me.
然后退出 XCode,重新打开它,清理项目并重建。这个对我有用。