首页 > 解决方案 > Expo iOS 构建在初始屏幕上崩溃

问题描述

我使用 Expo 和 React Native 开发了一个应用程序。该应用程序在开发过程中使用 Expo Go 应用程序运行良好,我在 Android 和 iOS 上进行了测试。

然后我使用 expo build 构建了每个应用程序。生产的 Android 应用程序运行良好,但 iOS 应用程序在启动闪屏后的几秒钟内崩溃,无论是在真实设备上还是在我运行模拟器构建时。我将 iOS 应用程序构建为存档,它目前处于试飞阶段。我能够将以前的版本部署到应用商店而没有崩溃。

我下载了崩溃日志,最后一个异常参考是:

UIKitCore: -[UIApplication _checkBackgroundRefreshAPIAdoption]

我在任何地方都找不到对 checkBackgroundRefreshAPIAdoption 的引用。我所做的最后一个重大更改是添加 MapView 功能,但我也尝试删除对 MapView 的所有引用并重新构建,但仍然遇到同样的问题。

编辑:忘了补充,我确实按照此处https://docs.expo.dev/versions/latest/sdk/map-view/部署独立iOS应用程序的说明进行操作

有谁知道是什么问题?

标签: iosreact-nativeexpo

解决方案


I ended up figuring this one out myself. It had nothing to do with the maps api as I thought.

It was actually part of notifications. When I had added notifications to the app I added the UIBackgroundModes property to the infoPlist object under ios in my app.json file. I had put this in as a string but this property needs to be an array of strings.

Here is what I had before: "infoPlist": {"UIBackgroundModes": "remote-notification"}

And this is what I changed it to: "infoPlist": {"UIBackgroundModes": ["remote-notification"]}

The app now loads normally.

Here is the full relevant part of app.json file:

{"expo": { "ios": { "infoPlist": { "UIBackgroundModes": ["remote-notification"] } } } }

推荐阅读