比如,一个方法在iOS8.0 被弃用了,我们都替换成苹果建议使用的方法,那如果iOS8.0之前的版本手机,装上了这个应用。因为8.0之前没有替换后的方法,那调用到这个方法的时候,会不会出现什么问题?
例如:
大家讲道理2017-05-02 09:21:45
If this method was added after ios8, then if the phone is still running on ios7, an error will occur. This is the same as android and requires manual control.
仅有的幸福2017-05-02 09:21:45
The deprecation is actually just no longer updated. In fact, it can still be used but there will be a warning. If you think manual control is more troublesome, you can still use this method.
迷茫2017-05-02 09:21:45
There will be problems and even crashes.
For the case of method Deprecated, it can generally be handled like the following:
NSString *sampleString = @"abcdefg";
if ([sampleString respondsToSelector:@selector(stringByReplacingPercentEscapesUsingEncoding:)]) {
[sampleString stringByReplacingPercentEscapesUsingEncoding:<#your-encoding-here#>];
}
else {
<#your-else-code-here#>
}