如何在一个exisitng Xcode项目中安装phoneGap [英] How to install phoneGap in an exisitng Xcode project

查看:158
本文介绍了如何在一个exisitng Xcode项目中安装phoneGap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

解决方案

您可以按照以下步骤在任何ios项目中嵌入cordova webview: < 2.3,在2.3它有点不同,请参阅下面的链接)


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




 安装Cordova 
将Cordova.plist文件复制到磁盘上的项目文件夹
将Cordova.plist文件拖放到Xcode的项目导航器中
选择单选按钮为任何添加的文件夹创建组
按组合键Option-Command-A应该下拉一个工作表以将文件添加到您的项目(添加文件...工作表)。确保选择了为任何添加的文件夹创建的组单选按钮
按Shift组合键Shift-Command-G,它应该下拉另一个工作表,以转到文件夹(转到文件夹:sheet)
在转到文件夹:表中输入〜/ Documents / CordovaLib /,然后按Go按钮
在添加文件...中选择VERSION文件sheet
按添加文件...表中的添加按钮
按组合键Option-Command-A,它应该下拉一个工作表以将文件添加到项目中添加文件...表)。确保选择了为任何添加的文件夹创建的组单选按钮
按Shift组合键Shift-Command-G,它应该下拉另一个工作表,以转到文件夹(转到文件夹:sheet)
在转到文件夹:表中输入〜/ Documents / CordovaLib / CordovaLib.xcodeproj,然后按Go按钮
按添加按钮文件...工作表
在项目导航器中选择CordovaLib.xcodeproj
按组合键Option-Command-1显示文件检查器
在文件检查器中选择相对于CORDOVALIB为位置下拉菜单
单击项目导航器中的项目图标,选择您的项目,然后选择构建设置选项卡
添加-all_load和-Obj-C - 对于其他链接器标记值
单击项目导航器中的项目图标,选择您的目标,然后选择构建阶段选项卡
展开链接二进制库与库

点击+按钮,并添加这些框架(并且可选地在项目导航器中,将它们移动到Frameworks组下):

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

展开Target Dependencies - 如果您有多个框,则顶部框如下所示:
点击+按钮,添加CordovaLib构建产品
展开Link Binaries with Libraries - 如果你有多个框,顶部框标记为这样!
点击+按钮,添加libCordova.a

/ p>

phonegap cleaver< 2.3.0



phonegap cleaver> = 2.3.0


I have already built an Xcode project without phoneGap, but the client wants to add some new functionality. So I decided to use phoneGap to do it, I don't know how to import phoneGap to my old Xcode project. How can I do this?

解决方案

You can embed a cordova webview in any ios project following this steps: (Steps for cordova version < 2.3, in 2.3 its a bit different, see the link below)

Adding Cleaver to your Xcode project (CordovaLib sub-project)

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

for more info

phonegap cleaver < 2.3.0

phonegap cleaver >= 2.3.0

这篇关于如何在一个exisitng Xcode项目中安装phoneGap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆