dyld:找不到符号:_UITransitionContextFromViewControllerKey

dyld: Symbol not found: _UITransitionContextFromViewControllerKey

我收到有关我的应用程序在 iOS 6 中加载时崩溃的报告。它是使用 iOS 8 SDK 构建的,在 7 和 8 上运行良好。 我刚刚设法拿到一个 iOS 6 设备进行测试,它确实在启动时崩溃并出现错误:

dyld: Symbol not found: _UITransitionContextFromViewControllerKey
Referenced from: /var/mobile/Applications/895BC1B3-A362-42C9-8560-5CF40A682A10/myapp.app/MyApp Expected in: /System/Library/Frameworks/UIKit.framework/UIKit in /var/mobile/Applications/895BC1B3-A362-42C9-8560-5CF40A682A10/myapp.app/MyApp

我知道 dyld 是链接器问题,但不知道从哪里开始。 我已取消链接并重新添加 UIKit,但仍然无法正常工作。

谢谢

看起来您正在使用 UIViewControllerContextTransitioning。它仅适用于 iOS 7+。

查看此问题了解更多详情Restore pre-iOS7 UINavigationController pushViewController animation

这是因为 UITransitionContextFromViewControllerKey 不存在 until iOS 7. Working around this probably isn't worth the effort--it means dropping all usage of UIViewControllerContextTransitioning, as the protocol is new in iOS 7, or creating a separate code path for iOS 6. If that's what you want, look into weak-linking UIKit, although this may result in slow startup