objective c - NSError no visible interface iOS 8.1 -
this piece of code working on ios 8. however, when build in release mode a
no visible @interface 'nserror' declares selector 'code'.
code found on nserror
. can click , see that, however, don't understand why stopped working xcode 6.1 , ios 8.1
i tried building on 5.1.1 , built fine in release mode.
+(bool) isresponseerror:(nsurlresponse *)response responsestring:(nsstring *)responsestring error:(nserror *__autoreleasing *)error { nsinteger statuscode = 0; if (*error) { statuscode = [*error code]; } if ([response iskindofclass:[nshttpurlresponse class]]) { statuscode = [(nshttpurlresponse *)response statuscode]; } if (statuscode >= 400 || statuscode <= kcfurlerrorunknown) { nsmutabledictionary *dic = [nsmutabledictionary dictionary]; [dic setvalue:[nshttpurlresponse localizedstringforstatuscode:statuscode] forkey:nslocalizeddescriptionkey]; return true; } else { id ret = [serialization deserializejson:responsestring]; if ([ret superclass] == [nsmutabledictionary class] || [ret class] == [nsdictionary class]) { if ([ret objectforkey:@"error"]) { nsmutabledictionary *dic = [nsmutabledictionary dictionary]; [dic setvalue:[ret objectforkey:@"error"] forkey:nslocalizeddescriptionkey]; return true; } else { return false; } } else { return false; } } }
you passing in nserror
instance not need __autoreleasing
or pointer pointer:
+(bool) isresponseerror:(nsurlresponse *)response responsestring:(nsstring *)responsestring error:(nserror *)error { nsinteger statuscode = 0; if (error) { statuscode = [error code]; }
if there no error prior 8.1 , not because compiler error checking improved.
Comments
Post a Comment