When I updated Xcode to 4.4.1 It gives me 22 warning for using RestKit Library. The error was like this:
Direct access to objective-c's isa is deprecated in favor of object_setClass() and object_getClass()
I fixed 18 warnings by replacing:
Replace %lu with %u
Replace object->isa with object_getClass(object)
Replace keyObject->isa with object_getClass(keyObject)
There are 4 more warnings that I cannot fix it, here are the warnings following by its descriptions:
file Name 1: RKManagedObjectMappingOperation.m
Warning Line1:
NSAssert(mapping, @"Attempted to connect relationship for keyPath '%@' without a relationship mapping defined.");
Warning Description1:
more '%' conversations than data arguments
File Name2: RKReachabilityObserver.m
Warning Line2:
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]];
Warning description2:
format specifies type int but the argument has type NSString
File Name3: JSONKit.m
Warning Line3:
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); }
Warning Description3:
Direct access to objective-c's isa is deprecated in favor of object_setClass() and object_getClass()
File Name4: NSManagedObject+ActiveRecord.m
Warning Line 4:
RKLogError(@"Property '%@' not found in %@ properties for %@", propertyName, [propDict count], NSStringFromClass(self));
Warning description4:
format specifies type id but the argument has type NSUInteger
How to fix it?
Warning 1:
becomes
or
it said “more ‘%’ conversations than data arguments” meaning that you have placeholders, in this case %@, but no arguments to fill them. So either provide an argument or delete the placeholder.
Warning 2:
becomes
notice the
isMonitoringLocalWiFi=%dpart gets%@instead of%d, because you provide a string argument but have an integer placeholder.Warning 3: Sorry can’t help you with this one. Probably after I take a look at the code I’ll post an update.
update: try changing
to
Warning 4:
becomes
notice the second placeholder should be
%dand not%@since you provide an integer or in this case a NSUInteger, i.e.[propDict count]argument.