如何使 iOS 4.0 应用程序与 iPhone OS 3.1.3 兼容?
因此,我可能在通过擦除 Xcode 安装并仅安装 4.0 SDK 将应用程序更新到 iOS 4.0 时犯了一个错误(我什至在备份中找不到 SDK 3.1.3,啊!)。我现在有一个使用 4.0 的基本 SDK 构建的应用程序,它在 iTunes 中说它需要 4.0,但我添加的唯一内容是方法 -applicationDidEnterBackgroundState 和 -applicationDidBecomeActive (基本上只是复制并粘贴来自的保存/加载数据代码-applicationWillTerminate 和 -viewDidLoad)。我是否可以在构建设置中将 iPhone OS 部署目标设置为 3.1.3 来重建应用程序,并且 Apple 将允许我从本质上降级我的应用程序?我是否应该放入检查 4.0 的 #If_Define 语句,以便有条件地启用这些 4.0 方法?
So, I may have made a mistake in updating my application to iOS 4.0 by wiping my Xcode installation and only installing the 4.0 SDK (I can't even find SDK 3.1.3 in my backups, doh!). I have an app now that has been built with a base SDK of 4.0 and it says in iTunes it requires 4.0 but the only thing I added was the methods -applicationDidEnterBackgroundState and -applicationDidBecomeActive (basically just copied and pasted the save/load data code from -applicationWillTerminate and -viewDidLoad). Is it possible that I can rebuild the app with the iPhone OS Deployment Target set to 3.1.3 in the Build Settings and Apple will allow me to essentially downgrade my app? Should I put in those #If_Define statements that check for 4.0 so it will conditionally enable those 4.0 methods?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,您不需要使用#ifdef 语句。您可以调用任何您想要的方法 - 问题是 UIApplication 实例是否会调用它:)。
另外,我相信您的部署设置将处理 iTunes 问题。因此,您应该将其设置为 3.1.3(或 3.0,除非特别需要,我认识的很多人都没有在 3 之间升级,因为功能很少,而且很多时候它本质上是一个反越狱版本)。
至于代码,我是这样处理这个问题的:
对于前台,我只有一个从
application:didFinishLaunchingWithOptions:
和applicationWillEnterForeground:< 调用的“loader”方法。 /代码>。
非常适合我的 3G w/ 3.0 上的软件(在 3G 上看到 iOS4 后我拒绝升级!)以及运行 iOS4 的 3GS。
No, you shouldn't need to use #ifdef statements. You can call a method anything you want - the question is whether or not the UIApplication instance will call it :).
Also, your deployment settings will handle the iTunes issue, I believe. So, you should set it to 3.1.3 (or 3.0 unless specifically required, a lot of people I know didn't upgrade between the 3s because there were minimal features and many times it was essentially an anti-jailbreak release).
As for the code, I've handled this issue like this:
And for the foreground, I just have a "loader" method that is called both from
application:didFinishLaunchingWithOptions:
andapplicationWillEnterForeground:
.Works well for my software on my 3G w/ 3.0 (I refuse to upgrade after seeing iOS4 on a 3G!) as well as my 3GS running iOS4.