Cordova 构建 ios 但不会运行

Posted

技术标签:

【中文标题】Cordova 构建 ios 但不会运行【英文标题】:Cordova builds ios but won't run 【发布时间】:2016-02-09 03:18:07 【问题描述】:

我已经使用 cordova 和 android 有一段时间了,一切正常,

问题是我想添加 ios 并运行项目,这样我就可以检查准备工作是否不起作用,

问题是它构建得很好(log)但是在运行时我得到:

Running command: /Users/toniweb/Proyectos/cordova/funcook/platforms/ios/cordova/run --emulator
Building project  : /Users/toniweb/Proyectos/cordova/funcook/platforms/ios/funcook.xcodeproj
    Configuration : Debug
    Platform      : emulator
Build settings from command line:
    ARCHS = i386
    CONFIGURATION_BUILD_DIR = /Users/toniweb/Proyectos/cordova/funcook/platforms/ios/build/emulator
    SDKROOT = iphonesimulator9.1
    SHARED_PRECOMPS_DIR = /Users/toniweb/Proyectos/cordova/funcook/platforms/ios/build/sharedpch
    VALID_ARCHS = i386

Build settings from configuration file '/Users/toniweb/Proyectos/cordova/funcook/platforms/ios/cordova/build-debug.xcconfig':
    CODE_SIGN_IDENTITY = iPhone Developer
    ENABLE_BITCODE = NO

=== BUILD TARGET CordovaLib OF PROJECT CordovaLib WITH CONFIGURATION Debug ===

Check dependencies

=== BUILD TARGET funcook OF PROJECT funcook WITH CONFIGURATION Debug ===

Check dependencies

PhaseScriptExecution Copy\ www\ directory build/funcook.build/Debug-iphonesimulator/funcook.build/Script-304B58A110DAC018002A0835.sh
    cd /Users/toniweb/Proyectos/cordova/funcook/platforms/ios
    /bin/sh -c /Users/toniweb/Proyectos/cordova/funcook/platforms/ios/build/funcook.build/Debug-iphonesimulator/funcook.build/Script-304B58A110DAC018002A0835.sh

ProcessInfoPlistFile build/emulator/funcook.app/Info.plist funcook/funcook-Info.plist
    cd /Users/toniweb/Proyectos/cordova/funcook/platforms/ios
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
    builtin-infoPlistUtility /Users/toniweb/Proyectos/cordova/funcook/platforms/ios/funcook/funcook-Info.plist -genpkginfo /Users/toniweb/Proyectos/cordova/funcook/platforms/ios/build/emulator/funcook.app/PkgInfo -expandbuildsettings -format binary -platform iphonesimulator -additionalcontentfile /Users/toniweb/Proyectos/cordova/funcook/platforms/ios/build/funcook.build/Debug-iphonesimulator/funcook.build/MainViewController-PartialInfo.plist -o /Users/toniweb/Proyectos/cordova/funcook/platforms/ios/build/emulator/funcook.app/Info.plist

GenerateDSYMFile build/emulator/funcook.app.dSYM build/emulator/funcook.app/funcook
    cd /Users/toniweb/Proyectos/cordova/funcook/platforms/ios
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil /Users/toniweb/Proyectos/cordova/funcook/platforms/ios/build/emulator/funcook.app/funcook -o /Users/toniweb/Proyectos/cordova/funcook/platforms/ios/build/emulator/funcook.app.dSYM

Touch build/emulator/funcook.app
    cd /Users/toniweb/Proyectos/cordova/funcook/platforms/ios
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
    /usr/bin/touch -c /Users/toniweb/Proyectos/cordova/funcook/platforms/ios/build/emulator/funcook.app

** BUILD SUCCEEDED **

No target specified for emulator. Deploying to iPhone-6 simulator
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state
ENOENT, no such file or directory '/var/root/Library/Logs/CoreSimulator/759B7226-A331-436D-8189-310317E9BD87/system.log'
Error code 1 for command: ios-sim with args: launch,/Users/toniweb/Proyectos/cordova/funcook/platforms/ios/build/emulator/funcook.app,--devicetypeid,com.apple.CoreSimulator.SimDeviceType.iPhone-6,--stderr,/Users/toniweb/Proyectos/cordova/funcook/platforms/ios/cordova/console.log,--stdout,/Users/toniweb/Proyectos/cordova/funcook/platforms/ios/cordova/console.log,--exit
Error: /Users/toniweb/Proyectos/cordova/funcook/platforms/ios/cordova/run: Command failed with exit code 2
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:753:16)
    at Process.ChildProcess._handle.onexit (child_process.js:820:5)

我正在使用最新版本的 El Capitan、cordova 和 xcode,

我在这里错过了什么?

PS:在同一个项目中,Android 构建并运行...

-编辑-

如果我从 xcode 打开,我会得到:

-编辑-

现在它使用 xcode 的模拟器运行,但仍然不能从终端 cordova run ios --emulator 运行

【问题讨论】:

您有多个 xcode 版本吗?尝试打开 xcode 项目(它在平台/ios 中,双击 .xcodeproj)如果您最近更新了它,它可能正在等待您接受条款 我在上面,我正在通过 xcode 而不是终端运行(正在加载..) 它似乎没有工作或提示任何接受窗口... 如果你从 xcode 运行你会得到任何错误? 那种,带截图的编辑问题 【参考方案1】:

尝试使用 chmod 和 chown 更改文件权限... 它在我的情况下有效

【讨论】:

你建议我应该如何尝试? 试试这个'sudo chmod 775 /path/to/file' 如果您将文件夹权限更改为应该运行的整个文件夹...我有一个基于地图的小型应用程序正在运行...虽然它现在由于某种原因停止运行

以上是关于Cordova 构建 ios 但不会运行的主要内容,如果未能解决你的问题,请参考以下文章

Xcode无法打开cordova-ios生成的项目”:“6.1.1”但“5.1.0”没问题

用于 Visual Studio 的 Apache cordova 在构建期间不会更新 iOS 平台文件

未找到 Cordova_Plugins.js

CSS 动画在 iOS 上无法原生运行,但带有 Cordova 端口

为 ios 构建 Cordova 应用程序时更改消失

phonegap 相机适用于 iPhone,但不适用于 iPad