开发者

Objective-c iphone App, problems with button to parsed hyperlink

开发者 https://www.devze.com 2023-01-13 03:20 出处:网络
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

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.

0

精彩评论

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