【发布时间】:2011-03-09 07:10:06
【问题描述】:
我有这行代码,我试图将自定义 MKAnnotation 上的注释中的 URL 分配给 UIWebView 控制器。
webViewController.webViewURL = annotation.url;
基本上,我在 annotation.url 中存储了一个 NSURL,并试图将此 NSURL 发送到 webViewController.webViewURL。
当我尝试运行此代码时,我在控制台中收到“EXC_BAD_ACCESS”。运行分配工具(使用 NSZombiesEnabled)没有显示任何僵尸......我不明白为什么会发生这种情况,特别是因为如果我将行更改为使用 'URLWithString...' 并构建一个新的 NSURL.. .
webViewController.webViewURL = [NSURL URLWithString:annotation.url];
...它没有问题,但我收到警告:Incompatible Objective-C types 'struct NSURL *', expected 'struct NSString *' when passing argument 1 of 'URLWithString:' from distinct Objective-C type
【问题讨论】:
-
能否也发布一下 webViewURL 属性是如何配置的以及它是如何以及在哪里发布的?
标签: ios memory-management webview nsurl