Xcode 4.2 Objective C 中的警告
我创建了一个 iPad 应用程序,在其中我从 URL 获取数据, 当我编写此代码时,它向我显示此警告 initWithContentsOfURL 已弃用
这是代码片段,
NSString *mainstr;
NSURL *urlr=[NSURL URLWithString:@"http://abc.com/default.aspx?id=G"];
NSURLRequest *reqr=[NSURLRequest requestWithURL:urlr];
[webViewq loadRequest:reqr];
mainstr=[[NSMutableString alloc]initWithContentsOfURL:urlr];
也在 tableView 中向我显示此警告,initWithFrame:reuseIdentifier: 已弃用
这里是代码片段,其中我在每一行中创建一个标签
static NSString *CellIdentifier=@"Cell";
if(cell == nil){
cell=[[[UITableViewCell alloc]initWithFrame:CGRectZero reuseIdentifier:CellIdentifier]autorelease];
CGRect frame;
frame.origin.x = 0;
frame.origin.y = 0;
frame.size.height = 40;
frame.size.width = 180;
UILabel *capitalLabelI = [[UILabel alloc] initWithFrame:frame];
capitalLabelI.tag = CapitalTag;
capitalLabelI.font=[UIFont systemFontOfSize:16.0];
}
capitalLabelI.text=[@" " stringByAppendingString:[a objectAtIndex:indexPath.row]];
return cell;
,当我调用多个参数化方法时,它会向我显示此警告,
方法名称:
-(void)recentquote:(NSString *)sym:(int)i
调用语法:
[self recentquote:l3:i];
警告:
未找到实例方法 '-recentquote::' (返回类型默认to 'id')'
帮帮我!!
提前致谢!!
i created an iPad application, in which i am fetching data from URL,
when i write this code it shows me this warning initWithContentsOfURL is deprecated
here is the code snippet,
NSString *mainstr;
NSURL *urlr=[NSURL URLWithString:@"http://abc.com/default.aspx?id=G"];
NSURLRequest *reqr=[NSURLRequest requestWithURL:urlr];
[webViewq loadRequest:reqr];
mainstr=[[NSMutableString alloc]initWithContentsOfURL:urlr];
also in tableView it shows me this warning,initWithFrame:reuseIdentifier: is deprecated
here is the code snippet, in which i am creating one label inside each row
static NSString *CellIdentifier=@"Cell";
if(cell == nil){
cell=[[[UITableViewCell alloc]initWithFrame:CGRectZero reuseIdentifier:CellIdentifier]autorelease];
CGRect frame;
frame.origin.x = 0;
frame.origin.y = 0;
frame.size.height = 40;
frame.size.width = 180;
UILabel *capitalLabelI = [[UILabel alloc] initWithFrame:frame];
capitalLabelI.tag = CapitalTag;
capitalLabelI.font=[UIFont systemFontOfSize:16.0];
}
capitalLabelI.text=[@" " stringByAppendingString:[a objectAtIndex:indexPath.row]];
return cell;
and when i call multiple parametrized method, it shows me this warning,
method name:
-(void)recentquote:(NSString *)sym:(int)i
call syntex:
[self recentquote:l3:i];
warning:
Instance method '-recentquote::' not found (return type default to 'id')'
Help me guys !!
Thanks In Advance !!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
而不是
使用:
或
而不是
使用:
您应该将以下声明更改
为:
看来您对 Objective-C 和 iPad 开发真的很陌生,我强烈建议您阅读: https://stackoverflow.com/questions/332039/getting-started-with-iphone-development
instead of
use:
or
instead of
use:
And you should change the declaration of:
to:
Seems like you are really new to objective-c and iPad development, I strongly recommand you to read: https://stackoverflow.com/questions/332039/getting-started-with-iphone-development
调用语法应该是
(注意之间的空格),我建议无论如何重命名你的函数。
当它说它已被弃用时,它只是意味着在未来的某个时候,Apple 可能会一起删除此方法,不再支持它。因此,将您的更改
为
检查文档以获取可用样式以及它的含义
编辑:
我建议更改它,也许
然后调用它使用
the call syntax should be
(note at the space in between), I suggest renaming your function anyway.
when it say it's deprecated, it simply means some time in the future, Apple might remove this method all together, it's not longer supported. So change your
to
Check the documentation for available style and what it means
EDIT :
I suggest changing it, maybe to
then to call it use