很多功能已被废弃 - iOs 6

33

我有一些函数已经自iOs 6开始弃用。 也许对其他刚更新到iOs 6的人有所帮助。

    [self presentModalViewController:pNewController animated:YES];
 presentModalViewController:animated is deprecated since iOs 6

 Autosynthesized property 'String' will use synthesized instance variable '_String', not existing instance variable 'String'

Autosynthesized property 'phonenumber' will use synthesized instance variable '_phonenumber', not existing instance variable 'phonenumber'


 Deprecated: Group Table View Background Color is deprecated in iOS 6.0.

有人可以帮我解决这个问题吗?如何修复我的项目中不会出现任何已弃用的函数。

先感谢了。


1
这是完整的警告信息(用引号括起来搜索以便Google找到此线程):“presentModalViewController:animated:”已被弃用:自iOS 6.0起首次被弃用。 - Thorsten Niehues
5个回答

139
[self presentModalViewController:pNewController animated:YES];

可以被替换为

[self presentViewController:pNewController animated:YES completion:nil];

这个变化背后的历史可以在 WWDC 2012 视频会议第 #236 场中看到,它关于 iOS 上视图控制器的演变。


9

点击被废弃的方法。在右侧栏的Quick Help inspector中,您可以看到来自Apple文档的快速帮助信息。
还有一个建议是使用更新或替代的方法。


2

请尝试以下操作:

以“源代码”模式打开.storyboard文件或.xib文件。

查找并删除此行:

<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>

1
像这样使用
[self presentViewController:object animated:YES completion:NULL];

[object dismissViewControllerAnimated:YES completion:NULL];

1
我可以帮你解决最后一个问题:这意味着在iOS6中不再支持color GroupTableViewBackgroundColor。你可能在xib文件中的某个地方使用了它。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接