该设备是带有iOS 9.2的iPhone 6s Plus。使用Titanium Studio,当我在调试模式下运行并单步执行代码时,应用程序运行正常。但是,当我只是“运行”它(通过USB连接到笔记本电脑的设备)或在adhoc发行版中安装.ipa文件时,应用程序一启动就会崩溃。 “运行”时,Titanium中绝对没有生成日志。当运行已安装的.ipa时,Xcode中几乎没有相关信息。这是来自Xcode的日志:
Mar 18 09:42:51 ThisUser-iPhone-6s-Plus SpringBoard[58] <Error>: SecTrustEvaluate [leaf IssuerCommonName SubjectCommonName]
Mar 18 09:42:51 ThisUser-iPhone-6s-Plus SpringBoard[58] <Error>: SecTrustEvaluate [leaf IssuerCommonName SubjectCommonName]
Mar 18 09:42:51 ThisUser-iPhone-6s-Plus securityd[96] <Error>: secTaskDiagnoseEntitlements MISSING keychain entitlements: no stored taskRef found
Mar 18 09:42:51 ThisUser-iPhone-6s-Plus securityd[96] <Error>: secTaskDiagnoseEntitlements MISSING keychain entitlements: no stored taskRef found
Mar 18 09:42:51 ThisUser-iPhone-6s-Plus amfid[178] <Error>: SecTrustEvaluate [leaf IssuerCommonName SubjectCommonName]
Mar 18 09:42:51 ThisUser-iPhone-6s-Plus kernel[0] <Notice>: xpcproxy[311] Container: /private/var/mobile/Containers/Data/Application/8A3B415C-2259-A7NA-8XXD-8X5XFXCAJBDK (sandbox)
Mar 18 09:42:51 ThisUser-iPhone-6s-Plus MySampleApp[311] <Warning>: [DEBUG] Reading stylesheet from: /var/mobile/Containers/Bundle/Application/H3POBLF9-PB0N-1KF5-4RXY-EEDRD90GC79X/MySampleApp.app/stylesheet.plist
Mar 18 09:42:51 ThisUser-iPhone-6s-Plus iap2d[176] <Warning>: process com.mysampleco.mysampleapp is now running the foreground
Mar 18 09:42:51 ThisUser-iPhone-6s-Plus UserEventAgent[26] <Warning>: Tracking com.mysampleco.mysampleapp (via activity)
Mar 18 09:42:51 ThisUser-iPhone-6s-Plus MySampleApp[311] <Warning>: [INFO] MySampleApp/1.0.1 (5.2.0.384775e)
Mar 18 09:42:51 ThisUser-iPhone-6s-Plus MySampleApp[311] <Warning>: [DEBUG] Loading: /var/mobile/Containers/Bundle/Application/H3POBLF9-PB0N-1KF5-4RXY-EEDRD90GC79X/MySampleApp.app/app.js, Resource: app_js
Mar 18 09:42:52 ThisUser-iPhone-6s-Plus kernel[0] <Notice>: Sandbox: MySampleApp(311) deny(1) sysctl-read kern.proc.all.0
Mar 18 09:42:52 ThisUser-iPhone-6s-Plus kernel[0] <Notice>: Sandbox: MySampleApp(311) deny(1) process-info-pidinfo 0
Mar 18 09:42:52 ThisUser-iPhone-6s-Plus kernel[0] <Notice>: Sandbox: MySampleApp(311) deny(1) sysctl-read kern.proc.pid.0
Mar 18 09:42:52 ThisUser-iPhone-6s-Plus mediaserverd[28] <Notice>: '' com.mysampleco.mysampleapp(pid = 311) setting DiscoveryMode = DiscoveryMode_None, currentDiscoveryMode = DiscoveryMode_None
Mar 18 09:42:52 ThisUser-iPhone-6s-Plus SpringBoard[58] <Warning>: HW kbd: Failed to set (null) as keyboard focus
Mar 18 09:42:52 ThisUser-iPhone-6s-Plus mediaserverd[28] <Notice>: 'FigPlayer - 34' (pid = 34) setting DiscoveryMode = DiscoveryMode_None, currentDiscoveryMode = DiscoveryMode_None
Mar 18 09:42:52 ThisUser-iPhone-6s-Plus com.apple.xpc.launchd[1] (UIKitApplication:com.mysampleco.mysampleapp[0x72dd][311]) <Warning>: Service exited with abnormal code: 1
Mar 18 09:42:52 ThisUser-iPhone-6s-Plus SpringBoard[58] <Warning>: Application 'UIKitApplication:com.mysampleco.mysampleapp[0x72dd]' exited voluntarily.
Mar 18 09:42:52 ThisUser-iPhone-6s-Plus iap2d[176] <Warning>: process com.mysampleco.mysampleapp is now switching to other state
Mar 18 09:42:52 ThisUser-iPhone-6s-Plus iap2d[176] <Warning>: process com.mysampleco.mysampleapp is now terminated
Mar 18 09:42:52 ThisUser-iPhone-6s-Plus UserEventAgent[26] <Warning>: 85324450686: id=com.mysampleco.mysampleapp pid=311, state=0
Mar 18 09:42:52 ThisUser-iPhone-6s-Plus SpringBoard[58] <Warning>: [MPUSystemMediaControls] Updating supported commands for now playing application.
我搜索过其他帖子,其中一些人指向“Javascript Minification”(我关闭了但仍然发生了崩溃)以及一些关于代码生成部分中“最快,最小[-Os]”的讨论Xcode的Build设置(我不知道如何控制,因为我正在使用Appcelerator Titanium来构建应用程序)。其他几个人讨论了日志所揭示的特定代码问题。由于我在日志文件中没有得到任何我能说出来的重要信息,我不知道该去哪看。
感谢任何帮助。
2016年3月21日更新:
我花了一段时间才找出罪魁祸首。以下是重现问题的步骤:
1)在Titanium Studio中,使用Alloy Default模板创建一个新的Mobile App项目
2)将新创建的项目按原样运行到USB连接的iPhone 6s Plus(或者可能是任何ios设备)
3)点击设备上的应用程序图标,应用程序将在屏幕上与Hello World一起正常启动
4)现在转到TiApp.xml文件并通过添加以下参数进行编辑:
<property name="appc-sourcecode-encryption-policy">embed</property>
5)现在将修改后的项目运行到USB连接设备
6)打开应用程序,您会发现它在启动画面短暂显示后立即崩溃
看来上面的属性不能正常工作。开设了JIRA门票AC-3389。