如何在不使用 Storyboard 的情况下将 Google Maps Platform SDK for iOS 与 Xcode 项目一起使用?

How to use Google Maps Platform SDK for iOS with Xcode project without using storyboard?

我正在使用 Google Maps Platform 使用 Swift 尝试我的第一个 Xcode iOS 项目。我在 Get Started in documentation 进行了第 5 步 我在创建 Xcode 单视图项目时没有选择不使用故事板,所以我删除了 Main.storyboard 文件和 Info.plist "Main storyboard base name" 设置和目标中的 "Main Interface" 设置。我找不到启用 ARC 的方法。我相信它是自动启用的。

我只在运行 iPad Pro(12.9 英寸)(第 3 代)模拟器中的项目时出现黑屏。

当我将设置重新设置为使用 Main.storyboard 时,它工作正常。这是怎么回事?这是糟糕的文档吗?我想确保我按照说明进行操作,这样我以后就不会 运行 遇到问题。

您出现黑屏是因为在您停止使用故事板后,您的应用感到困惑并且不知道要加载的初始屏幕是什么(故事板中有箭头的那个)。 您可以在 AppDelegate

中以编程方式设置它
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

    let rootViewController = YourInitialViewController()
    window = UIWindow(frame: UIScreen.main.bounds)
    window?.rootViewController = rootViewController
    window?.makeKeyAndVisible()

    return true
}