iOS 添加Cordova到已存在的Xcode 工程裡

來源:互聯網
上載者:User

iOS 添加Cordova到已存在的Xcode 工程裡

Cordova官網關於如何建立PhoneGao項目的步驟已經很詳細了,這裡就不贅述了。

實際項目開發中可能需要添加Cordova到已經存在的工程中,近期就遇到了這個問題。雖然網上也有一些教程,

但已不適用於最新版本的Cordova了,故特將步驟紀錄如下。

 

1.加入我們已經存在名為Demo項目,目錄結構如下:

2.拷貝Cordova相關檔案到Demo目錄下,拷貝後目錄結構如下

3.將CordovaLib.xcodeproj添加到Demo工程中,右鍵選擇Add Files To Demo

4.添加www目錄到工程中,記得是勾選Create folder references

5.按步驟三添加config.xml到工程中,目錄結構如下

6.選擇工程的Build Settings->Other Links, 設定-Objc -all_load

7.選擇Build Phases->New Run Script Phase,將新增New Run Script Phase命名為copy www directory

 

8.Build Phases->Target Dependencies添加CordovaLib

9.Link Binary With Librarys添加libCordova.a, MobileCoreServices,AssetsLibrary

9.接下來你就可以正常使用Cordova了,注意other linkers一定要設定,

'-[__NSCFConstantString JSONObject]: unrecognized selector sent to instance否則會提示類似的錯誤

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.