How do i put an XML source into an NSString?
I've done this with HTML, like so:
NSString *theweatherhtml = [[NSString alloc] initWithContentsOfURL:[NSURL URLWithString:@"*URL STRING WOULD GO HERE*"]];
But when i do this wi开发者_如何转开发th an XML file, it returns a 'Program received signal: “EXC_BAD_ACCESS”.'
Is there a different way to do this for XML files?
That method is deprecated. You need to use:
initWithContentsOfURL:encoding:error:
http://developer.apple.com/library/ios/documentation/cocoa/reference/foundation/Classes/NSString_Class/Reference/NSString.html
You can use NSMutableDictionary using objectforkey Or NSArray and then convert each value into related varibles. Like -
int value; value = [[savedStock objectForKey:@"userID"] intValue];
精彩评论