万年素人からHackerへの道

万年素人がHackerになれるまで殴り書きするぜ。

  • ・資産運用おすすめ
    10万円は1000円くらい利益
    資産運用ブログ アセマネ
    • ・寄付お願いします
      YENTEN:YYzNPzdsZWqr5THWAdMrKDj7GT8ietDc2W
      BitZenny:ZfpUbVya8MWQkjjGJMjA7P9pPkqaLnwPWH
      c0ban:8KG95GXdEquNpPW8xJAJf7nn5kbimQ5wj1
      Skycoin:KMqcn7x8REwwzMHPi9fV9fbNwdofYAWKRo

    watchmanキャッシュ消す ReactNativeのめんどいiosでのエラー、Admob追加などした

    npm run ejectで吐き出されたiOSXcodeのプロジェクトを実行。

    f:id:shinriyo:20180917084911p:plain

    なんかのタイミングでpackage.jsonが変わった babel-preset-react-nativeを4.0入れようと npm install babel-preset-react-nativeしたせいか??

    "babel-preset-react-native": "^4.0.1",

    これがdiff

       "scripts": {
    -    "start": "react-native-scripts-ts start",
    -    "eject": "react-native-scripts-ts eject",
    -    "android": "react-native-scripts-ts android",
    -    "ios": "react-native-scripts-ts ios",
    +    "start": "react-native start",
    +    "android": "react-native run-android",
    +    "ios": "react-native run-ios",
         "test": "jest"
       },

    これのせいかnpm ejectせずにiosフォルダができるようになった?? "eject": "react-native-scripts-ts eject",も消されたし。

    Xcodeでも似たエラー出たので

    Failed to load bundle(http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false) with error:(Unable to resolve module `react-native-vector-icons/MaterialIcons` from `/Users/shinriyo/development/react_apps/kazoemon/node_modules/react-native-elements/src/buttons/Button.js`: Module `react-native-vector-icons/MaterialIcons` does not exist in the Haste module map
    
    This might be related to https://github.com/facebook/react-native/issues/4968
    To resolve try the following:
      1. Clear watchman watches: `watchman watch-del-all`.
      2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
      3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.  4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`. (null))
    

    この変なエラー

    これがIssue https://github.com/facebook/react-native/issues/4968

    watchman watch-del-all && rm -rf node_modules/ && yarn cache clean && yarn install && yarn start -- --reset-cache

    gist.github.com

    しかし直らん。 run-iosした時にPrint: Entry, ":CFBundleIdentifier"も出たり・・・・。 Xcode上で`ios/RNAdMobRewarded.h:9:9: Module 'GoogleMobileAds' not found出たり・・・・

    react-native linkもする

    Scanning folders for symlinks in /Users/shinriyo/development/react_apps/kazoemon/node_modules (14ms)
    rnpm-install info Platform 'ios' module react-native-admob
    cd ios
    pod init

    Podfileも編集 target 'kazoemon' doの他にもTVなんとかあったのは消した。 あると重複のエラー出るので。

    あと、

      pod 'Firebase'
      pod 'Firebase/Core'
      pod 'Firebase/AdMob'

    も追加した。 pod 'GoogleMobileAds'は追加すると競合するっぽいのでそっちは消した。

    # Uncomment the next line to define a global platform for your project
    # platform :ios, '9.0'
    
    target 'kazoemon' do
      # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
      # use_frameworks!
    
      # Pods for kazoemon
      pod 'Firebase'
      pod 'Firebase/Core'
      pod 'Firebase/AdMob'
    
      target 'kazoemonTests' do
        inherit! :search_paths
        # Pods for testing
      end
    
    end

    あと、間違えてはならないのが青い.xcodeprojではなく白い.xcworkspaceっぽい。 f:id:shinriyo:20180917112117p:plain

    さらにreact-native-elementsっての使ってそのエラーも出てる?? https://github.com/react-native-training/react-native-elements/issues/704

    見た

    npm i --save react-native-vector-icons