【问题标题】:how to make fastlane compatible with iOS13如何让fastlane兼容iOS13
【发布时间】:2019-10-18 03:43:03
【问题描述】:

我正在使用fastlane打包我的应用程序,我在我的应用程序中编写了一些ios 13支持的类,例如UIStatusBarManager类,然后它打包失败了,我该怎么办?

我已经将 fastlane 更新到最新版本,但 xcode 仍然是 xcode10。

这是我使用fastlane打包时遇到的错误:

[11:04:05]: ▸ ❌  /Users/wanghq/jenkins_workspaces/workspace/mobile-ios-teacher-ipa/Teacher_iOS/Train/Record/Utils/ZFPlayer/ZFPlayerView.m:909:9: use of undeclared identifier 'UIStatusBarManager'
[11:04:05]: ▸         UIStatusBarManager *statusBarManager = [UIApplication sharedApplication].keyWindow.windowScene.statusBarManager;
[11:04:05]: ▸         ^
[11:04:05]: ▸ ❌  /Users/wanghq/jenkins_workspaces/workspace/mobile-ios-teacher-ipa/Teacher_iOS/Train/Record/Utils/ZFPlayer/ZFPlayerView.m:909:29: use of undeclared identifier 'statusBarManager'
[11:04:05]: ▸         UIStatusBarManager *statusBarManager = [UIApplication sharedApplication].keyWindow.windowScene.statusBarManager;
[11:04:05]: ▸                             ^
[11:04:05]: ▸ ❌  /Users/wanghq/jenkins_workspaces/workspace/mobile-ios-teacher-ipa/Teacher_iOS/Train/Record/Utils/ZFPlayer/ZFPlayerView.m:909:92: property 'windowScene' not found on object of type 'UIWindow *'
[11:04:05]: ▸         UIStatusBarManager *statusBarManager = [UIApplication sharedApplication].keyWindow.windowScene.statusBarManager;
[11:04:05]: ▸                                                                                            ^
[11:04:05]: ▸ ❌  /Users/wanghq/jenkins_workspaces/workspace/mobile-ios-teacher-ipa/Teacher_iOS/Train/Record/Utils/ZFPlayer/ZFPlayerView.m:910:14: use of undeclared identifier 'statusBarManager'
[11:04:05]: ▸         if ([statusBarManager respondsToSelector:@selector(createLocalStatusBar)]) {
[11:04:05]: ▸              ^
[11:04:05]: ▸ ** ARCHIVE FAILED **
[11:04:05]: ▸ The following build commands failed:
[11:04:05]: ▸   CompileC /Users/wanghq/Library/Developer/Xcode/DerivedData/Teacher_iOS-faqbabrkmkezsveufzeljjrkqytg/Build/Intermediates.noindex/ArchiveIntermediates/Teacher_iOS/IntermediateBuildFilesPath/Teacher_iOS.build/Debug-iphoneos/Teacher_iOS.build/Objects-normal/armv7/ZFPlayerView.o /Users/wanghq/jenkins_workspaces/workspace/mobile-ios-teacher-ipa/Teacher_iOS/Train/Record/Utils/ZFPlayer/ZFPlayerView.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
[11:04:05]: ▸ (1 failure)
[11:04:05]: ▸ ❌  /Users/wanghq/jenkins_workspaces/workspace/mobile-ios-teacher-ipa/Teacher_iOS/Train/Record/Utils/ZFPlayer/ZFPlayerView.m:911:40: use of undeclared identifier 'statusBarManager'

这是构建环境:

+---------------+-------------------------+
|            Build environment            |
+---------------+-------------------------+
| xcode_path    | /Applications/Xcode.app |
| gym_version   | 2.134.0                 |
| export_method | development             |
| sdk           | iPhoneOS12.2.sdk        |
+---------------+-------------------------+

请帮帮我,谢谢!

【问题讨论】:

    标签: ios13 fastlane


    【解决方案1】:

    您需要 Xcode 11 或更高版本才能使用 iOS 13 SDK。

    Fastlane 不能做任何底层构建系统不能做的事情。我想您会直接在 Xcode 10 中构建相同的错误。由于您正在调用 iOS 12.2 SDK 中不存在的部分 API,例如 UIStatusBarManager,因此编译器不知道该怎么做。

    更新 Xcode 并以 iOS 13(或 13.1)SDK 为目标。

    【讨论】:

      【解决方案2】:
      • 如果您的修改只是为 XCode 11 或 iOS 13 做准备,
      • 如果您的修改现在不需要在运行时激活,
      • 如果您现在还想继续使用 XCode 10.x 版本,

      那么您可以对有问题的代码段使用“编译器条件指令”。

      例如,我有 XCode 10.3,我可以通过以下修改编译项目。

      【讨论】:

      • 我已经将xcode更新到11.1版,所以问题已经解决了,但也谢谢你!
      猜你喜欢
      • 2019-10-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-10
      • 2012-05-27
      • 2013-09-16
      • 2020-04-02
      • 2022-12-30
      相关资源
      最近更新 更多