1:UIWebView加載本地的HTML
NSString *path = [[NSBundle mainBundle] bundlePath]; NSURL *baseURL = [NSURL fileURLWithPath:path]; NSString * htmlPath = [[NSBundle mainBundle] pathForResource:@"index1" ofType:@"html"]; NSString * htmlCont = [NSString stringWithContentsOfFile:htmlPath encoding:NSUTF8StringEncoding error:nil]; [self.webView loadHTMLString:htmlCont baseURL:baseURL];
注意:如何創建工程內的Css,js,html文件,創建iOS -other-Empty 如果Css 則以.css結尾,Js則以.js結尾,Html則是以.html結尾
2:JSPatch的運用
a:OC轉JSPatch的地址:http://bang590.github.io/JSPatchConvertor/
b:JSPatch腳本介紹地址:https://github.com/bang590/JSPatch/wiki
c:比較不錯的文章地址:ww.cnblogs.com/dsxniubility/p/5080875.html
d:JSPatch自動補地址:https://github.com/bang590/JSPatchX
注意版本控制(可以根據APP的版本號架服務端的請求地址)跟JS安全性(MD5加密然后再APP解密);
管理中心的一些考慮:
![]() |
![]() |
下面分享一個幫助類:
#import "JSPatchHelper.h" //文件名稱 NSString * const jsPatchJsFileName=@"main.js"; @implementation JSPatchHelper + (instancetype)sharedInstance { static JSPatchHelper* instance = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ instance = [JSPatchHelper new]; }); return instance; } +(void)HSDevaluateScript { //從本地獲取下載的JS文件 NSURL *p = FilePath; //判斷文件是否存在 NSString *curFilePath=[p.path stringByAppendingString:[NSString stringWithFormat:@"/%@",jsPatchJsFileName]]; if (![[NSFileManager defaultManager] fileExistsAtPath:curFilePath]) { return; } //獲取內容 NSString *js = [NSString stringWithContentsOfFile:curFilePath encoding:NSUTF8StringEncoding error:nil]; //如果有內容 if (js.length > 0) { //------- //服務端要對JS內容進行加密,在此處解密js內容;增加安全性 //---- //運行 [JPEngine startEngine]; [JPEngine evaluateScript:js]; } } +(void)loadJSPatch { //優化間隔一段時間 再去請求一次 否則太頻繁(這邊定義為一個小時才去請求一次) NSDate *myNowDate=[NSDate date]; if (!BBUserDefault.MBJsPatchTime) { BBUserDefault.MBJsPatchTime=myNowDate; return; } if ([myNowDate timeIntervalSinceDate:BBUserDefault.MBJsPatchTime]<3600) { return; } //使用AFNetWork下載在服務器的js文件 NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration]; NSURL *URL = [NSURL URLWithString:kJSPatchServerPath]; NSURLRequest *request = [NSURLRequest requestWithURL:URL]; NSURLSessionDownloadTask *downloadTask = [manager downloadTaskWithRequest:request progress:nil destination:^NSURL *(NSURL *targetPath, NSURLResponse *response) { NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)response; if (httpResponse.statusCode==200) { NSURL *documentsDirectoryURL = FilePath; //保存到本地 Library/Caches目錄下 return [documentsDirectoryURL URLByAppendingPathComponent:jsPatchJsFileName]; } else { return nil; } } completionHandler:^(NSURLResponse *response, NSURL *filePath, NSError *error) { NSLog(@"下載失敗 to: %@", filePath); }]; [downloadTask resume]; } @end
詳細的源代碼可以到:https://github.com/wujunyang/MobileProject查看
3:證書快要過期問題
第一步:如果開發者證書過期了的話,首先,打開密鑰中心,生成一個CSR(證書請求)。然后,到Apple Center把證書revoke,然后新建一個,新建的將會默認是剛剛revoke的證書的所有設置的。把下載回來的證書導出一份p12格式的保存起來(因為如果其他人需要的時候,只能跟你拿了,在Apple Center下載的用不了的。)然后去provision profile edit 一下,從新下載,替換掉原來的。你就可以繼續開發了(對外面已經安裝的用戶不會有影響)。
第二步:安裝新的p12證書,並下載修改后的描述文件,如果本地已經安裝以后的provisioning profile要先進行刪除,可以進入~/Library/MobileDevice/Provisioning Profiles ,找到相應的文件進行刪除,因為在文件里面它是以一串字符為命名,可以把舊證書先刪除然后在Xcode里面打包,它會有提示這個provisioning profile的名字,刪除就可以;然后在進行安裝最新的provisioning profile,並選擇相應證書就可以了;
4:給項目新建文件都默認增加前綴
5:iOS遠程推送知識點
我們的設備聯網時(無論是蜂窩聯網還是Wi-Fi聯網)都會與蘋果的APNs服務器建立一個長連接(persistent IP connection),當Provider(我們自個的后台服務器,用於推送)推送一條通知的時候,這條通知並不是直接推送給了我們的設備,而是先推送到蘋果的APNs服務器上面,而蘋果的APNs服務器再通過與設備建立的長連接進而把通知推送到我們的設備上(參考圖1-1,圖1-2)。而當設備處於非聯網狀態的時候,APNs服務器會保留Provider所推送的最后一條通知,當設備轉換為連網狀態時,APNs則把其保留的最后一條通知推送給我們的設備;如果設備長時間處於非聯網狀態下,那么APNs服務器為其保存的最后一條通知也會丟失。Remote Notification必須要求設備連網狀態下才能收到,並且太頻繁的接收遠程推送通知對設備的電池壽命是有一定的影響的。
deviceToken的生成:當一個App注冊接收遠程通知時,系統會發送請求到APNs服務器,APNs服務器收到此請求會根據請求所帶的key值生成一個獨一無二的value值也就是所謂的deviceToken,而后APNs服務器會把此deviceToken包裝成一個NSData對象發送到對應請求的App上。然后App把此deviceToken發送給我們自己的服務器,就是所謂的Provider。Provider收到deviceToken以后進行儲存等相關處理,以后Provider給我們的設備推送通知的時候,必須包含此deviceToken
遠程推送內容
每一條通知的消息都會組成一個JSON字典對象,其格式如下所示,示例中的key值為蘋果官方所用key。自定義字段的時候要避開這些key值。
{ "aps" : { "alert" : { // string or dictionary "title" : "string" "body" : "string", "title-loc-key" : "string or null" "title-loc-args" : "array of strings or null" "action-loc-key" : "string or null" "loc-key" : "string" "loc-args" : "array of strings" "launch-image" : "string" }, "badge" : number, "sound" : "string" "content-available" : number; "category" : "string" }, } aps:推送消息必須有的key alert:推送消息包含此key值,系統就會根據用戶的設置展示標准的推送信息 badge:在app圖標上顯示消息數量,缺少此key值,消息數量就不會改變,消除標記時把此key對應的value設置為0 sound:設置推送聲音的key值,系統默認提示聲音對應的value值為default content-available:此key值設置為1,系統接收到推送消息時就會調用不同的回調方法,iOS7之后配置后台模式 category:UIMutableUserNotificationCategory's identifier 可操作通知類型的key值 title:簡短描述此調推送消息的目的,適用系統iOS8.2之后版本 body:推送的內容 title-loc-key:功能類似title,附加功能是國際化,適用系統iOS8.2之后版本 title-loc-args:配合title-loc-key字段使用,適用系統iOS8.2之后版本 action-loc-key:可操作通知類型key值,不詳細敘述 loc-key:參考title-loc-key loc-args:參考title-loc-args launch-image:點擊推送消息或者移動事件滑塊時,顯示的圖片。如果缺少此key值,會加載app默認的啟動圖片。
當然以上key值並不是每條推送消息都必帶的key值,應當根據需求來選擇所需要的key值,除了以上系統所提供的key值外,你還可以自定義自己的key值,來作為消息推送的負載,自定義key值與aps此key值並列。如下格式:
{ "aps" : { "alert" : "Provider push messag.", "badge" : 9, "sound" : "toAlice.aiff" }, "Id" : 1314, // 自定義key值 "type" : "customType" // 自定義key值 }
指定用戶的推送
對於要求用戶登錄的App,推送是可以指定用戶的,同一條推送有些用戶可以收到,但是有些用戶又不能收到。說起來這個就要提到另外的一個token了,一般稱之為userToken,userToken一般都是根據自己公司自定義的規則去生成的。userToken是以用戶的賬號加對應的密碼生成的。這樣結合上面提到的deviceToken,就可以做到根據不同的用戶推送不同的消息。deviceToken找到對應某台設備和該設備上的應用,而userToken對應找到該用戶。客戶端在上報deviceToken的時候,要把userToken對應一起上報給服務端也就是Provider。
6:創建私有pod
關於這方面的知識可以查看下面幾個文章,有時間再寫一篇文章
http://www.jianshu.com/p/ddc2490bff9f[如何創建私有 CocoaPods 倉庫]
http://www.jianshu.com/p/7a82e977281c[制作 CocoaPods 依賴庫]
http://blog.devzeng.com/blog/ios-cocoapods-private-repo.html [在iOS項目中使用CocoaPods私有庫]
http://www.pluto-y.com/cocoapods-getting-stared/ [Cocoapods系列教程1,2,3]
http://www.cocoachina.com/ios/20150228/11206.html[使用Cocoapods創建私有podspec]
http://www.jianshu.com/p/1139a603f413[創建私有pod]
http://eric-gao.iteye.com/blog/2128283 [提交framework到cocoapods官方去]
下面來幾張成功創建的圖片:
![]() |
![]() |
|
![]() |
![]() |
![]() |
配置文件:
# # Be sure to run `pod spec lint WjyTestClasses.podspec' to ensure this is a # valid spec and to remove all comments including this before submitting the spec. # # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ # Pod::Spec.new do |s| # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # These will help people to find your library, and whilst it # can feel like a chore to fill in it's definitely to your advantage. The # summary should be tweet-length, and the description more in depth. # s.name = "WjyTestClasses" s.version = "0.0.2" s.summary = "這是一個簡單的測試運用類" # This description is used to generate tags and improve search results. # * Think: What does it do? Why did you write it? What is the focus? # * Try to keep it short, snappy and to the point. # * Write the description between the DESC delimiters below. # * Finally, don't worry about the indent, CocoaPods strips it! #s.description = DESC s.homepage = "https://github.com/wujunyang/WjyTestClasses" # s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # Licensing your code is important. See http://choosealicense.com for more info. # CocoaPods will detect a license file if there is a named LICENSE* # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. # s.license = { :type => "MIT", :file => "/Doc/GitHub/WjyTestClasses/FILE_LICENSE" } # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # Specify the authors of the library, with email addresses. Email addresses # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also # accepts just a name if you'd rather not provide an email address. # # Specify a social_media_url where others can refer to, for example a twitter # profile URL. # s.author = { "wujunyang" => "wujunyang@126.com" } # Or just: s.author = "wujunyang" # s.authors = { "wujunyang" => "wujunyang@126.com" } # s.social_media_url = "http://twitter.com/wujunyang" # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # If this Pod runs only on iOS or OS X, then specify the platform and # the deployment target. You can optionally include the target after the platform. # # s.platform = :ios s.platform = :ios, "7.0" # When using multiple platforms # s.ios.deployment_target = "5.0" # s.osx.deployment_target = "10.7" # s.watchos.deployment_target = "2.0" # s.tvos.deployment_target = "9.0" # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # Specify the location from where the source should be retrieved. # Supports git, hg, bzr, svn and HTTP. # s.source = { :git => "https://github.com/wujunyang/WjyTestClasses.git", :tag => "v0.0.2" } # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # CocoaPods is smart about how it includes source code. For source files # giving a folder will include any swift, h, m, mm, c & cpp files. # For header files it will include any header in the folder. # Not including the public_header_files will make all headers public. # s.source_files = "Pod/Classes/**/*.{h,m}" #s.exclude_files = "Classes/Exclude" # s.public_header_files = "Classes/**/*.h" # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # A list of resources included with the Pod. These are copied into the # target bundle with a build phase script. Anything else will be cleaned. # You can preserve files from being cleaned, please don't preserve # non-essential files like tests, examples and documentation. # # s.resource = "icon.png" # s.resources = "Resources/*.png" # s.preserve_paths = "FilesToSave", "MoreFilesToSave" # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # Link your library with frameworks, or libraries. Libraries do not include # the lib prefix of their name. # # s.framework = "SomeFramework" # s.frameworks = "SomeFramework", "AnotherFramework" # s.library = "iconv" # s.libraries = "iconv", "xml2" # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # If your library depends on compiler flags you can set them in the xcconfig hash # where they will only apply to your library. If you depend on other Podspecs # you can include multiple dependencies to ensure it works. # s.requires_arc = true # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } # s.dependency "JSONKit", "~> 1.4" end
注意: a. s.version應和tag的版本一致.先push該文件之后,再push --tags
b. 將源代碼放置在固定的文件夾下,同時修改s.source
c. 一定要有開源協議
d.在私有庫中引用私有庫(配置文件 首先要寫上s.dependency)
即在Podspec文件中依賴(dependency)私有庫 這種情況就比較麻煩一點,因為畢竟Podspec文件中並沒有指明私有倉庫地址的地方。那么肯定就不在Podspec文件里面指明私有倉庫的地方。而是在驗證和上傳私有庫的時候進行指明。即在下面這兩條命令中進行指明:pod lib lint 項目名.podspec --sources=https://github.com/CocoaPods/Specs.git,192.168.0.100:Plutoy/Specs.git以及pod repo push --source=https://github.com/CocoaPods/Specs.git,192.168.0.100:Plutoy/Specs.git,要不然你在檢驗項目以及提交項目過程中就會出現Error的情況。
但是這兩種情況還是有點不同的,第一種情況是可以采用開發者模式,而第二種情況不能采用開發者模式,只能通過打tag之后才能進行使用,所以在使用第二種情況下最好是測試好之后打完tag再進行引用。
要推到私有倉庫時,先打上對應的TAG,然后也要加上sources指令:
e:模塊化配置:
Pod::Spec.new do |s| s.name = "jiaCore" s.version = "0.0.7" s.summary = "這是一個簡單SDFSDFSDF的測試運JIA用類" s.homepage = "https://github.com/wujunyang/jiaCore" s.license = { :type => "MIT", :file => "/Doc/GitHub/jiaCore/FILE_LICENSE" } s.author = { "wujunyang" => "wujunyang@126.com" } s.platform = :ios, "7.0" s.source = { :git => "https://github.com/wujunyang/jiaCore.git", :tag => "0.0.7" } s.requires_arc = true s.subspec 'JiaCore' do |jiaCore| jiaCore.source_files = 'Pod/JiaCore/**/*.{h,m}' end s.subspec 'JIQNetwork' do |networkEngine| networkEngine.source_files = 'Pod/YTKNetwork/**/*' networkEngine.dependency 'AFNetworking', '~> 2.6.3' networkEngine.dependency 'AFDownloadRequestOperation' end s.subspec 'JIQJCAlertView' do |jiqAlertView| jiqAlertView.source_files = 'Pod/JCAlertView/**/*' jiqAlertView.resource ='Pod/JCAlertView/JCAlertView.bundle' end s.frameworks = 'UIKit' # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } # s.dependency "JSONKit", "~> 1.4" end
結構如下:
這樣就可以全引用,也可以模塊引用
其它實例:
platform :ios, '7.0' pod 'PodTestLibrary/NetWorkEngine', '1.0.0' #使用某一個部分 pod 'PodTestLibrary/UIKitAddition', '1.0.0' pod 'PodTestLibrary', '1.0.0' #使用整個庫
f:依賴自身模塊的寫法:
Pod::Spec.new do |s| s.name = "jiaCore" s.version = "0.0.10" s.summary = "這是一個簡單SDFSDFSDF的測試運JIA用類" s.homepage = "https://github.com/wujunyang/jiaCore" s.license = { :type => "MIT", :file => "/Doc/GitHub/jiaCore/FILE_LICENSE" } s.author = { "wujunyang" => "wujunyang@126.com" } s.platform = :ios, "7.0" s.source = { :git => "https://github.com/wujunyang/jiaCore.git", :tag => "0.0.10" } s.requires_arc = true s.subspec 'JiaCore' do |jiaCore| jiaCore.source_files = 'Pod/JiaCore/**/*.{h,m}' end s.subspec 'JiaUmeng' do |jiaumeng| jiaumeng.source_files = 'Pod/UmengCore/**/*.{h,m}' jiaumeng.dependency 'jiaCore/JiaCore' end s.frameworks = 'UIKit' # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } # s.dependency "JSONKit", "~> 1.4" end
特別注意:jiaumeng.dependency 'jiaCore/JiaCore'
提交podspec文件到Spec倉庫
1.檢查podspec文件是否正確
pod spec lint Foundation-pd.podspec --verbose --sources='git@gitlab.com:zengjing/Specs.git,https://github.com/CocoaPods/Specs' --use-libraries
2.提交podspec文件到Spec庫
pod repo push zengjing-spec Foundation-pd.podspec --verbose --sources='git@gitlab.com:zengjing/Specs.git,https://github.com/CocoaPods/Specs' --use-libraries --allow-warnings
實例:
說明:
(1)--verbose:表示顯示全部的日志信息,建議加上這個,方便判斷錯誤信息。
(2)--sources:如果我們在podspec里面依賴到一些私有的庫之后,直接進行校驗是會報錯的提示找不到,這里加上我們的Spec倉庫的地址告訴CocoaPods找不到的時候去哪里找。
(3)--allow-warnings:表示允許警告.
(4)--use-libraries:表示使用靜態庫或者是framework,這里主要是解決當我們依賴一些framework庫后校驗提示找不到庫的時候用到。
g:[iOS] xcodebuild: Returned an unsuccessful exit code錯誤解決方式:
pod repo push <repo-name> <podspec-file-name>.podspec --allow-warnings --use-libraries 加上指令:--use-libraries
8:如果依賴別人的SDK報錯解決
可以把SDK相關的內容,在公司私有再架一個,然后依賴公司的私庫;
# # Be sure to run `pod spec lint getui-sdk-ios-cocoapods.podspec' to ensure this is a # valid spec and to remove all comments including this before submitting the spec. # # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ # Pod::Spec.new do |s| # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # These will help people to find your library, and whilst it # can feel like a chore to fill in it's definitely to your advantage. The # summary should be tweet-length, and the description more in depth. # s.name = "QiJIAGTSDK" s.version = "1.4.3" s.summary = "個推iOS SDK Cocoa Pods集成庫" s.description = <<-DESC A longer description of getui-sdk-ios-cocoapods in Markdown format. 個推iOS SDK DESC s.homepage = "https://github.com/GetuiLaboratory/getui-sdk-ios-cocoapods" # s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # Licensing your code is important. See http://choosealicense.com for more info. # CocoaPods will detect a license file if there is a named LICENSE* # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. # # s.license = "MIT (example)" s.license = { :type => "MIT", :file => "LICENSE" } # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # Specify the authors of the library, with email addresses. Email addresses # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also # accepts just a name if you'd rather not provide an email address. # # Specify a social_media_url where others can refer to, for example a twitter # profile URL. # s.author = { "個推" => "support@getui.com" } # Or just: s.author = "個推實驗室" # s.authors = { "個推實驗室" => "support@getui.com" } # s.social_media_url = "http://twitter.com/個推實驗室" # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # If this Pod runs only on iOS or OS X, then specify the platform and # the deployment target. You can optionally include the target after the platform. # # s.platform = :ios s.platform = :ios, "7.0" # When using multiple platforms s.ios.deployment_target = "7.0" # s.osx.deployment_target = "10.7" # s.watchos.deployment_target = "2.0" # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # Specify the location from where the source should be retrieved. # Supports git, hg, bzr, svn and HTTP. # s.source = { :git => "https://github.com/wujunyang/jiaGTSDK.git", :tag => "1.4.3" } # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # CocoaPods is smart about how it includes source code. For source files # giving a folder will include any swift, h, m, mm, c & cpp files. # For header files it will include any header in the folder. # Not including the public_header_files will make all headers public. # s.source_files = "Pod/**/*.{h,m}" #s.exclude_files = "Classes/Exclude" # s.public_header_files = "Classes/**/*.h" # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # A list of resources included with the Pod. These are copied into the # target bundle with a build phase script. Anything else will be cleaned. # You can preserve files from being cleaned, please don't preserve # non-essential files like tests, examples and documentation. # # s.resource = "icon.png" # s.resources = "Resources/*.png" s.preserve_paths = "libGeTuiSdk-1.4.2.a" s.ios.vendored_library = "libGeTuiSdk-1.4.2.a" # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # Link your library with frameworks, or libraries. Libraries do not include # the lib prefix of their name. # #s.framework = "UIKit" # s.frameworks = "SomeFramework", "AnotherFramework" s.frameworks = 'SystemConfiguration', 'CFNetwork','CoreTelephony','CoreLocation','AVFoundation','CoreBluetooth','Security','JavaScriptCore' s.ios.frameworks = 'SystemConfiguration', 'CFNetwork','CoreTelephony','CoreLocation','AVFoundation','CoreBluetooth','Security','JavaScriptCore' # s.library = "sqlite3" s.ios.libraries = 'z','sqlite3.0' # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # # # If your library depends on compiler flags you can set them in the xcconfig hash # where they will only apply to your library. If you depend on other Podspecs # you can include multiple dependencies to ensure it works. s.requires_arc = true # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } s.dependency "jiaCore" end
把個推相關文件下載,並修改podspec讓它指向我們當前的GIT,然后工程里面引入QiJAGSDK就可以了,也會把個推的文件引入;
9:如果提交時報下面這一句:
[!] The validator for Swift projects uses Swift 3.0 by default, if you are using a different version of swift you can use a `.swift-version` file to set the version for your Pod. For example to use Swift 2.3, run:
`echo "2.3" > .swift-version`.
解決問題:
在命令終端輸入:
echo 3.0 > .swift-version
10:報如下錯誤:
ERROR | name: The name of the spec should match the name of the file.
是因為.podspec文件的名字跟腳本內還有提交的指令沒有對應上,特別要小心大小寫
11:問題file not found with <angled> include; use "quotes" instead
[JiaCordova/JiaCordovaManager] xcodebuild: /gitHub/JiaCordova/JiaCordova/JiaCordovaManager/JiaCordovaViewController.h:9:9: error: 'CDV.h' file not found with <angled> include; use "quotes" instead
這個是引入頭文件時要注意;
引入#import <CDV.h>時報錯的,因為是第三方庫所以要把其前綴也帶上;如下面
#import <Cordova/CDV.h>