ios - Save custom Coreplot Graph in NSUserDefaults -


i'm trying save nsmutablearray of coreplot graphs in nsuserdefault. here code

save graphs:

nsdata *encodedgraphs = [nskeyedarchiver archiveddatawithrootobject:grapharray]; nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; [defaults setobject:encodedgraphs forkey:@"graphs"]; [defaults synchronize]; 

load saved graphs:

nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; nsdata *encodedobject = [defaults objectforkey:@"graphs"]; nsmutablearray *savedgraphs = [nskeyedunarchiver unarchiveobjectwithdata:encodedobject]; if (savedgraphs != nil) {     grapharray = savedgraphs;     [_tableview reloaddata]; } 

when trying load saved graphs, run error:

assertion failure in -[uicgcolor encodewithcoder:], /sourcecache/uikit_sim/uikit-2935.137/uicolor.m:1439  terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'only rgba or white color spaces supported in situation.' 

does knows going wrong here? thanks

it turns out there view has background image set uicolor colorwithpatternimage breaking encoding. changed background image uiimage , works now.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -