In my app,
I have one array filterimage in that array some images is there.
I want that array data on another view.
I try to set nsuserdefault for filterimage with this code.
NSUserDefaults *userPrefs = [NSUserDefaults standardUserDefaults];
userPrefs setObject:filterimage forKey:@"FILTERIMAGE"];
with this code i try to get filterimage array data on another page.
FBImage = [[NSUserDefaults standardUserDefaults] valueForKey:@"FILTERIMAGE"];
FBImage is Array.
but get null in FBImage.
when i print data where i set user default it give like this.
-[NSUserDefaults setObject:forKey:]: Attempt to insert non-property value '(
"<null>",
"<null>",
"http://external.ak.fbcdn.net/safe_image.php?d=AQD44bnA250GMrV2&w=90&h=90&url=http%3A%2F%2Fwww.djmag.com%2Fimages%2Ftop100djs%2F2011header.jpg",
"http://external.ak.fbcdn.net/safe_image.php?d=AQD44bnA250GMrV2&w=90&h=90&url=http%3A%2F%2Fwww.djmag.com%2Fimages%2Ftop100djs%2F2011header.jpg",
"http://external.ak.fbcdn.net/safe_image.php?d=AQD44bnA250GMrV2&w=90&h=90&url=http%3A%2F%2Fwww.djmag.com%2Fimages%2Ftop100djs%2F2011header.jpg",
"<null>",
"<null>",
"<null>",
"<null>",
"<null>"
)' of class '__NSArrayM'
is this problem because of i will get null value in filter array?
NSUserDefaults can only contain a few data types:
BOOL, double, float, NSInteger, NSNumber, NSData, NSString, NSDate, NSArray, NSDictionary, NSURL. For other data types convert then to NSData or NSString.Note that there are convince methods/functiions for many other data types to convert to and from NSStrings including
NSStringFromCGAffineTransform, NSStringFromCGPoint, NSStringFromCGRect, NSStringFromCGSize, NSStringFromRange, NSStringFromUIEdgeInsets, NSStringFromUIOffsetand their counterparts to recreate the data types from theNSStringrepresentations.