Ios 反应本机:包标识符不存在
我在React Native中有一个项目,它有两种不同的构建方案,并且使用CoCoapod。要编译它,我运行:Ios 反应本机:包标识符不存在,ios,react-native,cocoapods,xcode-project,xcodeproj,Ios,React Native,Cocoapods,Xcode Project,Xcodeproj,我在React Native中有一个项目,它有两种不同的构建方案,并且使用CoCoapod。要编译它,我运行: react-native run-ios --scheme="RNProject-(SCHEME_NAME)" 产生的应用程序包括: ./build/Build/Products/Debug/iphonesimulator/RNProject-customer1.app ./build/Build/Products/Debug/iphonesimulator/RNProject-cu
react-native run-ios --scheme="RNProject-(SCHEME_NAME)"
产生的应用程序包括:
./build/Build/Products/Debug/iphonesimulator/RNProject-customer1.app
./build/Build/Products/Debug/iphonesimulator/RNProject-customer2.app
- 使用命令it为其中一个构建方案构建,但不为另一个构建方案构建
- Xcode始终为两种构建方案构建项目
- 此外,该路径中存在
,并且该文件包含有效的build/build/Products/Debug iphonesimulator/RNProject-customer1.app/Info.plist
(它与两个构建方案中的每一个匹配CFBundleIdentifier
)General>Identity>Bundle Identifier
- 两个方案的项目设置似乎都是正确的(在检查了ios/RNProject.xcodeproj/Project.pbxproj之后)
- 特定于架构的设置位于
和ios/Pods/Target支持文件/Pods-RNProject-customer1
ios/Pods/Target支持文件/Pods-RNProject-customer2
- 运行
sudo react native
- 重新启动RN包装机
- 手动编辑
Info.plist
- 更改构建位置
** BUILD SUCCEEDED **
Installing build/Build/Products/Debug-iphonesimulator/RNProject.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
child_process.js:509
throw err;
^
Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/RNProject.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
at checkExecSyncError (child_process.js:486:13)
at Object.execFileSync (child_process.js:506:13)
at ChildProcess.xcodeBuildProcess.on.code (node_modules/react-native/local-cli/runIOS/runIOS.js:109:36)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:852:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
问题在于React本地名称如何标记可执行文件 我的Xcode项目根据Xcode项目设置创建了两个具有不同名称的可执行文件 另一方面,React-Native在此脚本中从
.xcworkspace
文件名形成可执行文件名(/node\u modules/React-Native/local cli/runIOS/runIOS.js:57
):
这两种方法不同,并导致两种不同的可执行文件名(例如,Xcodebuild/build/Products/Debug iphonesimulator/RNProject-customer1.app
vs React Nativebuild/build/Products/Debug iphonesimulator/RNProject.app
)
我已经为
InferedSchemeName
设置了自定义值,以匹配由Xcode创建的文件名。我的解决方案类似于:
const getBuildPath = function(configuration = 'Debug', appName, isDevice) {
return `build/Build/Products/${configuration}-${isDevice ? 'iphoneos' : 'iphonesimulator'}/${appName}.app`;
};
- 删除路径中的“Build”
const getBuildPath = function(configuration = 'Debug', appName, isDevice) {
return `build/Build/Products/${configuration}-${isDevice ? 'iphoneos' : 'iphonesimulator'}/${appName}.app`;
};
const getBuildPath = function(configuration = 'Debug', appName, isDevice) {
return `build/Build/Products/${configuration}-${isDevice ? 'iphoneos' : 'iphonesimulator'}/${appName}.app`;
};