简体   繁体   English

在iOS 5中使用弃用的方法

[英]use deprecated methods in iOS 5

I recently upgraded my application from iOS3 to iOS5. 我最近将我的应用程序从iOS3升级到iOS5。 And at compile time I have several warnings for using deprecated methods. 在编译时,我有几个使用弃用方法的警告。

Two questions: 两个问题:

1- Will I have problems when run the application in an iPhone with iOS 5? 1-在使用iOS 5的iPhone中运行应用程序时是否会出现问题?

2- If I did not update the methods, Will Apple accept the application when uploading it to the AppStore? 2-如果我没有更新方法,Apple会在将应用程序上传到AppStore时接受吗?

Briefly, 简单地说,

  1. No. 没有。
  2. Yes. 是。

See the dupe question for a longer explanation. 请参阅重复问题以获得更长的解释。

  1. You will probably not have a problem on iOS 5 devices using methods that the compiler is telling you are deprecated. 使用编译器告诉您不推荐使用的方法,iOS 5设备上可能没有问题。 Of course, it would be a good thing to clear up this issue over time because deprecated means those methods might not be present in iOS 6 (or whatever it will be called). 当然,随着时间的推移清理这个问题会是一件好事,因为弃用意味着这些方法可能不会出现在iOS 6中(或任何它将被称为)。

    • What you need to watch out for are compiler warnings or errors that an object may not respond to a particular method call. 您需要注意的是编译器警告或对象可能无法响应特定方法调用的错误。 These would occur for methods that actually were removed along the way. 对于实际上在此过程中被删除的方法,会出现这些情况。 It sounds like you have already done this, but be sure that you have set your SDK set to iOS 5 in XCode to ensure you are getting all the errors/warnings. 听起来您已经这样做了,但请确保您已在XCode中将SDK设置为iOS 5,以确保您收到所有错误/警告。 But the lesson here is test, test, test (on devices as well). 但这里的教训是测试,测试,测试(在设备上)。
  2. As long as your code compiles and runs against iOS 5, using a deprecated method alone probably won't get your app disqualified. 只要您的代码针对iOS 5进行编译和运行,单独使用弃用的方法可能不会使您的应用程序被取消资格。 If it causes any crashing or anything like that during testing, however, they will likely kick it back to you for rework. 但是,如果它在测试期间导致任何崩溃或类似的事情,他们可能会将它踢回给您进行返工。

Deprecated doesn't mean removed. 弃用并不意味着删除。 Its just a friendly hint for you that these functions might be gone in an future iOS version (eg. 6). 它只是一个友好的暗示,这些功能可能会在未来的iOS版本中消失(例如6)。 Currently they still work and the review team will accept your binary. 目前他们仍在工作,审核小组将接受您的二进制文件。 You should note that the lifetime of deprecated methods in iOS seems to be pretty long, a few methods from NSFileManager are deprecated since iOS 2 (aka iPhone OS 2.0) 你应该注意iOS中不推荐使用的方法的生命周期似乎很长,从iOS 2(又称iPhone OS 2.0) NSFileManager ,不推荐使用NSFileManager中的一些方法

However, you are encouraged to update your App at some time, if you have a critical update that needs to be out asap, you can skip this for now, but in the future you have to change your code! 但是,我们鼓励您在某个时间更新您的应用程序,如果您有一个需要尽快出现的关键更新,您现在可以跳过这个,但将来您必须更改您的代码!

  1. Test it. 测试一下。 You may not have a problem now but you will likely in the future. 你现在可能没有问题,但将来可能会有问题。
  2. You should be okay (Assuming it actually works) but Apple is fickle. 你应该没事(假设它确实有效),但苹果变幻无常。 No guarantees. 没有保证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM