ReactNative 0.63.2
项目它在模拟器上运行,在物理设备上运行。决定现在就开始排毒。
在运行示例测试时,我遇到了以下错误:
Error: field CFBundleIdentifier not found inside Info.plist of app binary at /Users/jesus/Documents/projects/appname/ios/build/Build/Products/Debug-iphonesimulator/Appname.app
在我的Info.plist
中:
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
我的.detoxrc.json
:
{
"testRunner": "jest",
"runnerConfig": "e2e/config.json",
"configurations": {
"ios": {
"type": "ios.simulator",
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/Appname.app",
"build": "xcodebuild -project ios/Appname.xcodeproj -scheme Appname -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
"device": {
"type": "iPhone 11"
}
},
"android": {
"type": "android.emulator",
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
"build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
"device": {
"avdName": "Pixel_API_28_AOSP"
}
}
}
}
我检查了在Xcode> General中设置了一个Bundle Identifier。在Build Settings> Packaging下还有一个字段,其中正确设置了app.appname
。
3条答案
按热度按时间bwntbbo31#
这与排毒无关。
检查.app包中的Info.plist(而不是源代码中的Info.plist)。很可能,你的包坏了。iOS要求每个应用程序都有一个有效的捆绑包标识符。
PRODUCT_BUNDLE_IDENTIFIER
可能没有在Xcode构建设置中正确定义。ttp71kqs2#
我也有同样的问题。
我在构建时遇到了问题,并通过复制粘贴react native在运行react-native run-ios时使用的命令来解决它们,该命令具有
-destination id="{MyprojectID}"
在这样做时,我删除了-derivedDataPath iOS/build,我通过再次添加此命令以及-sdk iphonesimulator来解决它,我的构建命令如下所示:8gsdolmq3#
我有同样的问题,我的问题是,我试图测试错误的.app文件。您不能只测试使用正确配置生成的.app文件。您不能使用使用adhoc证书或npx react-native run-ios或从Xcode构建创建的.app文件。你必须使用detox build命令来生成.app文件和你必须给予的.app文件路径。此外,调试配置的.app将不适用于发布配置,反之亦然