react-native開発開始FAQ(継続更新)

3816 ワード

react-native開発開始FAQ(継続更新)


1. debug error: make directory ... File exists

error: make directory /Users/mobilewise/Library/Developer/Xcode/DerivedData/MCDM-epoyegaizqaljifbmfuxvovvwxqn/Build/Products/Debug-iphoneos/MCDM_guangzhoudianwang.app/mapapi.bundle/images: File exists
error: couldn't remove '/Users/mobilewise/Library/Developer/Xcode/DerivedData/MCDM-epoyegaizqaljifbmfuxvovvwxqn/Build/Products/Debug-iphoneos/MCDM_guangzhoudianwang.app/mapapi.bundle' after command failed: Directory not empty

ソリューション:`Build Phases----->>Copy Bundle Resources、余分なファイルを削除すればいい.`,パッケージ化されてディレクトリに格納されているファイルが不足しているなど、新しいフォルダを作成すればよい.

2.iOS開発Build operation failed without specifying any errors問題fix


xcodeエラーは以下の通りです.
verify final result code for completed build operation
Build operation failed without specifying any errors. Individual build tasks may have failed for unknown reasons.
One possible cause is if there are too many (possibly zombie) processes; in this case, rebooting may fix the problem.
Some individual build task failures (up to 12) may be listed below.

ソリューションは次のとおりです.cocoapodsバージョンのため、再インストールできます.
// 1.4.0 
sudo gem uninstall cocoapods -v 1.4.0

// Cocoapods
sudo gem install cocoapods -v 1.3.1

// 
pod --version

参考記事-掘金

3.項目住所変更後に問題が発生

Argument list too long: recursive header expansion failed at ソリューション:Build Settings->User Header Search Pathsコンテンツの削除

4.Androidパッケージエラー

':app:bundleReleaseJsAndAssets FAILED'ソリューション:./gradlew assembleRelease -x bundleReleaseJsAndAssets

5.Androidパッケージエラー

Execution failed for task ':app:transformClassesAndResourcesWithProguardForReleaseソリューション:add the below to your ProGuard rules`-ignorewarnings
-keep class * {
public private *;

}`https://stackoverflow.com/que...

6.アンドロイドシミュレータdebbugerエラー

CORS issue with JS Remote Debugging when using xip.io解決策https://github.com/facebook/react-native/issues/17618

7.Android webviewでデータを返すことができない

react native android webview onmessage not workingソリューション:
//  1
if (window.postMessage.length !== 1) {
  window.postMessage = function(msg) {
    setTimeout(function () {
      console.log('window.postMessage not ready')
      window.postMessage(msg);
    }, 500);
  }
}
//  2
function waitForBridge() {

   //the react native postMessage has only 1 parameter
   //while the default one has 2, so check the signature
   //of the function

   if (window.postMessage.length !== 1){
     setTimeout(waitForBridge, 200);
   }
   else {
     window.postMessage('abc');
   }
}

window.onload = waitForBridge;

リファレンス
https://github.com/facebook/r...
https://stackoverflow.com/que...

8.Xcode 10のいくつかのエラー


エラー:third-party: 'config.h' file not foundhttps://github.com/facebook/r...
エラー:'config.h' file not foundhttps://github.com/facebook/r...
エラー: libfishhook.a cannot be foundhttps://github.com/facebook/r...
エラー:`React/RCTBridgeModule.h file not found`
https://stackoverflow.com/que...

9.iOSコンパイルエラーduplicate symbol_OBJC_CLASS_$_RCTFrameAnimation


dfile:参照:https://github.com/auth0/reac...

10.ios起動エラー


The request was denied by service delegate (SBMainWorkspace) for reason: Security ("Entitlement "com.apple.frontboard.debugapplications"required to launch applications for debugging").ソリューション:/Users/xx/リポジトリ/Developer/CoreSimulator/Devices/リファレンス:https://www.jianshu.com/p/133...