Created
January 31, 2012 18:28
-
-
Save ethanmick/1712047 to your computer and use it in GitHub Desktop.
Error in my iOS app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// app delegate | |
// | |
RKObjectManager *manager = [RKObjectManager objectManagerWithBaseURL:@"http://129.21.140.120:8080"]; | |
manager.objectStore = [RKManagedObjectStore objectStoreWithStoreFilename:@"db.sqlite"]; | |
//manager.objectStore.managedObjectCache = [[CustomCache alloc] init]; | |
manager.client.requestQueue.showsNetworkActivityIndicatorWhenBusy = YES; | |
manager.acceptMIMEType = RKMIMETypeJSON; | |
manager.serializationMIMEType = RKMIMETypeJSON; | |
manager.client.authenticationType = RKRequestAuthenticationTypeHTTP; | |
manager.client.username = username; | |
manager.client.password = password; | |
RKObjectRouter *router = [[RKObjectRouter alloc] init]; | |
[router routeClass:[List class] toResourcePath:@"/lists/:listID"]; | |
[router routeClass:[List class] toResourcePath:@"/lists" forMethod:RKRequestMethodPOST]; | |
[router routeClass:[Task class] toResourcePath:@"/lists/:list.listID/tasks/:taskID"]; | |
[router routeClass:[Task class] toResourcePath:@"/lists/:list.listID/tasks/" forMethod:RKRequestMethodPOST]; | |
manager.router = router; | |
RKManagedObjectMapping *taskMapping = [RKManagedObjectMapping mappingForClass:[Task class]]; | |
taskMapping.primaryKeyAttribute = @"taskID"; | |
[taskMapping mapKeyPath:@"id" toAttribute:@"taskID"]; | |
[taskMapping mapAttributes:@"title", @"body", @"priority", nil]; | |
[manager.mappingProvider setMapping:taskMapping forKeyPath:@"task"]; | |
[manager.mappingProvider setSerializationMapping:[taskMapping inverseMapping] forClass:[Task class]]; | |
RKManagedObjectMapping *listMapping = [RKManagedObjectMapping mappingForClass:[List class]]; | |
listMapping.primaryKeyAttribute = @"listID"; | |
[listMapping mapAttributes:@"title", nil]; | |
[listMapping mapKeyPath:@"id" toAttribute:@"listID"]; | |
[listMapping mapRelationship:@"tasks" withMapping:taskMapping]; | |
[manager.mappingProvider setMapping:listMapping forKeyPath:@"list"]; | |
[manager.mappingProvider setSerializationMapping:[listMapping inverseMapping] forClass:[List class]]; | |
NSLog(@"App Delegate 64: Manager: %@", manager); | |
// | |
//To load objects... | |
// | |
[[RKObjectManager sharedManager] loadObjectsAtResourcePath:@"/lists" delegate:self block:^(RKObjectLoader* loader) { | |
// Returns lists as a naked array in JSON, so we instruct the loader | |
// to user the appropriate object mapping | |
loader.objectMapping = [[RKObjectManager sharedManager].mappingProvider objectMappingForClass:[List class]]; | |
}]; | |
// | |
// Error!! | |
// | |
2012-01-31 13:24:31.557 RestkitDebugger[80474:15007] D restkit.network:RKObjectLoader.m:213 No object mapping provider, using mapping provider from parent object manager to perform KVC mapping | |
2012-01-31 13:24:31.559 RestkitDebugger[80474:15007] D restkit.object_mapping:RKObjectMapper.m:255 Performing object mapping sourceObject: ( | |
{ | |
"created_at" = "2012-01-29T03:56:25Z"; | |
id = 31; | |
"syncing_id" = 6; | |
tasks = ( | |
{ | |
body = ""; | |
completed = 0; | |
"created_at" = "2012-01-30T21:55:16Z"; | |
"creation_source" = ""; | |
"due_date" = "2012-01-30T21:55:00Z"; | |
id = 10; | |
"list_id" = 31; | |
priority = 1; | |
"syncing_id" = "<null>"; | |
"time_estimate" = "<null>"; | |
title = Derp; | |
"updated_at" = "2012-01-30T21:55:16Z"; | |
} | |
); | |
title = Test; | |
"updated_at" = "2012-01-29T03:56:25Z"; | |
"user_id" = 1; | |
} | |
) | |
and targetObject: (null) | |
2012-01-31 13:24:31.560 RestkitDebugger[80474:15007] T restkit.object_mapping:RKObjectMapper.m:269 Examining keyPath 'list' for mappable content... | |
2012-01-31 13:24:31.560 RestkitDebugger[80474:15007] D restkit.object_mapping:RKObjectMapper.m:104 Found a collection containing only NSNull values, considering the collection unmappable... | |
2012-01-31 13:24:31.561 RestkitDebugger[80474:15007] D restkit.object_mapping:RKObjectMapper.m:279 Found unmappable value at keyPath: list | |
2012-01-31 13:24:31.562 RestkitDebugger[80474:15007] T restkit.object_mapping:RKObjectMapper.m:269 Examining keyPath 'error' for mappable content... | |
2012-01-31 13:24:31.563 RestkitDebugger[80474:15007] D restkit.object_mapping:RKObjectMapper.m:104 Found a collection containing only NSNull values, considering the collection unmappable... | |
2012-01-31 13:24:31.564 RestkitDebugger[80474:15007] D restkit.object_mapping:RKObjectMapper.m:279 Found unmappable value at keyPath: error | |
2012-01-31 13:24:31.565 RestkitDebugger[80474:15007] T restkit.object_mapping:RKObjectMapper.m:269 Examining keyPath 'errors' for mappable content... | |
2012-01-31 13:24:31.565 RestkitDebugger[80474:15007] D restkit.object_mapping:RKObjectMapper.m:104 Found a collection containing only NSNull values, considering the collection unmappable... | |
2012-01-31 13:24:31.568 RestkitDebugger[80474:15007] D restkit.object_mapping:RKObjectMapper.m:279 Found unmappable value at keyPath: errors | |
2012-01-31 13:24:31.569 RestkitDebugger[80474:15007] T restkit.object_mapping:RKObjectMapper.m:269 Examining keyPath 'task' for mappable content... | |
2012-01-31 13:24:31.570 RestkitDebugger[80474:15007] D restkit.object_mapping:RKObjectMapper.m:104 Found a collection containing only NSNull values, considering the collection unmappable... | |
2012-01-31 13:24:31.571 RestkitDebugger[80474:15007] D restkit.object_mapping:RKObjectMapper.m:279 Found unmappable value at keyPath: task | |
2012-01-31 13:24:31.572 RestkitDebugger[80474:15007] D restkit.object_mapping:RKObjectMapper.m:308 The following operations are in the queue: ( | |
) | |
2012-01-31 13:24:31.573 RestkitDebugger[80474:15007] W restkit.object_mapping:RKObjectMapper.m:74 Adding mapping error: Could not find an object mapping for keyPath: '' | |
2012-01-31 13:24:31.574 RestkitDebugger[80474:15007] E restkit.network:RKObjectLoader.m:190 Encountered errors during mapping: Could not find an object mapping for keyPath: '' | |
2012-01-31 13:24:31.575 RestkitDebugger[80474:15007] DataManager 235 Error: Error Domain=org.restkit.RestKit.ErrorDomain Code=1001 "Could not find an object mapping for keyPath: ''" UserInfo=0x80817c0 {=RKObjectMapperKeyPath, NSLocalizedDescription=Could not find an object mapping for keyPath: ''} | |
2012-01-31 13:24:31.575 RestkitDebugger[80474:15007] T restkit.network.queue:RKRequestQueue.m:340 Removing request <RKManagedObjectLoader: 0x6b72270> from queue <RKRequestQueue: 0x6e58cb0 name=(null) suspended=NO requestCount=1 loadingCount=1/5> | |
2012-01-31 13:24:31.576 RestkitDebugger[80474:15007] T restkit.network.queue:RKRequestQueue.m:202 Loading count decreasing from 1 to 0. Firing requestQueueDidFinishLoading | |
2012-01-31 13:24:31.577 RestkitDebugger[80474:15007] T restkit.network.queue:RKRequestQueue.m:216 Loading count set to 0 for queue <RKRequestQueue: 0x6e58cb0 name=(null) suspended=NO requestCount=0 loadingCount=1/5> | |
2012-01-31 13:24:31.579 RestkitDebugger[80474:15007] T restkit.network.queue:RKRequestQueue.m:352 Decremented the loading count to 0 | |
2012-01-31 13:24:31.580 RestkitDebugger[80474:15007] D restkit.network.queue:RKRequestQueue.m:455 Request <RKManagedObjectLoader: 0x6b72270> failed loading in queue <RKRequestQueue: 0x6e58cb0 name=(null) suspended=NO requestCount=0 loadingCount=0/5> with error: Could not find an object mapping for keyPath: ''.(Now loading 0 of 5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment