所有人。 我想創建一個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 [email protected]
安裝PhoneGap CLI。我認爲PhoneGap的安裝是成功的,因爲「phonegap -v」的結果是5.3.6。使用PhoneGap的iOS應用不起作用
要創建一個示例項目,我說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 [email protected]
Password:
npm WARN engine [email protected]: 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
> [email protected] 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
└─┬ [email protected]
├─┬ [email protected]
│ └─┬ [email protected]
│ └─┬ [email protected]
│ └── [email protected]
└─┬ [email protected]
└─┬ [email protected]
├─┬ [email protected]
│ └─┬ [email protected]
│ └─┬ [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ └─┬ [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ └── [email protected]
└─┬ [email protected]
└─┬ [email protected]
└── [email protected]
下面是一個日誌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 [email protected]
如果您在www文件夾中進行了更改,您必須執行'''cordova prepare ios'''將更改複製到xcode項目中 – jcesarmobile