簡體   English   中英

React Native:捆綁包標識符不存在

[英]React Native: Bundle Identifier does not exist

我在React Native中有一個項目,該項目具有兩個不同的構建方案並使用cocoapods。 要編譯它,我運行:

react-native run-ios --scheme="RNProject-(SCHEME_NAME)"

生成的應用程序例如:

./build/Build/Products/Debug/iphonesimulator/RNProject-customer1.app
./build/Build/Products/Debug/iphonesimulator/RNProject-customer2.app
  • 使用命令為一個構建方案構建,但不為另一個構建方案構建
  • Xcode始終為兩種構建方案都構建項目
  • 此外,該路徑build/Build/Products/Debug-iphonesimulator/RNProject-customer1.app/Info.plist存在build/Build/Products/Debug-iphonesimulator/RNProject-customer1.app/Info.plist ,並且該文件包含有效的CFBundleIdentifier (對於這兩個構建方案中的每一個,它都與General > Identity > Bundle Identifier匹配)
  • 這兩種方案的項目設置似乎都是正確的(檢查ios/RNProject.xcodeproj/project.pbxproj
  • 特定於架構的設置位於ios/Pods/Target Support Files/Pods-RNProject-customer1ios/Pods/Target Support Files/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 Native名稱如何標記可執行文件。

我的Xcode項目基於Xcode項目設置創建了兩個名稱不同的可執行文件。

另一方面,React Native在此腳本中從.xcworkspace文件名形成可執行文件名( ./node_modules/react-native/local-cli/runIOS/runIOS.js:57 ):

const inferredSchemeName = path.basename(xcodeProject.name, path.extname(xcodeProject.name));

這兩種方法是不同的,並導致兩個不同的可執行文件名(例如Xcode build/Build/Products/Debug-iphonesimulator/RNProject-customer1.app與React Native build/Build/Products/Debug-iphonesimulator/RNProject.app )。

我已經為inferredSchemeName設置了自定義值,以匹配Xcode創建的文件名。

我的解決方案是類似的:

  1. 打開./node_modules/react-native/local-cli/runIOS.js文件
  2. 從以下位置更改構建路徑:

     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`;
    };
  • 刪除路徑中的“構建”。

我正在使用Xcode-beta 8.2

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM