gpt4 book ai didi

ios - 我的 NotificationServiceExtension Info.plist 文件中的 Flutter/iOS : How can I use pubspec. yaml 的 App 版本?

转载 作者:行者123 更新时间:2023-12-05 02:45:33 25 4
gpt4 key购买 nike

pubspec.yaml 中的 Flutter App 版本可以通过将条目更改为在常规 iOS Info.plist 文件中使用

<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>

<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>

不过,我已经创建了一个通知服务扩展来启用 FCM 富文本推送通知,它运行良好。但是当我将此扩展的 Info.plist 值更改为与上面相同的值时,应用程序失败并出现以下构建错误:

Unable to install /Users/pa/development/FlutterApps/myApp/build/ios/iphonesimulator/Runner.app on <ID>. This is sometimes caused by a malformed plist file:
ProcessException: Process exited abnormally:
An error was encountered processing the command (domain=IXErrorDomain, code=2):
Failed to create plugin placeholder for /Users/pa/development/FlutterApps/myApp/build/ios/iphonesimulator/Runner.app/PlugIns/NotificationService.appex
Failed to create promise.
Underlying error (domain=IXErrorDomain, code=2):
Failed to set placeholder attributes com.mycompany.appid.NotificationService
Failed to create promise.
Command: xcrun simctl install <ID> /Users/pa/development/FlutterApps/myApp/build/ios/iphonesimulator/Runner.app
Error launching application on iPhone 11 Pro.

如何在 Extensions Info.plist 文件中也使用相同的变量?我认为这只是一些配置,但我无法弄明白。

谢谢!!

最佳答案

Flutter 生成一个 xcconfig 文件,其中包含 FLUTTER_BUILD_NAMEFLUTTER_BUILD_NUMBER 等变量

要在扩展中使用这些变量,我们需要执行以下操作:

  1. 转到您的扩展Info.plist 并添加这些变量。 Like this

Bundle 版本字符串 -- $(FLUTTER_BUILD_NAME)

捆绑版本 -- $(FLUTTER_BUILD_NUMBER)

  1. 转到您的项目设置并为每个配置的扩展选择一个生成的配置文件。 Like this

关于ios - 我的 NotificationServiceExtension Info.plist 文件中的 Flutter/iOS : How can I use pubspec. yaml 的 App 版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65959068/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com