LoginSignup
9
3

More than 3 years have passed since last update.

Xcode 11でReact Nativeアプリが起動しなくなった場合の対処法

Last updated at Posted at 2019-09-30

Xcode 11に更新後、既存のReact Nativeアプリが実行時エラーで起動しなくなりましたが、以下の方法で対処して起動できました。

Xcodeから実行して、実行時エラーが出た場合 (1)

以下の実行時エラーが出た場合の対応を記します。

Synchronous remote object proxy returned error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.commcenter.coretelephony.xpc was invalidated."

以下のコマンドで、シミュレータの設定をしてください。

xcrun simctl spawn booted log config --mode "level:off"  --subsystem com.apple.CoreTelephony

情報源はこちら。

Xcodeから実行して、実行時エラーが出た場合 (2)

以下の実行時エラーが出た場合の対応を記します。

[error][tid:main][RCTModuleMethod.mm:375] Unknown argument type '__attribute__' in method -[RCTAppState getCurrentAppState:error:]. Extend RCTConvert to support this type.

react-nativeを0.59.9以上に更新してください。

react-nativeを更新したくない場合は、node_modules/react-native/React/Base/RCTModuleMethod.mmを直接書き換えてください。(公式リポジトリでの修正はこちら

static BOOL RCTParseUnused(const char **input)
{
  return RCTReadString(input, "__attribute__((unused))") ||
         RCTReadString(input, "__attribute__((__unused__))") || // この行を追加
         RCTReadString(input, "__unused");
}

情報源はこちら。

react-native コマンドからシミュレータを起動できない場合

例えば以下のように、シミュレータを起動できなかった場合の対応を記します。

$ react-native run-ios --simulator "iPad (5th generation)"
Found Xcode project YourProject.xcodeproj
CoreData: annotation:  Failed to load optimized model at path '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/Frameworks/InstrumentsPackaging.framework/Versions/A/Resources/XRPackageModel.momd/XRPackageModel 9.0.omo'

Could not find iPad (5th generation) simulator

Error: Could not find iPad (5th generation) simulator
    at resolve (/Users/YourName/Documents/YourProject/node_modules/react-native/local-cli/runIOS/runIOS.js:149:13)
    at new Promise (<anonymous>)
    at runOnSimulator (/Users/YourName/Documents/YourProject/node_modules/react-native/local-cli/runIOS/runIOS.js:134:10)
    at Object.runIOS [as func] (/Users/YourName/Documents/YourProject/node_modules/react-native/local-cli/runIOS/runIOS.js:106:12)
    at Promise.resolve.then (/Users/YourName/Documents/YourProject/node_modules/react-native/local-cli/cliEntry.js:117:22)

node_modules/react-native/local-cli/runIOS/findMatchingSimulator.jsfunction findMatchingSimulator(simulators, simulatorString)内を、以下のように修正してください。

    if (!version.startsWith('com.apple.CoreSimulator.SimRuntime.iOS') && !version.startsWith('com.apple.CoreSimulator.SimRuntime.tvOS')) {
//  if (!version.startsWith('iOS') && !version.startsWith('tvOS')) { この行を修正

情報源はこちら

        simulator.isAvailable !== true
//      simulator.isAvailable !== 'YES' この行を修正

情報源はこちら

9
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
3