如何在现有的 Xcode 项目中安装 phoneGap [关闭]

Posted

技术标签:

【中文标题】如何在现有的 Xcode 项目中安装 phoneGap [关闭]【英文标题】:How to install phoneGap in an exisitng Xcode project [closed] 【发布时间】:2012-09-14 08:05:42 【问题描述】:

我已经构建了一个没有 phoneGap 的 Xcode 项目,但是客户想要添加一些新功能。所以我决定使用phoneGap来做,我不知道如何将phoneGap导入我的旧Xcode项目。我该怎么做?

【问题讨论】:

【参考方案1】:

您可以按照以下步骤在任何 ios 项目中嵌入 cordova webview:(cordova 版本

将 Cleaver 添加到您的 Xcode 项目(CordovaLib 子项目)

Install Cordova
Copy the Cordova.plist file into your project folder on disk
Drag and drop the Cordova.plist file into the Project Navigator of Xcode
Choose the radio-button "Create groups for any added folders"
Press the key combination Option-Command-A, which should drop down a sheet to add files to your project (the "Add Files..." sheet). Make sure the "Created groups for any added folders" radio-button is selected
Press the key combination Shift-Command-G, which should drop down another sheet for you to go to a folder (the "Go to the folder:" sheet)
Enter ~/Documents/CordovaLib/ in the "Go to the folder:" sheet and then press the "Go" button
Select the VERSION file in the the "Add Files..." sheet
Press the "Add" button in the "Add Files..." sheet
Press the key combination Option-Command-A, which should drop down a sheet to add files to your project (the "Add Files..." sheet). Make sure the "Created groups for any added folders" radio-button is selected
Press the key combination Shift-Command-G, which should drop down another sheet for you to go to a folder (the "Go to the folder:" sheet)
Enter ~/Documents/CordovaLib/CordovaLib.xcodeproj in the "Go to the folder:" sheet and then press the "Go" button
Press the "Add" button in the "Add Files..." sheet
Select CordovaLib.xcodeproj in the Project Navigator
Press the key combination Option-Command-1 to show the File Inspector
Choose "Relative to CORDOVALIB" in the File Inspector for the drop-down menu for Location
Click on the project icon in the Project Navigator, select your Project, then select the "Build Settings" tab
Add -all_load and -Obj-C - for the "Other Linker Flags" value
Click on the project icon in the Project Navigator, select your Target, then select the "Build Phases" tab
Expand "Link Binaries with Libraries"

Click on the "+" button, and add these frameworks (and optionally in the Project Navigator, move them under the Frameworks group):

AddressBook.framework
AddressBookUI.framework
AudioToolbox.framework
AVFoundation.framework
CoreLocation.framework
MediaPlayer.framework
QuartzCore.framework
SystemConfiguration.framework
MobileCoreServices.framework
CoreMedia.framework

Expand "Target Dependencies" - the top box labeled like this if you have multiple boxes!
Click on the "+" button, and add the CordovaLib build product
Expand "Link Binaries with Libraries" - the top box labeled like this if you have multiple boxes!
Click on the "+" button, and add libCordova.a

更多信息

phonegap cleaver < 2.3.0

phonegap cleaver >= 2.3.0

【讨论】:

我收到此错误“[__NSCFDictionary dictionaryWithLowercaseKeys]: unrecognized selector sent to instance 0xbeb3da0”对此有何想法?? 你安装了哪个phonegap版本?我在这个线程中看到了这个问题groups.google.com/forum/?fromgroups=#!topic/phonegap/… 感谢您的帮助.. 我解决了这个问题。 我可以在我的 xcode 项目上安装 phonegap 并且运行良好,但我无法存档它.. 错误是 "Cordova/CDVViewController.h" not found .. 你能帮帮我吗? @Allan.Chen 我在存档时遇到了同样的问题。你是怎么解决的?

以上是关于如何在现有的 Xcode 项目中安装 phoneGap [关闭]的主要内容,如果未能解决你的问题,请参考以下文章

如何在现有的 ios 测试项目中启用 xcode 7 UI 测试

如何在现有Eclipse中安装CUDA NSight?

如何在 Xcode 6 中安装 FLTK 项目模板?

无法在现有 Xcode 项目中安装 cocoaPods

无法在 xcode 9.2 项目中安装 Cocoapods

如何在 Xcode 6.3 中安装 Quick and Nimble