標籤:ios8 alert action url ios6 tail utf8 async tar
1.【彈出提示對話方塊】
在iOS9之前我們使用AlertView來彈出對話方塊,現在推薦使用AlertController,對於這個變化,參考另一篇部落格《iOS9使用提示框的正確實現方式》。
2.【stringByAddingPercentEncodingWithAllowedCharacters替換stringByAddingPercentEscapesUsingEncoding】
這個方法真的好長。。。我們使用這個方法來進行字串編碼方式的更改。最常用的地方就是進行Http網路請求的時候,發送的連結的參數中如果帶有中文,那麼首先就需要調用這個方法把編碼方式改為utf8,因為伺服器端一般都使用utf8編碼。兩者實現的功能一樣。
3.【NSURLSession替換NSURLConnection】
NSURLSession已經漸漸走上曆史舞台了。最近使用[NSURLConnection sendAsynchronousRequest]時已經警告為不推薦使用了,那我們就換成NSURLSession中的dataTaskWithRequest方法吧。
4.【presentViewController替換presentModalViewController】
這是彈出一個模態視圖的方法,presentModalViewController方法首先在iOS6被棄用。如果使用了導覽列,則不能使用這種跳轉方式。
5.【AlertController中的UIAlertControllerStyleActionSheet替換ActionSheet】
ActionSheet在iOS8.3後被棄用了。會出現如下警告:
參考連結:http://blog.csdn.net/chenyufeng1991/article/details/50060061
iOS - 改掉那些已經過時的方法吧 (持續更新中。。。)