Objective-c iphone App, problems with button to parsed hyperlink
Another problem for me with my application is a simple procedure. I want to have a button which, if you press, opens the link associated with the article in question. I have followed instructions that i understand, but I am having trouble understanding why the link will not work.
- (IBAction)link:(id)sender {
WebViewController *view = [[WebViewController alloc] initWithNibName:@"WebViewController"
开发者_如何学C bundle:nil];
[[self navigationController]pushViewController:view
animated:YES];
NSString *urlAddress = [item objectForKey:@"link"];
NSLog(@"urlad = %@", urlAddress);
NSURL *url = [[NSURL alloc] initWithString: urlAddress];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
NSLog(@"url = %@", url);
[[view webView] loadRequest:request];
[urlAddress release];
[url release];
[view release];}
I have tried investigating this further, but with no luck (The NSLogs). I can tell that the "link" is getting into the urlAddress string, but the url NSURL will not accept the string conversion. It is most irritating.
If anyone could help, i would be most grateful.
精彩评论