当我将 Xcode 更新到 4.4.1 时,它给了我 22 个使用 RestKit 库的警告。错误是这样的:
Direct access to objective-c's isa is deprecated in favor of object_setClass() and object_getClass()
我通过替换修复了 18 个警告:
替换%lu
为%u
替换object->isa
为object_getClass(object)
替换keyObject->isa
为object_getClass(keyObject)
还有 4 个我无法修复的警告,以下是警告及其描述:
文件名 1:RKManagedObjectMappingOperation.m 警告行 1:
NSAssert(mapping, @"Attempted to connect relationship for keyPath '%@' without a relationship mapping defined.");
警告说明1:
more '%' conversations than data arguments
文件名 2:RKReachabilityObserver.m 警告行 2:
return [NSString stringWithFormat:@"<%@: %p host=%@ isReachabilityDetermined=%@ isMonitoringLocalWiFi=%d reachabilityFlags=%@>",
NSStringFromClass([self class]), self, self.host, self.isReachabilityDetermined ? @"YES" : @"NO",
self.isMonitoringLocalWiFi ? @"YES" : @"NO", [self reachabilityFlagsDescription]];
警告说明2:
format specifies type int but the argument has type NSString
文件名 3:JSONKit.m 警告行 3:
if(JK_EXPECT_F(((id)keys[idx])->isa != encodeState->fastClassLookup.stringClass) && JK_EXPECT_F([(id)keys[idx] isKindOfClass:[NSString class]] == NO)) { jk_encode_error(encodeState, @"Key must be a string object."); return(1); }
警告说明3:
Direct access to objective-c's isa is deprecated in favor of object_setClass() and object_getClass()
文件名 4:NSManagedObject+ActiveRecord.m 警告行 4:
RKLogError(@"Property '%@' not found in %@ properties for %@", propertyName, [propDict count], NSStringFromClass(self));
警告说明4:
format specifies type id but the argument has type NSUInteger
如何解决?