1:UIWebView加载本地的HTML

  1. NSString *path = [[NSBundle mainBundle] bundlePath];
  2. NSURL *baseURL = [NSURL fileURLWithPath:path];
  3. NSString * htmlPath = [[NSBundle mainBundle] pathForResource:@"index1"
  4. ofType:@"html"];
  5. NSString * htmlCont = [NSString stringWithContentsOfFile:htmlPath
  6. encoding:NSUTF8StringEncoding
  7. error:nil];
  8. [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解密);

管理中心的一些考虑:

下面分享一个帮助类:

  1. #import "JSPatchHelper.h"
  2.  
  3. //文件名称
  4. NSString * const jsPatchJsFileName=@"main.js";
  5.  
  6. @implementation JSPatchHelper
  7.  
  8. + (instancetype)sharedInstance
  9. {
  10. static JSPatchHelper* instance = nil;
  11.  
  12. static dispatch_once_t onceToken;
  13. dispatch_once(&onceToken, ^{
  14. instance = [JSPatchHelper new];
  15. });
  16.  
  17. return instance;
  18. }
  19.  
  20. +(void)HSDevaluateScript
  21. {
  22. //从本地获取下载的JS文件
  23. NSURL *p = FilePath;
  24.  
  25. //判断文件是否存在
  26. NSString *curFilePath=[p.path stringByAppendingString:[NSString stringWithFormat:@"/%@",jsPatchJsFileName]];
  27. if (![[NSFileManager defaultManager] fileExistsAtPath:curFilePath]) {
  28. return;
  29. }
  30.  
  31. //获取内容
  32. NSString *js = [NSString stringWithContentsOfFile:curFilePath encoding:NSUTF8StringEncoding error:nil];
  33.  
  34. //如果有内容
  35. if (js.length > )
  36. {
  37. //-------
  38. //服务端要对JS内容进行加密,在此处解密js内容;增加安全性
  39. //----
  40.  
  41. //运行
  42. [JPEngine startEngine];
  43. [JPEngine evaluateScript:js];
  44. }
  45. }
  46.  
  47. +(void)loadJSPatch
  48. {
  49. //优化间隔一段时间 再去请求一次 否则太频繁(这边定义为一个小时才去请求一次)
  50. NSDate *myNowDate=[NSDate date];
  51. if (!BBUserDefault.MBJsPatchTime) {
  52. BBUserDefault.MBJsPatchTime=myNowDate;
  53. return;
  54. }
  55. if ([myNowDate timeIntervalSinceDate:BBUserDefault.MBJsPatchTime]<) {
  56. return;
  57. }
  58.  
  59. //使用AFNetWork下载在服务器的js文件
  60. NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
  61. AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
  62. NSURL *URL = [NSURL URLWithString:kJSPatchServerPath];
  63. NSURLRequest *request = [NSURLRequest requestWithURL:URL];
  64. NSURLSessionDownloadTask *downloadTask = [manager downloadTaskWithRequest:request progress:nil destination:^NSURL *(NSURL *targetPath, NSURLResponse *response)
  65. {
  66. NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)response;
  67. if (httpResponse.statusCode==) {
  68. NSURL *documentsDirectoryURL = FilePath;
  69. //保存到本地 Library/Caches目录下
  70. return [documentsDirectoryURL URLByAppendingPathComponent:jsPatchJsFileName];
  71. }
  72. else
  73. {
  74. return nil;
  75. }
  76. }
  77. completionHandler:^(NSURLResponse *response, NSURL *filePath, NSError *error)
  78. {
  79. NSLog(@"下载失败 to: %@", filePath);
  80. }];
  81. [downloadTask resume];
  82. }
  83.  
  84. @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值。

  1. {
  2. "aps" : {
  3. "alert" : { // string or dictionary
  4. "title" : "string"
  5. "body" : "string",
  6. "title-loc-key" : "string or null"
  7. "title-loc-args" : "array of strings or null"
  8. "action-loc-key" : "string or null"
  9. "loc-key" : "string"
  10. "loc-args" : "array of strings"
  11. "launch-image" : "string"
  12. },
  13. "badge" : number,
  14. "sound" : "string"
  15. "content-available" : number;
  16. "category" : "string"
  17. },
  18. }
  19.  
  20. aps:推送消息必须有的key
  21.  
  22. alert:推送消息包含此key值,系统就会根据用户的设置展示标准的推送信息
  23. badge:在app图标上显示消息数量,缺少此key值,消息数量就不会改变,消除标记时把此key对应的value设置为0
  24. sound:设置推送声音的key值,系统默认提示声音对应的value值为default
  25. content-available:此key值设置为1,系统接收到推送消息时就会调用不同的回调方法,iOS7之后配置后台模式
  26. categoryUIMutableUserNotificationCategory's identifier 可操作通知类型的key值
  27.  
  28. title:简短描述此调推送消息的目的,适用系统iOS8.2之后版本
  29. body:推送的内容
  30. title-loc-key:功能类似title,附加功能是国际化,适用系统iOS8.2之后版本
  31. title-loc-args:配合title-loc-key字段使用,适用系统iOS8.2之后版本
  32. action-loc-key:可操作通知类型key值,不详细叙述
  33. loc-key:参考title-loc-key
  34. loc-args:参考title-loc-args
  35. launch-image:点击推送消息或者移动事件滑块时,显示的图片。如果缺少此key值,会加载app默认的启动图片。

当然以上key值并不是每条推送消息都必带的key值,应当根据需求来选择所需要的key值,除了以上系统所提供的key值外,你还可以自定义自己的key值,来作为消息推送的负载,自定义key值与aps此key值并列。如下格式:

  1. {
  2. "aps" : {
  3. "alert" : "Provider push messag.",
  4. "badge" : ,
  5. "sound" : "toAlice.aiff"
  6. },
  7. "Id" : , // 自定义key值
  8. "type" : "customType" // 自定义key值
  9. }

指定用户的推送

对于要求用户登录的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官方去]

下面来几张成功创建的图片:

 
 
 

配置文件:

  1. #
  2. # Be sure to run `pod spec lint WjyTestClasses.podspec' to ensure this is a
  3. # valid spec and to remove all comments including this before submitting the spec.
  4. #
  5. # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
  6. # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
  7. #
  8.  
  9. Pod::Spec.new do |s|
  10.  
  11. # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  12. #
  13. # These will help people to find your library, and whilst it
  14. # can feel like a chore to fill in it's definitely to your advantage. The
  15. # summary should be tweet-length, and the description more in depth.
  16. #
  17.  
  18. s.name = "WjyTestClasses"
  19. s.version = "0.0.2"
  20. s.summary = "这是一个简单的测试运用类"
  21.  
  22. # This description is used to generate tags and improve search results.
  23. # * Think: What does it do? Why did you write it? What is the focus?
  24. # * Try to keep it short, snappy and to the point.
  25. # * Write the description between the DESC delimiters below.
  26. # * Finally, don't worry about the indent, CocoaPods strips it!
  27. #s.description = DESC
  28.  
  29. s.homepage = "https://github.com/wujunyang/WjyTestClasses"
  30. # s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"
  31.  
  32. # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  33. #
  34. # Licensing your code is important. See http://choosealicense.com for more info.
  35. # CocoaPods will detect a license file if there is a named LICENSE*
  36. # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
  37. #
  38.  
  39. s.license = { :type => "MIT", :file => "/Doc/GitHub/WjyTestClasses/FILE_LICENSE" }
  40.  
  41. # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  42. #
  43. # Specify the authors of the library, with email addresses. Email addresses
  44. # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also
  45. # accepts just a name if you'd rather not provide an email address.
  46. #
  47. # Specify a social_media_url where others can refer to, for example a twitter
  48. # profile URL.
  49. #
  50.  
  51. s.author = { "wujunyang" => "wujunyang@126.com" }
  52. # Or just: s.author = "wujunyang"
  53. # s.authors = { "wujunyang" => "wujunyang@126.com" }
  54. # s.social_media_url = "http://twitter.com/wujunyang"
  55.  
  56. # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  57. #
  58. # If this Pod runs only on iOS or OS X, then specify the platform and
  59. # the deployment target. You can optionally include the target after the platform.
  60. #
  61.  
  62. # s.platform = :ios
  63. s.platform = :ios, "7.0"
  64.  
  65. # When using multiple platforms
  66. # s.ios.deployment_target = "5.0"
  67. # s.osx.deployment_target = "10.7"
  68. # s.watchos.deployment_target = "2.0"
  69. # s.tvos.deployment_target = "9.0"
  70.  
  71. # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  72. #
  73. # Specify the location from where the source should be retrieved.
  74. # Supports git, hg, bzr, svn and HTTP.
  75. #
  76.  
  77. s.source = { :git => "https://github.com/wujunyang/WjyTestClasses.git", :tag => "v0.0.2" }
  78.  
  79. # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  80. #
  81. # CocoaPods is smart about how it includes source code. For source files
  82. # giving a folder will include any swift, h, m, mm, c & cpp files.
  83. # For header files it will include any header in the folder.
  84. # Not including the public_header_files will make all headers public.
  85. #
  86.  
  87. s.source_files = "Pod/Classes/**/*.{h,m}"
  88. #s.exclude_files = "Classes/Exclude"
  89.  
  90. # s.public_header_files = "Classes/**/*.h"
  91.  
  92. # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  93. #
  94. # A list of resources included with the Pod. These are copied into the
  95. # target bundle with a build phase script. Anything else will be cleaned.
  96. # You can preserve files from being cleaned, please don't preserve
  97. # non-essential files like tests, examples and documentation.
  98. #
  99.  
  100. # s.resource = "icon.png"
  101. # s.resources = "Resources/*.png"
  102.  
  103. # s.preserve_paths = "FilesToSave", "MoreFilesToSave"
  104.  
  105. # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  106. #
  107. # Link your library with frameworks, or libraries. Libraries do not include
  108. # the lib prefix of their name.
  109. #
  110.  
  111. # s.framework = "SomeFramework"
  112. # s.frameworks = "SomeFramework", "AnotherFramework"
  113.  
  114. # s.library = "iconv"
  115. # s.libraries = "iconv", "xml2"
  116.  
  117. # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  118. #
  119. # If your library depends on compiler flags you can set them in the xcconfig hash
  120. # where they will only apply to your library. If you depend on other Podspecs
  121. # you can include multiple dependencies to ensure it works.
  122.  
  123. # s.requires_arc = true
  124.  
  125. # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
  126. # s.dependency "JSONKit", "~> 1.4"
  127.  
  128. 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:模块化配置:

  1. Pod::Spec.new do |s|
  2.  
  3. s.name = "jiaCore"
  4. s.version = "0.0.7"
  5. s.summary = "这是一个简单SDFSDFSDF的测试运JIA用类"
  6.  
  7. s.homepage = "https://github.com/wujunyang/jiaCore"
  8. s.license = { :type => "MIT", :file => "/Doc/GitHub/jiaCore/FILE_LICENSE" }
  9. s.author = { "wujunyang" => "wujunyang@126.com" }
  10.  
  11. s.platform = :ios, "7.0"
  12.  
  13. s.source = { :git => "https://github.com/wujunyang/jiaCore.git", :tag => "0.0.7" }
  14.  
  15. s.requires_arc = true
  16.  
  17. s.subspec 'JiaCore' do |jiaCore|
  18. jiaCore.source_files = 'Pod/JiaCore/**/*.{h,m}'
  19. end
  20.  
  21. s.subspec 'JIQNetwork' do |networkEngine|
  22. networkEngine.source_files = 'Pod/YTKNetwork/**/*'
  23. networkEngine.dependency 'AFNetworking', '~> 2.6.3'
  24. networkEngine.dependency 'AFDownloadRequestOperation'
  25. end
  26.  
  27. s.subspec 'JIQJCAlertView' do |jiqAlertView|
  28. jiqAlertView.source_files = 'Pod/JCAlertView/**/*'
  29. jiqAlertView.resource ='Pod/JCAlertView/JCAlertView.bundle'
  30. end
  31.  
  32. s.frameworks = 'UIKit'
  33.  
  34. # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
  35. # s.dependency "JSONKit", "~> 1.4"
  36. end

结构如下:

这样就可以全引用,也可以模块引用

其它实例:

  1. platform :ios, '7.0'
  2.  
  3. pod 'PodTestLibrary/NetWorkEngine', '1.0.0' #使用某一个部分
  4. pod 'PodTestLibrary/UIKitAddition', '1.0.0'
  5.  
  6. pod 'PodTestLibrary', '1.0.0' #使用整个库

f:依赖自身模块的写法:

  1. Pod::Spec.new do |s|
  2.  
  3. s.name = "jiaCore"
  4. s.version = "0.0.10"
  5. s.summary = "这是一个简单SDFSDFSDF的测试运JIA用类"
  6.  
  7. s.homepage = "https://github.com/wujunyang/jiaCore"
  8. s.license = { :type => "MIT", :file => "/Doc/GitHub/jiaCore/FILE_LICENSE" }
  9. s.author = { "wujunyang" => "wujunyang@126.com" }
  10.  
  11. s.platform = :ios, "7.0"
  12.  
  13. s.source = { :git => "https://github.com/wujunyang/jiaCore.git", :tag => "0.0.10" }
  14.  
  15. s.requires_arc = true
  16.  
  17. s.subspec 'JiaCore' do |jiaCore|
  18. jiaCore.source_files = 'Pod/JiaCore/**/*.{h,m}'
  19. end
  20.  
  21. s.subspec 'JiaUmeng' do |jiaumeng|
  22. jiaumeng.source_files = 'Pod/UmengCore/**/*.{h,m}'
  23. jiaumeng.dependency 'jiaCore/JiaCore'
  24. end
  25.  
  26. s.frameworks = 'UIKit'
  27.  
  28. # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
  29. # s.dependency "JSONKit", "~> 1.4"
  30. 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相关的内容,在公司私有再架一个,然后依赖公司的私库;

  1. #
  2. # Be sure to run `pod spec lint getui-sdk-ios-cocoapods.podspec' to ensure this is a
  3. # valid spec and to remove all comments including this before submitting the spec.
  4. #
  5. # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
  6. # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
  7. #
  8.  
  9. Pod::Spec.new do |s|
  10.  
  11. # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  12. #
  13. # These will help people to find your library, and whilst it
  14. # can feel like a chore to fill in it's definitely to your advantage. The
  15. # summary should be tweet-length, and the description more in depth.
  16. #
  17.  
  18. s.name = "QiJIAGTSDK"
  19. s.version = "1.4.3"
  20. s.summary = "个推iOS SDK Cocoa Pods集成库"
  21.  
  22. s.description = <<-DESC
  23. A longer description of getui-sdk-ios-cocoapods in Markdown format.
  24.  
  25. 个推iOS SDK
  26. DESC
  27.  
  28. s.homepage = "https://github.com/GetuiLaboratory/getui-sdk-ios-cocoapods"
  29. # s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"
  30.  
  31. # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  32. #
  33. # Licensing your code is important. See http://choosealicense.com for more info.
  34. # CocoaPods will detect a license file if there is a named LICENSE*
  35. # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
  36. #
  37.  
  38. # s.license = "MIT (example)"
  39. s.license = { :type => "MIT", :file => "LICENSE" }
  40.  
  41. # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  42. #
  43. # Specify the authors of the library, with email addresses. Email addresses
  44. # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also
  45. # accepts just a name if you'd rather not provide an email address.
  46. #
  47. # Specify a social_media_url where others can refer to, for example a twitter
  48. # profile URL.
  49. #
  50.  
  51. s.author = { "个推" => "support@getui.com" }
  52. # Or just: s.author = "个推实验室"
  53. # s.authors = { "个推实验室" => "support@getui.com" }
  54. # s.social_media_url = "http://twitter.com/个推实验室"
  55.  
  56. # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  57. #
  58. # If this Pod runs only on iOS or OS X, then specify the platform and
  59. # the deployment target. You can optionally include the target after the platform.
  60. #
  61.  
  62. # s.platform = :ios
  63. s.platform = :ios, "7.0"
  64.  
  65. # When using multiple platforms
  66. s.ios.deployment_target = "7.0"
  67. # s.osx.deployment_target = "10.7"
  68. # s.watchos.deployment_target = "2.0"
  69.  
  70. # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  71. #
  72. # Specify the location from where the source should be retrieved.
  73. # Supports git, hg, bzr, svn and HTTP.
  74. #
  75.  
  76. s.source = { :git => "https://github.com/wujunyang/jiaGTSDK.git", :tag => "1.4.3" }
  77.  
  78. # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  79. #
  80. # CocoaPods is smart about how it includes source code. For source files
  81. # giving a folder will include any swift, h, m, mm, c & cpp files.
  82. # For header files it will include any header in the folder.
  83. # Not including the public_header_files will make all headers public.
  84. #
  85.  
  86. s.source_files = "Pod/**/*.{h,m}"
  87. #s.exclude_files = "Classes/Exclude"
  88.  
  89. # s.public_header_files = "Classes/**/*.h"
  90.  
  91. # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  92. #
  93. # A list of resources included with the Pod. These are copied into the
  94. # target bundle with a build phase script. Anything else will be cleaned.
  95. # You can preserve files from being cleaned, please don't preserve
  96. # non-essential files like tests, examples and documentation.
  97. #
  98.  
  99. # s.resource = "icon.png"
  100. # s.resources = "Resources/*.png"
  101.  
  102. s.preserve_paths = "libGeTuiSdk-1.4.2.a"
  103. s.ios.vendored_library = "libGeTuiSdk-1.4.2.a"
  104.  
  105. # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  106. #
  107. # Link your library with frameworks, or libraries. Libraries do not include
  108. # the lib prefix of their name.
  109. #
  110.  
  111. #s.framework = "UIKit"
  112. # s.frameworks = "SomeFramework", "AnotherFramework"
  113. s.frameworks = 'SystemConfiguration', 'CFNetwork','CoreTelephony','CoreLocation','AVFoundation','CoreBluetooth','Security','JavaScriptCore'
  114. s.ios.frameworks = 'SystemConfiguration', 'CFNetwork','CoreTelephony','CoreLocation','AVFoundation','CoreBluetooth','Security','JavaScriptCore'
  115. # s.library = "sqlite3"
  116. s.ios.libraries = 'z','sqlite3.0'
  117.  
  118. # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  119. #
  120. # If your library depends on compiler flags you can set them in the xcconfig hash
  121. # where they will only apply to your library. If you depend on other Podspecs
  122. # you can include multiple dependencies to ensure it works.
  123.  
  124. s.requires_arc = true
  125.  
  126. # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
  127. s.dependency "jiaCore"
  128. 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>

IOS开发基础知识--碎片41的更多相关文章

  1. IOS开发基础知识碎片-导航

    1:IOS开发基础知识--碎片1 a:NSString与NSInteger的互换 b:Objective-c中集合里面不能存放基础类型,比如int string float等,只能把它们转化成对象才可 ...

  2. IOS开发基础知识--碎片33

    1:AFNetworking状态栏网络请求效果 直接在AppDelegate里面didFinishLaunchingWithOptions进行设置 [[AFNetworkActivityIndicat ...

  3. IOS开发基础知识--碎片42

    1:报thread 1:exc_bad_access(code=1,address=0x70********) 闪退 这种错误通常是内存管理的问题,一般是访问了已经释放的对象导致的,可以开启僵尸对象( ...

  4. IOS开发基础知识--碎片50

      1:Masonry 2个或2个以上的控件等间隔排序 /** * 多个控件固定间隔的等间隔排列,变化的是控件的长度或者宽度值 * * @param axisType 轴线方向 * @param fi ...

  5. IOS开发基础知识--碎片3

    十二:判断设备 //设备名称 return [UIDevice currentDevice].name; //设备型号,只可得到是何设备,无法得到是第几代设备 return [UIDevice cur ...

  6. IOS开发基础知识--碎片11

    1:AFNetwork判断网络状态 #import “AFNetworkActivityIndicatorManager.h" - (BOOL)application:(UIApplicat ...

  7. IOS开发基础知识--碎片14

    1:ZIP文件压缩跟解压,使用ZipArchive 创建/添加一个zip包 ZipArchive* zipFile = [[ZipArchive alloc] init]; //次数得zipfilen ...

  8. IOS开发基础知识--碎片16

    1:Objective-C语法之动态类型(isKindOfClass, isMemberOfClass,id) 对象在运行时获取其类型的能力称为内省.内省可以有多种方法实现. 判断对象类型 -(BOO ...

  9. IOS开发基础知识--碎片19

    1:键盘事件顺序 UIKeyboardWillShowNotification // 键盘显示之前 UIKeyboardDidShowNotification // 键盘显示完成后 UIKeyboar ...

随机推荐

  1. Netbeans配置Xdebug

    1.进入 http://xdebug.org/wizard.php 页面,新建一个php页面,里面输入 echo phpinfo(); 然后在运行的页面,复制页面内容到里面, 这个网站会分析出,当前运 ...

  2. JavaScript中的日期处理注意事项

    在业务逻辑比较多的系统里面,一般都会涉及到日期的处理.包括选择起始日期和结束日期,结束日期要大于起始日期,日期的显示和输入等. 输入这一块基本都是使用jQuery datetimepicker,后来系 ...

  3. 安装Ubuntu时分区选择

    最近购买来一台二手笔记本.型号是:Dell Latitude D520.回来之后就装上来Ubuntu12.04,开始是安装的UbuntuKylin 13.04.不知道是机器配置不行,还是本身系统有点卡 ...

  4. MVC中处理表单提交的方式(使用html扩展方法+juqery插件)

    这里使用扩展方法来扩展基于jquery.form 插件,实现基于异步的ajax的提交方式.

  5. GCD 扫盲篇

    GCD有四个概念:串行队列.并行队列.同步.异步四者. 如下简介: 这里不仅给出了不确定性,而且也给出了确定性.对于初学者而言,有时候因为那些不确定的东西所造成的疑问会像没有闸却在疾驰的汽车一样让人惊 ...

  6. Hammer.js分析(二)——manager.js

    “Manager”是所有识别器实例的容器,它为你设置的元素安装了交互事件监听器,并设置了触摸事件特性. manager.js中的代码会涉及到input.js和recoginzer.js中的内容,这里会 ...

  7. 深入instanceof

    本文转自这里 规范中 instanceof 运算符定义 11.8.6 The instanceof operator The production RelationalExpression: Rela ...

  8. ZOJ Problem Set - 1350 The Drunk Jailer ac代码 memset

    这是一道很简单的题目,题目大概意思说下:就是有n个监狱(编号从1到n),第一次全部打开,第二次打开编号为2的倍数的,第三次打开编号为3的倍数的,以此类推...最后问你有几个监狱是打开的 题目中我使用了 ...

  9. 利用SimpleExpandableListAdapter为ExpandableListActivity提供数据

    首先MainActivity继承自ExpandableListActivity,其中的声明如下: setContentView(R.layout.expandmain); //定义一个:List,该L ...

  10. PHP配置限制文件大小上传

    修改PHP上传文件大小限制的方法1. 一般的文件上传,除非文件很小.就像一个5M的文件,很可能要超过一分钟才能上传完.但在php中,默认的该页最久执行时间为 30 秒.就是说超过30秒,该脚本就停止执 ...