core data - "Error: this process has called an NSArray-taking method..." when iCloud pushes managed objects -


for every managed object sent via icloud update, warning/error sent console:

*** error: process has called nsarray-taking method, such initwitharray:, , passed in nsset object. being worked-around now, cause grief.

my managed objects clients , have 1 many relationship assessments shown below.

    class client: nsmanagedobject {          //other nsmanaged vars here          @nsmanaged var assessment: nsorderedset } 

judging timing of error (during ubiquitous updates) , fact use of nsset objects in project, can presume function during update being passed nsorderedset when expecting nsarray.

turning off icloud removes errors.

i found 2 other folks similar issue: using icloud enabled core data nsarray-taking method

core data relation between objects

however, neither offers solution problem. working fine right now, "it cause grief."

if isn't resolved here, i'll take issue apple dev support.

i figured out how fix error after research. (no in apple dev forums).

this error caused swift 1.2 upgrade. encourage use new set<> class instead of nsset. error vague way of reinforcing claim.

ordering of data handled nsfetchedresultscontroller, didn't need stored data ordered. set out on task change data type 1 many relationship nsorderedset set.

so created new data model, selected relationship , unchecked "ordered" in data model inspector. migrated new model in next run. (as shown below)enter image description here

once done, changed data type in managed object subclass nsorderedset set. (or set). generated compiler errors easy fix throughout code.

the new set class converts array: array(myset)

to insert object set, there's easy insert method. foo.myset.insert(objecttoinsert).

side note: converting relationship set fixed weird ordering issues having table views , nsfetchedresultscontroller.

then ran program, generated data, uninstalled program. ran program again , watch glorious icloud data populate without annoying errors.

boom. hope saves out there 10 hours of turmoil (i tried lot of different things..) spent fix this.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -