My ios code (using Restkit 0.10.0) works perfectly well in iPhone 5.1 Simulator. However, the same code does not seem to work on iPhone 6.1 Simulator.
In the code below, [objectLoader send] gets called & I see that the call gets added to RKRequestQueue. However, no http call is made & the activity indicator keeps spinning endlessly.
-(void)myMethodCall:(NSString*)myparam1 password:(NSString*)myparam2{
RKObjectMapping* wsReturnMapping = ... //assume some complex mapping logic lives here
RKObjectLoader *objectLoader = [objectManager objectLoaderWithResourcePath:@"/somevalidurl" delegate:self]; //this line shows a deprecation warning
objectLoader.method = RKRequestMethodPOST;
objectLoader.objectMapping = wsReturnMapping;
objectLoader.params = [NSDictionary dictionaryWithObjectsAndKeys:myparam1, @"myparam1", myparam2, @"myparam2", nil];
[objectLoader send];
}
I also tried these approches to make the http call (but none worked):
Alternate approach 1:
[objectManager loadObjectsAtResourcePath:@"/somevalidurl" usingBlock:^(RKObjectLoader *loader) {
loader.delegate = self;
loader.method = RKRequestMethodPOST;
loader.objectMapping = wsReturnMapping;
loader.params = [NSDictionary dictionaryWithObjectsAndKeys:myparam1, @"myparam1", myparam2, @"myparam2", nil];
}];
Alternate approach 2:
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:myparam1, @"myparam1", myparam2, @"myparam2", nil];
NSString *resourcePath = [@"/somevalidurl" appendQueryParams:dict];
[objectManager loadObjectsAtResourcePath:resourcePath delegate:self];
Questions:
1) Did anyone get Restkit 0.10.0 to work with iOS 6.x?
2) Any idea why [objectLoader send] is not making the http call? (works for iOS 5.x)
3) If upgrading Restkit is the only option, can I still leverage the objectMapping I have? In other words, I couldn't find an example in the more recent Restkit where objectMapping is used.
Any help appreciated.
Ok. The problem seems to happen whenever I switch between iphone 5.1 simulator to 6.1 simulator. I stuck to the original approach. The solution that worked for me is
1) uninstall the app from the simulator and
2) clean & rebuild the project.
Wonky - but works.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.