使用PhoneGap的iOS应用程序不起作用

时间:2015-11-04 01:56:43

标签: ios cordova

大家。 我想创建一个iOS应用程序,使用OS X(版本10.11.1),Xcode(版本7.1)和PhoneGap。为了安装PhoneGap,我安装了node.js和git。 node.js的版本和git的版本分别是v5.0.0和2.4.9。

我说sudo npm install -g phonegap@latest安装PhoneGap CLI。我认为PhoneGap的安装成功,因为“phonegap -v”的结果是5.3.6。

为了创建一个示例项目,我说phonegap create HelloWorld,这是一项非常重要的任务。然后,我执行了phonegap platform add iOS。生成platforms/ios/目录。

要打开HelloWorld项目,我说open platforms/ios/Hello¥ World.xcodeproj。我在www/index.html文件中将“PhoneGap”编辑为“RIREI IS NICE”,然后按“构建然后运行当前方案”按钮。但是,不打印消息RIREI IS NICE。 Xcode提出了以下消息:

2015-11-04 10:41:33.463 Hello World[808:22878] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///Users/digitalmeister/Library/Developer/CoreSimulator/Devices/9A119C8B-1123-4962-A2B0-C610291D9E0E/data/Containers/Data/Application/C1D3F47A-13A0-4584-AC5A 9866BE937C88/Library/Cookies/com.phonegap.helloworld.binarycookies
2015-11-04 10:41:33.985 Hello World[808:22878] Apache Cordova native platform version 3.9.2 is starting.
2015-11-04 10:41:33.986 Hello World[808:22878] Multi-tasking -> Device: YES, App: YES
2015-11-04 10:41:34.163 Hello World[808:22878] Unlimited access to network resources
2015-11-04 10:41:34.245 Hello World[808:22878] 

Started backup to iCloud! Please be careful.
Your application might be rejected by Apple if you store too much data.
For more information please read "iOS Data Storage Guidelines" at:
https://developer.apple.com/icloud/documentation/data-storage/
To disable web storage backup to iCloud, set the BackupWebStorage preference to "local" in the Cordova config.xml file

2015-11-04 10:41:35.814 Hello World[808:22878] Resetting plugins due to page load.
2015-11-04 10:41:36.216 Hello World[808:22878] Finished load of: file:///Users/digitalmeister/Library/Developer/CoreSimulator/Devices/9A119C8B-1123-4962-A2B0-C610291D9E0E/data/Containers/Bundle/Application/E1B2235E-2F2E-4BA8-9D11-7D9BDA0D5036/Hello%20World.app/www/index.html

我认为我的程序是正确的。我知道互联网上有很多类似的问题。我看了他们,但他们无法帮助我。

有谁能告诉我“出了什么问题”?由于我必须使用PhoneGap,我正在寻找答复。

作为参考,我写日志。

以下是npm

的日志
$ sudo npm install -g phonegap@latest
Password:
npm WARN engine xmlbuilder@2.2.1: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"5.0.0","npm":"3.3.6"})
/usr/local/bin/phonegap -> /usr/local/lib/node_modules/phonegap/bin/phonegap.js

> ws@0.4.31 install /usr/local/lib/node_modules/phonegap/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)

  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
/usr/local/lib
└─┬ phonegap@5.3.6 
  ├─┬ connect-phonegap@0.18.0
  │ └─┬ archiver@0.14.3
  │   └─┬ tar-stream@1.1.5
  │     └── xtend@4.0.1 
  └─┬ cordova@5.3.3
    └─┬ cordova-lib@5.3.3
      ├─┬ cordova-js@4.1.1
      │ └─┬ browserify@10.1.3
      │   └─┬ crypto-browserify@3.11.0 
      │     ├─┬ browserify-sign@4.0.0 
      │     │ ├── bn.js@4.1.1 
      │     │ ├── browserify-rsa@4.0.0 
      │     │ ├── elliptic@6.0.1 
      │     │ └─┬ parse-asn1@5.0.0 
      │     │   └── asn1.js@4.0.0 
      │     ├── create-ecdh@4.0.0 
      │     ├─┬ diffie-hellman@5.0.0 
      │     │ └── miller-rabin@4.0.0 
      │     └── public-encrypt@4.0.0 
      └─┬ init-package-json@1.9.1
        └─┬ read-package-json@2.0.1
          └── normalize-package-data@2.3.5 

以下是phone gap create HelloWorld

的日志
$ phonegap create HelloWorld
Creating a new cordova project.

cp: no such file or directory: /usr/local/lib/node_modules/phonegap/node_modules/cordova-lib/node_modules/cordova-app-hello-world/hooks/*


cp: no such file or directory: /usr/local/lib/node_modules/phonegap/node_modules/cordova-lib/node_modules/cordova-app-hello-world/config.xml

这是phonegap platform add ios

的日志
$ phonegap platform add ios
Adding ios project...

iOS project created with cordova-ios@3.9.2

1 个答案:

答案 0 :(得分:0)

@kuroshima将节点版本从当前的5.0.0降级到4.2.2,它会起作用。