solve the problem of writetofile failure when NULL is included in Nsarray and Nsdictionary
@implementation Nsarray (Plist)-(BOOL) Writetoplistfile: (nsstring*) filename{nsdata * data = [Nskeyedarchiver archived
Datawithrootobject:self];
Nsarray * paths = Nssearchpathfordirectoriesindomains (NSDocumentDirectory, Nsuserdomainmask, YES);
NSString * documentsdirectory = [paths objectatindex:0];
NSString * Path = [Documentsdirectory stringbyappendingpathcomponent:filename];
BOOL didwritesuccessfull = [data Writetofile:path atomically:yes];
return didwritesuccessfull; } + (nsarray*) Readfromplistfile: (nsstring*) filename{nsarray * paths = Nssearchpathfordirectoriesindomains (NSDocument
Directory, Nsuserdomainmask, YES);
NSString * documentsdirectory = [paths objectatindex:0];
NSString * Path = [Documentsdirectory stringbyappendingpathcomponent:filename];
NSData * data = [NSData Datawithcontentsoffile:path];
return [Nskeyedunarchiver Unarchiveobjectwithdata:data]; } @end//needs to is set for implementation