objective c - URL arrays saving -


i have nsmutablearray , put urls in array.

there no problem when save nsuserdefaults doesn't keeps content when load after closing app.

i tried convert url string doesn't save other nsmutablearrays have work strings

i using xcode.

can me?

the reason not able store array of urls in nsuserdefaults is, allows primitive data object storing, while nsurl not premitive datatype.

//define url nsurl *myurl = [nsurl urlwithstring:@"www.google.com"]; nsmutablearray *urlarr = [[nsmutablearray alloc] initwithcapacity:0]; //add array for(int i=0;i<5;i++)     [urlarr addobject:[myurl absolutestring]]; // convert nsurl 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 nsstring 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -