Objective-C 警报 .. 不起作用?
由于某种原因我的警报不起作用? 如果我使用 NSLog(@" %@ ", url)
没问题...但这里没有警报:
- (void)alertURL:(NSURL *)url {
UIAlertView *someError = [[UIAlertView alloc] initWithTitle: url message: @"Error sending your info to the server" delegate: self cancelButtonTitle: @"Ok" otherButtonTitles: nil];
[someError show];
[someError release];
}
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
[self alertURL:url];
return YES;
}
有人能指出我出了什么问题吗:(
For some reason my alert is not working?
If i use NSLog(@" %@ ", url)
its fine... but no alert here:
- (void)alertURL:(NSURL *)url {
UIAlertView *someError = [[UIAlertView alloc] initWithTitle: url message: @"Error sending your info to the server" delegate: self cancelButtonTitle: @"Ok" otherButtonTitles: nil];
[someError show];
[someError release];
}
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
[self alertURL:url];
return YES;
}
Could anyone point out to me whats going wrong :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将 NSURL 对象作为标题参数传递给 UIAlertView 初始值设定项。
title
参数需要一个NSString
,但您显然没有传递给它。您需要改为调用
[ url AbsoluteString ]
或[ urlrelativeString ]
。You are passing the NSURL object as the title argument to the UIAlertView initializer.
The
title
argument expects anNSString
which you clearly are not passing to it.You need to call
[ url absoluteString ]
or[ url relativeString ]
instead.