2016-08-04 4 views
6

react-nativeを使用して作成したiOSモバイルアプリでこのエラー(以下の詳細エラー)が発生しました。これは、静的バンドルを使用してロードするOption 2を使用して電話機でアプリケーションを実行しようとした場合にのみ発生します。私が試してみました:リセットキャッシュと実行がパッケージャが NSInternalInconsistencyException:loadSourceForBridgeを実装していないときにbundleURLがnilでない必要があります

  • をアンインストールし、Windowsの背景から来る電話
  • 上のアプリは、私も私のマシンを再起動しようとした反応

    • クリーンとXcode
    • を再構築

    Xcodeのでエラーが発生しました

    2016-08-04 09:34:37.611 GalarmApp[367:165469] *** Assertion failure in 
    -[RCTBatchedBridge loadSource:](), /Users/abc/Projects/GalarmApp/node_modules/react-native/React/Base/RCTBatchedBridge.m:180 2016-08-04 09:34:37.613 GalarmApp[367:165469] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'bundleURL must be non-nil when not implementing loadSourceForBridge' 
    *** First throw call stack: (0x182b32db0 0x182197f80 0x182b32c80 0x1834b81c0 0x1000af788 0x1000adefc 0x1000adca4 0x1000e73d8 0x1000e7368 0x1000e6700 0x1000e643c 0x10005a254 0x10003cebc 0x10003c214 0x10003966c 0x100039b18 0x187d069c0 0x187f36184 0x187f3a5f0 0x187f37764 0x1844d37ac 0x1844d3618 0x1844d39c8 0x182ae909c 0x182ae8b30 0x182ae6830 0x182a10c50 0x187cff94c 0x187cfa088 0x10003bee0 0x1825ae8b8) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb) 
    

    この問題はコード内にhereと表示されていますが、私はネイティブiOS開発では初心者であり、この問題の修正方法はわかりません。

    この問題を解決するのに手伝ってください。ありがとう! AppDelegate.swiftで

    コードあなたが見ることができるように

    /** 
    * Loading JavaScript code - uncomment the one you want. 
    * 
    * OPTION 1 
    * Load from development server. Start the server from the repository root: 
    * 
    * $ npm start 
    * 
    * To run on device, change `localhost` to the IP address of your computer 
    * (you can get this by typing `ifconfig` into the terminal and selecting the 
    * `inet` value under `en0:`) and make sure your computer and iOS device are 
    * on the same Wi-Fi network. 
    */ 
    // let jsCodeLocation = NSURL(string: "http://localhost:8081/index.ios.bundle?platform=ios&dev=true") 
    
    
    /** 
    * OPTION 2 
    * Load from pre-bundled file on disk. The static bundle is automatically 
    * generated by "Bundle React Native code and images" build step. 
    */ 
    let jsCodeLocation = NSBundle.mainBundle().URLForResource("main", withExtension: "jsbundle") 
    

    ファイル、私はOption 1をコメントアウトし、「オプションを2`てコメント解除しています。私は100回のようにデバイス上でこの方法で同じアプリを実行しました。私はコードを変更していないが、突然私は上記のエラーを見始めた。

  • +0

    実際のデバイスでアプリケーションを実行している場合は、AppDelegate.mにバンドルURLを追加する必要があります。 – Sriraman

    +0

    @SriramanバンドルURLは、AppDelegateファイルに存在する必要があります。私はAppDelegateのコードに何も変更を加えていないし、何度も同じデバイスで同じコードを実行している。私はそれが必要なjsファイルを作成していないことをパッケージャと関係があると考えています。 –

    +1

    詳細については、この質問の回答を参照してくださいhttp://stackoverflow.com/questions/38780325/running-react-native-app-on-ios-device-using-offline-bundle/38780622#38780622 –

    答えて

    1

    アプリに正しく署名していない場合でも、このエラーが発生することがあります。 Xcodeの設定と警告を確認してください。

    3

    私はすぐに「doh」の瞬間を追加します。シミュレータを実行してこれを取得している場合は、アプリケーションの実行時にパッケージマネージャが実行されていることを確認してください。そうでなければ、これについて不平を言うかもしれません。

    0

    私の場合、問題の原因となるmy macのWebプロキシ設定を有効にします。 Webプロキシの設定を無効にすると、私の問題が解決されます。

    関連する問題