ios实用开发技巧iOS-进阶学习

AFNetWorking中去除UIWebView

2020-05-07  本文已影响0人  HF_K

2020年4月开始,苹果将停止接受使用UIWebView API的应用,打包的时候会提示如下内容:

ITMS-90809: Deprecated API Usage** - Apple will stop accepting submissions of new apps that use UIWebView APIs starting from April 2020\. See [https://deve<wbr>loper.apple.<wbr>com/document<wbr>ation/uikit/<wbr>uiwebview](https://developer.apple.com/documentation/uikit/uiwebview) for more information.

解决

方案1

Cocoapods更新AFNetWorking

pod 'AFNetworking', '~> 4.0'

注意⚠️:最新AFNetworking的稳定性不确定如何,导入后,因为最新的AFNetworking加入了一个headers字段,只需要请求方法中加入headers:nil

方案2

手动拖AFNetWorking到项目中然后删除相关文件即可。

方案3

Cocoapods继续使用AFNetWorking 3.0,需要更改下Pod的方式,不导入AFNetWorkingUIKit的相关文件。

//老的
pod 'AFNetworking', '~> 3.0'

//更改后的
pod 'AFNetworking', '~> 3.0', :subspecs => ['Reachability', 'Serialization', 'Security', 'NSURLSession']

注意⚠️:将引入头文件#import "AFNetworking更改为#import <AFNetworking/AFHTTPSessionManager.h>即可

上一篇下一篇

猜你喜欢

热点阅读