为什么iOS SDK 和iOS 操作系统版本会相互影响?或者:什么是 iOS SDK? [英] Why do iOS SDK and iOS Operating System version affect each other? Or: What IS an iOS SDK?

查看:22
本文介绍了为什么iOS SDK 和iOS 操作系统版本会相互影响?或者:什么是 iOS SDK?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面来自 H2CO3 的回答让我几乎高兴.但它没有解释一件事:为什么我在构建时会收到运行时异常针对 SDK6 的应用程序(UIPageViewController 需要一个子控制器在将它添加到父控制器之前)但不是在构建时SDK5?Rolf 的回答解释了正在发生的事情:设备知道应用程序构建的 SDK与 和 行为不同以确保最大的兼容性.

The answer below from H2CO3 makes me almost happy. But it does not explain one thing: why do I get a runtime exception when building the app against SDK6 (UIPageViewController requires one child controller before adding it to a parent controller) but not when building against SDK5? The answer from Rolf explains what is going on: the device knows the SDK an app was built with and behaves differently to ensure maximum compatibility.

在与 iOS SDK 版本、MonoTouch 版本和不同的 iOS 版本作斗争时,我开始想:iOS SDK 到底是什么?

While fighting with iOS SDK versions, MonoTouch versions and different iOS Versions, I started wondering: What IS an iOS SDK after all?

我的意思是,我安装 Xcode 4.4 并获得 iOS SDK 5.如果我安装 Xcode 4.5,我获得 iOS SDK 6.到目前为止没有问题.

I mean, I install Xcode 4.4 and I get iOS SDK 5. If I install Xcode 4.5, I get iOS SDK 6. So far no problem.

  • 现在假设我构建了一个针对 iOS 5 的应用,并且不使用任何 iOS 6 特定的 东西.我只是使用iOS SDK 6构建这个应用程序.
  • 然后我构建了相同的应用,但使用了iOS SDK 5.
  • Now assume I build an app that targets iOS 5 and does not use any iOS 6 specific things. I but build this app using iOS SDK 6.
  • Then I build the same app but use iOS SDK 5.

然后我在 iOS 6 设备上运行该应用的两个版本.

Then I run both versions of the app on an iOS 6 device.

为什么他们的行为不同?有一些细微的差别,例如在将页面视图控制器作为子控制器添加到父控制器之前,如果没有设置子控制器,UIPageViewController 会抛出异常.

Why do they behave differently? There are small differences, for instance UIPageViewController throws an exception if no child controller is set before adding the page view controller as a child to a parent controller.

据我所知,回调、功能和一切都来自 iOS 操作系统,而不是来自 SDK.但两种情况下的操作系统相同.

To my understanding, the callbacks, the features and everything is coming from the iOS Operating System and not from the SDK. But the OS is the same in both cases.

我完全理解,如果我想使用 iOS 6 特定功能,我需要使用 iOS SDK 6,因为 SDK 5 中不存在 UICollectionView.但此视图的 UI 代码显然没有包含在我的应用程序,否则它也可以在 iOS5 上运行.所以集合视图来自操作系统提供的共享库.

I totally understand that if I want to user an iOS 6 specific feature, I need to use iOS SDK 6 because a UICollectionView just doesn't exist in SDK 5. But the UI code for this view is obviously not getting included in my app, otherwise it would work on iOS5 too. So the collection view is coming from a shared library provided by the OS.

最重要的是 MonoTouch.如果我们假设每个 MonoTouch 版本只是绑定的扩展而不修复任何错误,那么我使用的 MT 版本应该无关紧要.

On top of that there is then MonoTouch. If we assume that each MonoTouch version is nothing but an extension of the bindings without fixing any bugs, it should not matter what MT version I use.

我的问题的简短回顾是:iOS 版本、iOS SDK 版本、MonoTouch 版本和应用程序的目标版本如何一起玩?

A short recap of my question would be: how do iOS version, iOS SDK version, MonoTouch version and application's target version play together?

推荐答案

理论上,您应该能够从 iOS 5 切换到 iOS 6 SDK 并且不会看到任何差异.在实践中它有点有点不同.

In theory, you should be able to switch from the iOS 5 to iOS 6 SDK and not see any differences. In practice it's a little bit different.

  1. 设备知道您使用的 SDK.这意味着设备本身可以决定采取不同的行为(无论出于何种原因,Apple 认为这是一个好主意).
  2. 您使用的是不同的工具链(gcc 和相关的二进制文件),它们的编译方式可能会有所不同(尽管这种情况很少见,我还没有看到它实际发生过).
  3. MonoTouch 本身的行为可能会有所不同(目前没有想到,但例如,我们可能会为部署目标等内容使用不同的默认值(当然,如果您尚未自行设置)).

我相信您遇到了第一种情况 - Apple 在 iOS6 中对其 UI 层次结构添加了一些限制,只有在您针对 iOS 6 SDK 构建时才会强制执行这些限制(我认为不会破坏现有应用).

I believe you're running into the first case - Apple has added a few restrictions to their UI hierarchy in iOS6 which they only enforce if you built against the iOS 6 SDK (to not break existing apps I presume).

这篇关于为什么iOS SDK 和iOS 操作系统版本会相互影响?或者:什么是 iOS SDK?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆