简体   繁体   English

为什么 iOS 会显示警告“此应用程序需要由开发人员更新才能在此版本的 iOS 上运行。” 对于我的反应原生应用程序?

[英]Why does iOS show an alert "This app needs to be updated by the developer to work on this version of iOS." for my react native app?

I've just built my React Native app for the first time, and after generating an .ipa and installing it on my device to test, I get an alert with title "MyApp - iOS" Needs To Be Updated and body This app needs to be updated by the developer to work on this version of iOS .我刚刚构建了我的 React Native 应用程序,在生成了一个.ipa并将其安装在我的设备上进行测试后,我收到一个标题为"MyApp - iOS" Needs To Be Updated和正文的警报This app needs to be updated by the developer to work on this version of iOS

In my ReactNative project I've set iOS target to be 10.0, and the iOS version on the phone is 14.2, so I don't understand why it doesn't work.在我的 ReactNative 项目中我将 iOS 目标设置为 10.0,而手机上的 iOS 版本是 14.2,所以我不明白为什么它不起作用。 I've struggled to find any helpful resources from googling around.我一直在努力从谷歌搜索中找到任何有用的资源。

The first reason, documented by Apple here , is that your IPA must use the new signature format. Apple 在此处记录的第一个原因是您的 IPA 必须使用新的签名格式。 If the IPA has been built with MacOS 10.14 or higher, it should be good.如果 IPA 是用 MacOS 10.14 或更高版本构建的,应该很好。 To ensure your IPA have the correct signature, use following steps:为确保您的 IPA 具有正确的签名,请使用以下步骤:

  • Rename MyApp.ipa to MyApp.zip and unzip (you'll get a Payload folder which contains MyApp.app)将 MyApp.ipa 重命名为 MyApp.zip 并解压缩(您将获得一个包含 MyApp.app 的 Payload 文件夹)

  • In Terminal, run codesign -dv /path/to/MyApp.app在终端中,运行 codesign -dv /path/to/MyApp.app

  • Look in the output the value next to CodeDirectory.在 output 中查看 CodeDirectory 旁边的值。 If you see v=20500 or v=20400, you're good.如果你看到 v=20500 或 v=20400,你很好。 If you see a value below 20400, you need to resign your app using following command: codesign -s "Your Codesign Identity" -f --preserve-metadata /path/to/MyApp.app (ensure you do this using MacOS >= 10.14, and re-run codesign -dv /path/to/MyApp.app to ensure you now get v=20400 or v=20500)如果您看到低于 20400 的值,则需要使用以下命令为您的应用程序签名:codesign -s "Your Codesign Identity" -f --preserve-metadata /path/to/MyApp.app(确保您使用 MacOS >= 执行此操作10.14,然后重新运行 codesign -dv /path/to/MyApp.app 以确保您现在得到 v=20400 或 v=20500)

Try reinstalling this IPA, it should work.尝试重新安装此 IPA,它应该可以工作。 If it doesn't, read the second reason below.如果没有,请阅读下面的第二个原因。

An other possible reason, not documented by Apple, a bit more tricky, is that you might need to re-sign your app including the DER entitlements.另一个可能的原因(Apple 未记录)有点棘手,即您可能需要重新签署您的应用程序,包括 DER 权利。 To check if you need to do this, do this:要检查您是否需要这样做,请执行以下操作:

  • In Terminal, run codesign -dvvvvv /path/to/MyApp.app在终端中,运行 codesign -dvvvvv /path/to/MyApp.app

  • Look in the output under Page size, you should see something like this:查看页面大小下的 output,您应该看到如下内容:

    -7=4ade7be00e0a7b6db853edc4843e7ece1eea646f6f13d1809f78fc50d8db461f //If this line doesn't exist or contains only 000..., you need to include DER entitlements -6=0000000000000000000000000000000000000000000000000000000000000000 -5=1dfa58bd8ac3c4fb42142c1c4d28c436128b3a7460186a44526194fb690112bc -4=0000000000000000000000000000000000000000000000000000000000000000 -3=ef08dbe5a7c355336e1fb571604b683ce1c54536cb59a6155a1d18387fd23f6e -2=5b730fa46ffd405fd88da9606d82eda9af7f460f6049047afc176163326f5a7f -7=4ade7be00e0a7b6db853edc4843e7ece1eea646f6f13d1809f78fc50d8db461f //If this line doesn't exist or contains only 000..., you need to include DER entitlements -6=0000000000000000000000000000000000000000000000000000000000000000 -5=1dfa58bd8ac3c4fb42142c1c4d28c436128b3a7460186a44526194fb690112bc -4=0000000000000000000000000000000000000000000000000000000000000000 -3=ef08dbe5a7c355336e1fb571604b683ce1c54536cb59a6155a1d18387fd23f6e -2=5b730fa46ffd405fd88da9606d82eda9af7f460f6049047afc176163326f5a7f

  • As commented in above block, if -7 isn't existent or if it only contains 000..., then that's the reason why the IPA doesn't install properly.如上块所述,如果 -7 不存在或仅包含 000...,那么这就是 IPA 无法正确安装的原因。 To fix this, follow next step要解决此问题,请执行下一步

  • Run codesign -s "Signing Identity Name from Keychain" -f --preserve-metadata --generate-entitlement-der /path/to/MyApp.app to resign your app including DER entitlements.运行 codesign -s "Signing Identity Name from Keychain" -f --preserve-metadata --generate-entitlement-der /path/to/MyApp.app 以退出您的应用程序,包括 DER 权利。 Re-run codesign -dvvvvv /path/to/MyApp.app to ensure the -7 value is now correct.重新运行 codesign -dvvvvv /path/to/MyApp.app 以确保 -7 值现在正确。

I had made a mistake in my "Excluded Architectures".我在“排除架构”中犯了一个错误。 I had set all Excluded Architectures to "arm64", when I should have only excluded arm64 for the simulator.我已将所有排除架构设置为“arm64”,而我应该只为模拟器排除 arm64。

These are the updated build settings that work:这些是有效的更新构建设置:

在此处输入图像描述

This is the code diff:这是代码差异:

- EXCLUDED_ARCHS = arm64;
+ "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;

Hopefully this is helpful for others.希望这对其他人有帮助。

I got solution and it's work for me.我得到了解决方案,它对我有用。 You can apply this and let me know if you have any problem.你可以申请这个,如果你有任何问题,请告诉我。

https://stackoverflow.com/a/70739263/5746176 https://stackoverflow.com/a/70739263/5746176

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我的 iOS 应用程序显示它需要“本地网络”权限? - Why does my iOS app show it needs "Local Network" permission? 可下载内容如何在iOS的本机应用程序中工作? - How does downloadable content work in a react-native app for iOS? CodePush 更新不适用于反应原生 iOS 应用程序 - CodePush update does not work with react native iOS app 为什么我的React Native桥接iOS组件不起作用? - Why does my React Native bridged iOS component not work? 更新到 iOS 14.5 后“需要更新应用程序” - 'app needs to be updated' after updating to iOS 14.5 iOS 15 测试版设备 - 应用程序需要更新 - iOS 15 beta device - app needs to be updated --ionic2 rc0—如何在ios中显示控制台日志。 我的应用程序在device.not模拟器上移动 - --ionic2 rc0— How to show consolelog in ios. my app move on device.not emulator React Native IOS 应用程序构建,无需注册开发人员计划 - React Native IOS app build without Enrolling for Developer Program 如何在ios上保持警惕冻结react-native app? - How to keep alert from freezing react-native app on ios? 如何为 iOS 应用程序 React-Native 配置最低应用程序版本 - How to configure a minimum app version for an iOS app React-Native
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM