日前上線App然后appstore給我發(fā)了一封關(guān)于升級UIWebview的郵件:
ITMS-90809: Deprecated API Usage - Apple will stop accepting submissions of app updates that use UIWebView APIs starting from December 2020. Seehttps://developer.apple.com/documentation/uikit/uiwebviewfor more information.
由于UIWebview存在比較嚴(yán)重的內(nèi)存泄漏,早在2017年就告知開發(fā)者將UIWebview遷移到WKWebview。
WKWebview比較容易遷移,就是簡單的更換控件和更改監(jiān)聽處理,以及更換user-Agent。
因為大部分開發(fā)者都會使用AFNetworking進(jìn)行封裝網(wǎng)絡(luò)請求,所以令開發(fā)者頭痛的是,如何更換AFNetworking上的UIViewview(AFURLSession)上的API。
下面簡述如何去掉
更新podfile文件上的AFNetworking引入如下:
?pod 'AFNetworking', '~> 3.0', :subspecs => ['Reachability', 'Serialization', 'Security', 'NSURLSession']
更新 pod install?
然后引用 #import <AFNetworking/AFNetworking.h>改為 #import <AFNetworking/AFURLSessionManager.h>
可以參考GitHub上的討論:https://github.com/AFNetworking/AFNetworking/issues/4428