From 33a878221d0a52f12b9051d0b40c85c02bb7dfa2 Mon Sep 17 00:00:00 2001 From: ChenYilong Date: Mon, 16 Sep 2019 21:58:06 +0800 Subject: [PATCH] update image resources --- README.md | 119 ++++++++++-------- ...46\226\260APNs\345\215\217\350\256\256.md" | 39 +++--- 2 files changed, 94 insertions(+), 64 deletions(-) diff --git a/README.md b/README.md index 4ea281c..52af396 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # iOS9AdaptationTips( [iOS开发学习交流群]( https://github.com/ChenYilong/iOSBlog/issues/21 ) ) --------------------------------------------- +
Architectures -![enter image description here](http://i58.tinypic.com/amsa9u.jpg) +

Q:服务器已支持TLS 1.2 SSL ,但iOS9上还是不行,还要进行本文提出的适配操作。 @@ -857,13 +869,13 @@ A:遇到这类问题,90%是出现在“一个 Project 多 Target ”的情 Project -> Your Target -> Build Settings -> Info.plist File -![enter image description here](http://i60.tinypic.com/sbrfrl.jpg) +

或者更直截了当一点,直接修改: Project -> Your Target —>info-> Custom iOS target properties-> 添加禁用 ATS 的属性 -![enter image description here](http://i60.tinypic.com/zvbt7b.jpg) +

还有一种可能性是:禁用 ATS 的代码粘贴进 plist 时,位置不对,可以尝试放在第5行. @@ -932,9 +944,8 @@ A: 第一种: 要将 Info.plist 配置如下: - ![enter image description here][8] - [8]:https://i.imgur.com/MAoKbUe.png +

对应的 Info.plist 的XML源码是: @@ -950,7 +961,7 @@ A: 在对应 target 的 Capabilities -> Background Modes -> 开启 Location Updates -![enter image description here](http://cdn2.raywenderlich.com/wp-content/uploads/2014/12/background_modes.png) +

@@ -973,9 +984,8 @@ iOS9之前,企业级分发十分方便:点击App出现“信任按钮”, iOS9以后,企业级分发ipa包将遭到与Mac上dmg安装包一样的待遇:默认不能安装,也不再出现“信任按钮” - ![enter image description here][11] +

- [11]: http://i58.tinypic.com/2zecm83.jpg 必须让用户进行gif图中的设置: @@ -990,7 +1000,10 @@ iOS9升级后众多企业分发的 app 已经出现了不能安装的情况, 错误提示如下: -![enter image description here](http://i57.tinypic.com/28jckus.jpg) + +

+ + 网页中的 plist 文件中的 bundle ID 的作用可参考 [《iOS:苹果企业证书通过网页分发安装app》](http://blog.sina.com.cn/s/blog_6afb7d800101fa16.html) 。 @@ -1123,9 +1136,12 @@ iOS9升级后众多企业分发的 app 已经出现了不能安装的情况, **无法验证"**** Co.,Ltd"应用,需要网络连接以在这台iPhone上验证"**** Co.,Ltd"应用。接入互联网并重试。** -![](http://i63.tinypic.com/10ho85w.jpg) -![](http://i66.tinypic.com/30ucruo.jpg) -![](http://i66.tinypic.com/w14qi1.jpg) + +图1 | 图2 | 图3 +:-------------:|:-------------:|:-------------: +![https://github.com/ChenYilong](http://ww3.sinaimg.cn/large/006y8mN6gy1g71nxwgo8nj30ku112tbe.jpg)| ![https://github.com/ChenYilong](http://ww1.sinaimg.cn/large/006y8mN6gy1g71nyd9d2ej30ku112tbh.jpg) |![https://github.com/ChenYilong](http://ww4.sinaimg.cn/large/006y8mN6gy1g71nyouxb0j30ku112ju1.jpg) + + 而此时,Wi-Fi网络是接入互联网的。如果多次验证不通过的话,我们需要切换到非Wi-Fi网络环境下才能解决这个问题。 @@ -1253,7 +1269,7 @@ Xcode 7 + 会开启 Bitcode。 > ld: -undefined and -bitcode_bundle (Xcode setting `ENABLE_BITCODE` =YES) cannot be used together clang: error: linker command failed with exit code 1 (use -v to see invocation) -![enter image description here](http://i62.tinypic.com/330vhug.jpg) +

无论是警告还是错误,得到的信息是:我们引入的一个第三方库不包含bitcode。 @@ -1273,7 +1289,7 @@ clang: error: linker command failed with exit code 1 (use -v to see invocation) 如果我们开启了 bitcode ,在提交包时,下面这个界面也会有个 bitcode 选项: -![enter image description here](http://i60.tinypic.com/5b2q7m.jpg) +

这里有一个坑,目前 Xcode 处理 Embedded Binaries 时还有些问题,解决办法是,上图中左下角的两个选项不要同时勾选: @@ -1281,14 +1297,12 @@ clang: error: linker command failed with exit code 1 (use -v to see invocation) 用 AD_HOC 打测试包时,也有相应的 bitcode 选项: -![enter image description here](http://i64.tinypic.com/8vospi.jpg) +

那么 SDK 厂商如何支持 bitcode 呢?需要在 Xcode7上重新编译,确保默认开启的 bitcode 没有去主动关闭。 但是如果仅仅是编译一下,则会出现下类似的如下警告: -![enter image description here](http://image17-c.poco.cn/mypoco/myphoto/20150928/17/1733887242015092817143106.jpg?1462x120_120 -) @@ -1306,11 +1320,12 @@ clang: error: linker command failed with exit code 1 (use -v to see invocation) 同时切记,为 release 状态设置 `BITCODE_GENERATION_MODE=bitcode` ,开启 `full bitcode` 模式,否则会报错误:`Failed to verify bitcode in XXX.framework` : +

+ -![enter image description here](http://i64.tinypic.com/2cxukix.jpg) +

-![enter image description here](https://cdn-images-1.medium.com/max/800/1*cd9mvJ7BJCW51zXSglwhBQ.png) 详见: @@ -1369,7 +1384,9 @@ clang: error: linker command failed with exit code 1 (use -v to see invocation) iOS9中 `openURL:` 方法没有什么实质性的变化,仅仅多了一个确认动作: -![enter image description here](http://i57.tinypic.com/8zjh35.jpg) + +

+ 苹果为什么要这么做? @@ -1381,7 +1398,8 @@ iOS9中 `openURL:` 方法没有什么实质性的变化,仅仅多了一个确 Demo结构如下: -![enter image description here](http://i61.tinypic.com/2hyyuqv.jpg) +

+ 主要演示的情景是这样的: @@ -1480,7 +1498,8 @@ Demo结构如下: ``` plist 文件看起来会是这样的: -![enter image description here](http://i58.tinypic.com/e5pyee.jpg) +

+ 其他平台可在下面的列表中查询: 各平台OpenURL白名单说明 @@ -1566,7 +1585,7 @@ A:本文中所罗列的新特性,多数情况下指的是 iOS9.X-SDK 新特 那么,如何确认自己项目所使用的 SDK?在Targets->Build Setting-->Architectures -![enter image description here](http://i58.tinypic.com/amsa9u.jpg) +

Q:我们自己的应用跳到微信、支付宝、微博等的URLScheme是固定几个,但是从微信、支付宝、微博跳回到我们的应用的URLScheme可能是成千上万个,那他们那些大厂是如何做这个白名单? @@ -1621,9 +1640,9 @@ iOS9 | ![enter image description here](http://images2015.cnblogs.com/blog/717809 情况 | 显示 |解释 -------------|------------- |------------- -XIB | ![enter image description here](http://i60.tinypic.com/292r428.jpg) |如果仅仅添加左端约束 -iOS8 | ![enter image description here](http://i58.tinypic.com/2vj92bn.jpg) | 正常 -iOS9 | ![enter image description here](http://i62.tinypic.com/2czaq1v.jpg) | “3199”这四个数字越界了 +XIB | ![enter image description here](http://ww1.sinaimg.cn/large/006y8mN6gy1g71oqj85gij30as06caae.jpg) |如果仅仅添加左端约束 +iOS8 | ![enter image description here](http://ww3.sinaimg.cn/large/006y8mN6gy1g71oqw01s7j309i035t8t.jpg) | 正常 +iOS9 | ![enter image description here](http://ww4.sinaimg.cn/large/006y8mN6gy1g71orgxpzaj308s035jrh.jpg) | “3199”这四个数字越界了 所以为了在界面显示上不出错,就算是固定长度的文字也还是建议使用sizetofit 或者ios向上取整 ceilf() 或者提前计算: @@ -1747,7 +1766,7 @@ bottomlayoutguide 替换成 mas_bottomlayoutguide ``` 看起来长这样: -![enter image description here](http://i61.tinypic.com/jrsjnd.jpg) +

然后使用新的方式来实现状态栏的样式: @@ -1883,7 +1902,7 @@ bottomlayoutguide 替换成 mas_bottomlayoutguide Xcode6 的工程升级到 Xcode7上来,会报警告: -![enter image description here](http://i57.tinypic.com/2a5zuia.jpg) +

这是 debug 编译时导出符号文件出现的告警, @@ -1891,7 +1910,7 @@ Xcode6 的工程升级到 Xcode7上来,会报警告: 解决方法是让 debug 编译的时候不生成符号文件: -![enter image description here](http://i60.tinypic.com/2e23qyp.jpg) +

### Xcode7 无法使用 8.x 系统的设备调试,一运行就报错 `there is an intenal API error` @@ -1913,7 +1932,7 @@ bulid settings -> packaging -> product name 举例说明: -![enter image description here](http://i61.tinypic.com/2wbvok8.jpg) +

我之前写的一个 Demo: [模仿 《简书 App》 的效果:在html中跳转到App中的对应页面,并能从App跳转到原来的网址](https://github.com/ChenYilong/CYLExternalURL),在例子中直接调用自定义链接在 iOS9上是可以跳转到 App 中的,然而,如果用 iframe 元素包起来就会变不可用。 @@ -2035,8 +2054,8 @@ window.rootViewController = [[UIViewController alloc] init]; 然后像设置tableView 的 cell 一样设置下每一个“搜索元素”,搜索元素的组成如下: +

-![enter image description here](http://i57.tinypic.com/144b22w.jpg) 详情见 Demo6 代码。 @@ -2155,3 +2174,5 @@ iOS9 里面用到 tableView 突然跑出来了很多 cell 的分割线, 但是 Posted by Posted by [微博@iOS程序犭袁](http://weibo.com/luohanchenyilong/) & [公众号@iTeaTime技术清谈]( https://github.com/ChenYilong/iOSBlog/issues/21 ) 原创文章,版权声明:自由转载-非商用-非衍生-保持署名 | [Creative Commons BY-NC-ND 3.0](http://creativecommons.org/licenses/by-nc-nd/3.0/deed.zh)

+ + diff --git "a/\345\237\272\344\272\216HTTP2\347\232\204\345\205\250\346\226\260APNs\345\215\217\350\256\256/\345\237\272\344\272\216HTTP2\347\232\204\345\205\250\346\226\260APNs\345\215\217\350\256\256.md" "b/\345\237\272\344\272\216HTTP2\347\232\204\345\205\250\346\226\260APNs\345\215\217\350\256\256/\345\237\272\344\272\216HTTP2\347\232\204\345\205\250\346\226\260APNs\345\215\217\350\256\256.md" index db52420..a3de867 100644 --- "a/\345\237\272\344\272\216HTTP2\347\232\204\345\205\250\346\226\260APNs\345\215\217\350\256\256/\345\237\272\344\272\216HTTP2\347\232\204\345\205\250\346\226\260APNs\345\215\217\350\256\256.md" +++ "b/\345\237\272\344\272\216HTTP2\347\232\204\345\205\250\346\226\260APNs\345\215\217\350\256\256/\345\237\272\344\272\216HTTP2\347\232\204\345\205\250\346\226\260APNs\345\215\217\350\256\256.md" @@ -33,8 +33,8 @@ 时间 | 新闻 | 参考文档 -------------|-------------|------------- -2014年6月 | 2014年6月份WWDC搭载iOS8及以上系统的iOS设备,能够接收的最大playload大小提升到2KB。低于iOS8的设备以及OS X设备维持256字节。 | [**What's New in Notifications - WWDC 2014 - Session 713 - iOS**]( https://developer.apple.com/videos/play/wwdc2014/713/) ![enter image description here](http://i.stack.imgur.com/UW3ex.png) -2015年6月 | 2015年6月份WWDC宣布将在不久的将来发布 “基于 HTTP/2 的全新 APNs 协议”,并在大会上发布了仅仅支持测试证书的版本。| [**What's New in Notifications - WWDC 2015 - Session 720 - iOS, OS X**]( https://developer.apple.com/videos/play/wwdc2015/720/ ) ![enter image description here](http://i63.tinypic.com/2cy2ka0.jpg) +2014年6月 | 2014年6月份WWDC搭载iOS8及以上系统的iOS设备,能够接收的最大playload大小提升到2KB。低于iOS8的设备以及OS X设备维持256字节。 | [**What's New in Notifications - WWDC 2014 - Session 713 - iOS**]( https://developer.apple.com/videos/play/wwdc2014/713/)


![](http://ww3.sinaimg.cn/large/006y8mN6gy1g71p2h3ol8j308c058aa3.jpg) +2015年6月 | 2015年6月份WWDC宣布将在不久的将来发布 “基于 HTTP/2 的全新 APNs 协议”,并在大会上发布了仅仅支持测试证书的版本。| [**What's New in Notifications - WWDC 2015 - Session 720 - iOS, OS X**]( https://developer.apple.com/videos/play/wwdc2015/720/ )
![](http://ww1.sinaimg.cn/large/006y8mN6gy1g71ozo5aqsj30me0dudg2.jpg) 2015年12月17日 | 2015年12月17日起,发布 “基于 HTTP/2 的全新 APNs 协议”,iOS 系统以及 OS X 系统,统一将最大 payload 大小提升到4KB。 | [**Apple Push Notification Service Update 12-17 2015**]( https://developer.apple.com/news/?id=12172015b ) @@ -42,7 +42,7 @@ 基于 HTTP/2 的新 APNs 协议 | 基于二进制的旧 APNs 协议 -------------|------------- - ![enter image description here](http://i64.tinypic.com/szajom.jpg)| ![enter image description here](http://i68.tinypic.com/5wcxnr.jpg) + ![enter image description here](http://ww4.sinaimg.cn/large/006y8mN6gy1g71ox4rn16j30g90o60sw.jpg)| ![enter image description here](http://ww2.sinaimg.cn/large/006y8mN6gy1g71oyumg53j30gd0pm3yo.jpg) 接下来我们分别对新旧协议进行一下介绍: @@ -58,7 +58,7 @@ 示意图: -![enter image description here](http://i68.tinypic.com/5wcxnr.jpg) +![enter image description here](http://ww2.sinaimg.cn/large/006y8mN6gy1g71oyumg53j30gd0pm3yo.jpg) 图中的 PN2 去哪里了?它被放到了 feedback 列表里,等待下次你调用 feedback 服务,然后重发。 @@ -97,7 +97,10 @@ 示意图: - ![enter image description here](http://i64.tinypic.com/szajom.jpg) + +

+ + 其中最大的变化就是基于了 HTTP/2 协议,采用了长连接设计,并提供 “HTTP/2 PING ” 心跳包功能检测、维持当前 APNs 连接,解决了老 APNs 无法维持连接的问题。 而且新增的状态码特性,也解决了这个问题:无法获知消息是否成功地从你们的推送系统投递到了 APNs 上。理论上,你们可以保证消息是100%投递到了APNs的,因为你可以准确的知道哪条消息到达了APNs,哪些没到。重发特定失败消息成为可能。 @@ -163,37 +166,37 @@ APNs的确改进来不少,但仍有需要改进对地方。还是有坑: 现在你知道什么是 Universal Push Notification Client SSL 证书了,那么如何创建它? - ![what is Universal Push Notification Client SSL Certificate](https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/Art/12_ios_apns_certificate_2_2x.png) + ![what is Universal Push Notification Client SSL Certificate](http://ww1.sinaimg.cn/large/006y8mN6gy1g71p3spx46j30wj0u0qb4.jpg) 图中其他方式,就叫做非 Universal 方式(下文简称:非 Universal 推送证书): - ![what is not Universal Push Notification Client SSL Certificate](http://i68.tinypic.com/dpg6jd.jpg) + ![what is not Universal Push Notification Client SSL Certificate](http://ww4.sinaimg.cn/large/006y8mN6gy1g71pb7qek8j30u00u7dlr.jpg) 这里也推荐使用 Universal 推送证书来进行推送服务。详细的创建步骤如下所示: 1. 前往[苹果开发者中心](https://developer.apple.com/account/)进行登录,并点击 “Certificates, Identifiers & Profiles”。 - ![enter Certificates, Identifiers & Profiles](http://i65.tinypic.com/xkyr0y.jpg) + ![enter Certificates, Identifiers & Profiles](http://ww1.sinaimg.cn/large/006y8mN6gy1g71p4wep1dj30y40nygm7.jpg) 2. 选择在 Certificates 栏下的“All”。 3. 点击下图中红色边框内的加号按钮。 - ![Create SSL certificate](http://i64.tinypic.com/2z4y2q0.jpg) + ![Create SSL certificate](http://ww4.sinaimg.cn/large/006y8mN6gy1g71p5mcyu6j30wa0dzaag.jpg) 4. 选择 “Production” 栏下的 “Apple Push Notification service SSL (Sandbox & Production)” 勾选后,点击下一步。 - ![Select push certificate](https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/Art/12_ios_apns_certificate_2_2x.png) + ![Select push certificate](http://ww1.sinaimg.cn/large/006y8mN6gy1g71p3spx46j30wj0u0qb4.jpg) 5. 从 App ID 下拉菜单中选择你需要的 App ID ,点击下一步。 - ![select App ID](http://i64.tinypic.com/sql3pg.jpg) + ![select App ID](http://ww2.sinaimg.cn/large/006y8mN6gy1g71p7f6ispj30wa0optc1.jpg) 6. 这时会出现 **About Creating a Certificate Signing Request (CSR)**。 - ![guide to create a CSR](https://leancloud.cn/docs/images/ios_cert/cer2.png) + ![guide to create a CSR](http://ww4.sinaimg.cn/large/006y8mN6gy1g71p84r7nij30kj0g1taf.jpg) 根据它的说明创建 Certificate Signing Request。 - ![how to create a CSR](http://i67.tinypic.com/213hzc6.jpg) + ![how to create a CSR](http://ww3.sinaimg.cn/large/006y8mN6gy1g71p8id864j30df07t40q.jpg) 7. 点击下图中的 “Choose File” 按钮: - ![upload CSR File](https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/Art/12_ios_apns_certificate_3_2x.png) + ![upload CSR File](http://ww4.sinaimg.cn/large/006y8mN6gy1g71p8wk03wj30we0u0te0.jpg) 8. 上传刚刚生成的 .certSigningRequest 文件 生成 APNs Push Certificate。 9. 下载证书。 10. 双击打开证书,证书打开时会启动钥匙串访问工具。 在钥匙串访问工具中,你的证书会显示在 “证书” 中,注意选择左下角的 “证书” 和左上角 “登录”。 - ![confirm create cer success](http://i64.tinypic.com/dc9289.jpg) + ![confirm create cer success](http://ww3.sinaimg.cn/large/006y8mN6gy1g71p9fv8qlj30tw0dvdib.jpg) ## 结束语 @@ -205,3 +208,9 @@ APNs的确改进来不少,但仍有需要改进对地方。还是有坑: 2. [**APNs Provider API**](https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/APNsProviderAPI.html) 3. [**HTTP/2 Protocol for iOS Push Notification Server(APNS)**]( https://dblog.laulkar.com/http2-protocol-for-apns.html ) + +
+Posted by Posted by [微博@iOS程序犭袁](http://weibo.com/luohanchenyilong/) & [公众号@iTeaTime技术清谈](https://mp.weixin.qq.com/s/A4e5h3xgIEh6PInf1Rjqsw) +原创文章,版权声明:自由转载-非商用-非衍生-保持署名 | [Creative Commons BY-NC-ND 3.0](http://creativecommons.org/licenses/by-nc-nd/3.0/deed.zh) +

+