本篇采用webView集成方式.
先下載ios平臺(tái)5+sdk:5+SDK官方下載地址.
1.集成sdk前要知道:在工程中引入HTML5+ SDK擴(kuò)展功能的.a文件,開發(fā)者可以根據(jù)需求添加不同的擴(kuò)展插件。必須要引入的是liblibPDRCore.a 和libcoreSupport.a,liblibPDRCore.a庫是HTML5+SDK運(yùn)行的基礎(chǔ)庫文件,libcoreSupport文件是PDRCore依賴的文件。
在引入lib文件將SDK/libs目錄下的靜態(tài)庫文件拖入到Xcode工程里即可
注意開發(fā)者在使用示例工程時(shí)建議不要把工程從SDK目錄里挪出來,如果要移動(dòng)工程可以通過修改library search path ,framework search path 和head search path來解決報(bào)錯(cuò)。
設(shè)置靜態(tài)庫搜索路徑,在工程的target->Build Settings->Library Search Paths,雙擊打開下拉列表,鼠標(biāo)左鍵按住靜態(tài)庫所在目錄,拖到下拉列表內(nèi)即可.
設(shè)置Enable BitCode 在工程里 target->Build Settings- 搜索框中輸入 Bitcode 將Enable Bitcode 設(shè)置為 NO.
在Info.plist中添加App Transport Security Settings類型Dictionary。
在App Transport Security Settings下添加Allow Arbitrary Loads類型Boolean,值設(shè)為YES
2.在集成5+SDK時(shí)必須在Other link flags 里添加 -ObjC.

3.引入如下幾個(gè)庫文件(這些靜態(tài)庫在Libs中),拉進(jìn)工程中,選擇creat groups.
liblibUI.a
liblibPDRCore.a
libcoreSupport.a
liblibNavigator.a
4.工程中引入HTML5+ SDK 中提供的頭文件。
頭文件在目錄 IOS-SDK/SDK/Inc目錄下

5.工程中必須要引入的系統(tǒng)庫
點(diǎn)擊TARGETS->General->Linked Frameworks and Librarys 添加工程依賴的庫文件
(下面少寫了一個(gè) webKit)

6.還需要在Bundles文件夾中把PandoraApi.bundle加入到工程中(官方文檔就沒用提到這個(gè),比較坑)
7.把本地html資源包拉進(jìn)工程,選擇Create folder references.

8.粘貼代碼,啟動(dòng)5+運(yùn)行環(huán)境
、、、
object - c
//啟動(dòng)5+運(yùn)行環(huán)境
? ? PDRCore*? pCoreHandle = [PDRCore Instance];
? ? if (pCoreHandle != nil)
? ? { ? ? ? ?// 單頁面集成時(shí)可以設(shè)置打開的頁面是本地文件或者是網(wǎng)絡(luò)路徑
? ? ? ? NSString* pFilePath = [NSString stringWithFormat:@"file://%@/%@", [NSBundle mainBundle].bundlePath, @"***工程里html資源包的名字***/index.html"];
? ? ? ? // 如果路徑中包含中文,或Xcode工程的targets名為中文則需要對(duì)路徑進(jìn)行編碼
? ? ? ? //NSString* pFilePath =? (NSString *)CFURLCreateStringByAddingPercentEscapes( kCFAllocatorDefault, (CFStringRef)pTempString, NULL, NULL,? kCFStringEncodingUTF8 );
? ? ? ? CGRect StRect = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
? ? ? ? appFrame = [[PDRCoreAppFrame alloc] initWithName:@"WebViewID1" loadURL:pFilePath frame:StRect];
? ? ? ? // 單頁面運(yùn)行時(shí)設(shè)置Document目錄
//? ? ? ? NSString* pStringDocumentpath = [NSString stringWithFormat:@"%@/Pandora/apps/www.zy.booya2shishi/www/", [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0]];
//? ? ? ? [pCoreHandle.appManager.activeApp.appInfo setWwwPath:pStringDocumentpath];
? ? ? ? [pCoreHandle.appManager.activeApp.appWindow registerFrame:appFrame];
? ? ? ? [self.view addSubview:appFrame];
? ? }
、、、