The reason you are not able to store An Array of URLs in NSUserDefaults
is, it allows only primitive Data object Storing, while NSURL
is not premitive DataType.
//Define Your URL
NSURL *myURL = [NSURL URLWithString:@"www.google.com"];
NSMutableArray *urlArr = [[NSMutableArray alloc] initWithCapacity:0];
//Add it to Array
for(int i=0;i<5;i++)
[urlArr addObject:[myURL absoluteString]]; // Convert NSURL to NSString
[[NSUserDefaults standardUserDefaults] setObject:urlArr forKey:@"myURLArr"];
[[NSUserDefaults standardUserDefaults] synchronize];
NSMutableArray *array = [NSMutableArray arrayWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:@"myURLArr"]];
for(NSString *urlString in array)
NSLog(@"%@",[NSURL URLWithString:urlString]); // Crete NSURL from NSString