开发者

How to save values of NSUserDefault in array,and how to retrieve and POST

I hav to save the values of NSUserDefault to the Array,and later on have to POST the values bu usind HTTP POST, m trying this code,its working perfactly (when i reopen my application values reappear on the screen)but when i input tte values....it displays userneme=null,database=null.....)what should i have to do.should i have to save NSUserDefault's value to array and then POST,,,,plz help me out.....code would be appreaciated...Thanx in Advance

[NSUserDefaults resetStandardUserDefaults];

NSUserDefaults *storeData = [NSUserDefaults standardUserDefaults];
[storeData setObject:utextFieldNormal.text forKey:@"username"];
[storeData setObject:urltextFieldNormal.text forKey:@"url"];
[storeData setObject:dtextFieldNormal.text forKey:@"database"];



[storeData setObject:utextFieldNormal.text forKey:@"username"];
[storeData setObject:urltextFieldNormal.text forKey:@"url"];
[storeData setObject:dtextFieldNormal.text forKey:@"database"];

NSString *val1= [storeData valueForKey:@"username "];
NSString *val2= [storeData valueForKey:@"url"];
NS开发者_StackOverflow社区String *val3= [storeData valueForKey:@"database "];



//NSLog(@"username:%@",username);
NSLog(@"username:%@",val1);
NSLog(@"url:%@",val2);
NSLog(@"database:%@",val3);

[storeData synchronize];


Is this the actual code copy/pasted? The key strings passed to valueForkey have extra spaces at the end. Remove the spaces and it'll work fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜