更改项目名称后 react-native run-ios 将不起作用

Posted

技术标签:

【中文标题】更改项目名称后 react-native run-ios 将不起作用【英文标题】:react-native run-ios won't work after changing projects name 【发布时间】:2017-09-17 19:53:09 【问题描述】:

我决定更改我的React Native 项目的名称,首先在主目录中将其更改为“AppName”,并去掉它以前的名称。

我还将ios 中的所有文件夹名称更改为AppName,并去掉了它以前的名称。

即使在index.ios.js 里面,我也去掉了它以前的名字。

但是,每当我运行 react-native run-ios 时,我都会收到以下错误:

Installing build/Build/Products/Debug-iphonesimulator/AppName.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

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier 
build/Build/Products/Debug-iphonesimulator/AppName.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

为什么会出现此错误?我知道这与更改我的项目名称有关。

【问题讨论】:

编辑你的包标识符。它必须与您的项目同名:com.myCompany.projectName 【参考方案1】:

要重命名 react native 项目,您应该使用 react-native-rename 因为手动重命名会破坏你的项目

【讨论】:

以上是关于更改项目名称后 react-native run-ios 将不起作用的主要内容,如果未能解决你的问题,请参考以下文章