Start a new topic

Calling loadObjectWithID: on a KCSLinkedAppdataStore crashes app

I am trying to load a collection based on id. Calling loadObjectWithID: crashes app. It was working fine two days before.

Here is the crash log



Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSDictionary initWithDictionary:copyItems:]: dictionary argument is not an NSDictionary'

*** First throw call stack:

(

0 CoreFoundation 0x000000010395a495 __exceptionPreprocess + 165

1 libobjc.A.dylib 0x000000010034a99e objc_exception_throw + 43

2 CoreFoundation 0x0000000103941086 -[NSDictionary initWithDictionary:copyItems:] + 854

3 CoreFoundation 0x0000000103940d11 +[NSDictionary dictionaryWithDictionary:] + 49

4 MyApp 0x000000010008dc8d -[KCSMetadata initWithKMD:acl:] + 333

5 MyApp 0x000000010006d1ec populate + 1964

6 MyApp 0x000000010006e5d6 +[KCSObjectMapper populateObjectWithLinkedResources:withData:resourceDictionary:] + 118

7 MyApp 0x000000010006e70a +[KCSObjectMapper makeObjectWithResourcesOfType:withData:withResourceDictionary:] + 266

8 MyApp 0x000000010008a193 -[KCSLinkedAppdataStore manufactureNewObject:resourcesOrNil:] + 115

9 MyApp 0x0000000100090c1a -[KCSBackgroundAppdataStore handleLoadResponse:error:completionBlock:] + 842

10 MyApp 0x0000000100091b87 __86-[KCSBackgroundAppdataStore doLoadObjectWithID:withCompletionBlock:withProgressBlock:]_block_invoke + 55

11 MyApp 0x000000010008133d -[KCSRequest2 callCallback:request:] + 1981

12 MyApp 0x0000000100080537 -[KCSRequest2 requestCallback:request:] + 1111

13 MyApp 0x000000010008005e __20-[KCSRequest2 start]_block_invoke_3 + 46

14 Foundation 0x000000010342a063 __103+[__NSOperationInternal _observeValueForKeyPath:ofObject:changeKind:oldValue:newValue:indexes:context:]_block_invoke96 + 16

15 libdispatch.dylib 0x0000000103d73851 _dispatch_call_block_and_release + 12

16 libdispatch.dylib 0x0000000103d8672d _dispatch_client_callout + 8

17 libdispatch.dylib 0x0000000103d76b27 _dispatch_root_queue_drain + 380

18 libdispatch.dylib 0x0000000103d76d12 _dispatch_worker_thread2 + 40

19 libsystem_pthread.dylib 0x00000001040d3ef8 _pthread_wqthread + 314

20 libsystem_pthread.dylib 0x00000001040d6fb9 start_wqthread + 13

)

libc++abi.dylib: terminating with uncaught exception of type NSException



My code looks somewhat like:

[[MyManager sharedStore] loadObjectWithID:_id withCompletionBlock:^(NSArray *objectsOrNil, NSError *errorOrNil) {

if (!errorOrNil && objectsOrNil.count > 0) {

[[MySharedData sharedInstance] setObject: objectsOrNil[0]];

}

else if (!errorOrNil){

[[MySharedData sharedInstance] setObject: nil];

}

} withProgressBlock:nil];



Any help will be highly appreciated. Thanks!

"_acl":{"creator":"53a18635cdf08d2f570375d6"}
ahan so how exactly it should look like?
This element's _acl is not correct. Did you modify it through business logic?
Here is the response for adding header "_id" and value is "53ce1935ba823db42c087702"



HTTP/1.1 200

Content-Type: application/json

X-Kinvey-API-Version: 3

X-Kinvey-Request-Id: 0854819509334b58918144df9c422c36

X-Powered-By: Express



[

{

"_id": "53ce1935ba823db42c087702",

"members": [],

"center": null,

"creator": {

"_collection": "user",

"_id": "53a18635cdf08d2f570375d6",

"_type": "KinveyRef"

},

"invited": [

{

"_collection": "user",

"_id": "53a1a3d665d3ff6458038b52",

"_type": "KinveyRef"

}

],

"_acl": "53a18635cdf08d2f570375d6",

"_kmd": {

"ect": "2014-07-22T07:56:37.648Z",

"lmt": "2014-07-22T07:56:37.648Z"

}

}

]
Not quite. In the API Console Add-On, you can run various REST requests. Select the collection and perform a GET on that specific _id. The JSON version of the object should show up in the results pane. That is what I am looking for.
I can see the entry in my table in console. But if I use Filter field to load only one entry on basis of _id, I see empty console. Is this what you were asking me to do?
It looks like there was something unexpected the metadata. Can you load the object through the API console and share the JSON output?
Login or Signup to post a comment