Skip to content
This repository has been archived by the owner on Feb 4, 2021. It is now read-only.

How to install to iOS #12

Closed
noymer opened this issue Jan 30, 2018 · 6 comments
Closed

How to install to iOS #12

noymer opened this issue Jan 30, 2018 · 6 comments
Labels

Comments

@noymer
Copy link

noymer commented Jan 30, 2018

I have tried to install react-native-td, but build is failed.
The failed repo is https://github.com/noymer/RNTreasureDataExample
How to install it?

questions

  1. Isn't pod install is necessary?

  2. Could you write down installation process, like

yarn add react-native-td
react-native link react-native-td
cd ios
pod init
...
  1. Where is the mistake in my procedure how I did below?

how I did

Below is how I did in the repo.

$ react-native -v
react-native-cli: 2.0.1
react-native: n/a - not inside a React Native project directory
$ react-native init RNTreasureDataExample --version react-native@0.52.2
$ cd RNTreasureDataExample

$ yarn add react-native-td
$ react-native link react-native-td
$ pod init

# edit podfile
vim ios/Podfile 

In this timing code is: noymer/RNTreasureDataExample@088b748
And build was failed.

$ ./node_modules/.bin/react-native run-ios

...
{...}/RNTreasureDataExample/node_modules/react-native-td/ios/RNTreasureData.m:3:9: fatal error: 'TreasureData-iOS-SDK/TreasureData.h' file not found
#import <TreasureData-iOS-SDK/TreasureData.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.



** BUILD FAILED **



The following build commands failed:
    CompileC {...}/RNTreasureDataExample/ios/build/Build/Intermediates.noindex/RNTreasureData.build/Debug-iphonesimulator/RNTreasureData.build/Objects-normal/x86_64/RNTreasureData.o RNTreasureData.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

Installing build/Build/Products/Debug-iphonesimulator/RNTreasureDataExample.app
Launching org.reactjs.native.example.RNTreasureDataExample
org.reactjs.native.example.RNTreasureDataExample: 99610

I tried pod install

$ cd ios
$ pod install

In this timing code is: noymer/RNTreasureDataExample@af86d97
But build failed again.

$ cd ../
$  ./node_modules/.bin/react-native run-ios

...

** BUILD FAILED **



The following build commands failed:
    CompileC {...}/RNTreasureDataExample/ios/build/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React.build/Objects-normal/x86_64/RCTDevSettings.o {...}/RNTreasureDataExample/node_modules/react-native/React/Modules/RCTDevSettings.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

Installing build/Build/Products/Debug-iphonesimulator/RNTreasureDataExample.app
Launching org.reactjs.native.example.RNTreasureDataExample
org.reactjs.native.example.RNTreasureDataExample: 518

When I opened the workspace in xcode and tried to build, failed again.

image

@hotchemi
Copy link
Contributor

@noymer Thx for your dedicated info! We'll check your example later and could you possibly check the following points?

  • Does the sample work on Android?
  • Can you try to re-install dependencies as the following order?
    • yarn add react-native-td
    • cd ios
    • pod init
    • (edit podfile)
    • pod install
    • react-native link react-native-td

@noymer
Copy link
Author

noymer commented Jan 30, 2018

@hotchemi Thank you quick response!

On Android, the sample works.
(except DuplicateFileException, but it doesn't matter in this issue)

I will try re-install.

@noymer
Copy link
Author

noymer commented Jan 30, 2018

Can you try to re-install dependencies as the following order?
yarn add react-native-td
cd ios
pod init
(edit podfile)
pod install
react-native link react-native-td

Unfortunatelly, even if I re-installed,
build is failed with the same error.

The re-installed code is:
https://github.com/noymer/RNTreasureDataExample/tree/d0b0903901716bdaa942cb0b4e8e8cae3167a3ab

@noymer
Copy link
Author

noymer commented Feb 8, 2018

Hi,

After some searching, I found this issue.
facebook/react-native#17799

I modified code like this,

pod 'React', path: '../node_modules/react-native', subspecs: [
    'DevSupport'
    ]

and both android and iOS builds succeeded!

The build suceeded code is:
https://github.com/noymer/RNTreasureDataExample/tree/485c49b31f579f7bf1b8b315d12ac32e2df3c914

@hotchemi
Copy link
Contributor

hotchemi commented Feb 8, 2018

@noymer Ooh thx for the investigation 🙇
I'd say we should modify example code and readme like below to align RN official guide 🙇
Thank you for your dedicated work~!

  # Your 'node_modules' directory is probably in the root of your project,
  # but if not, adjust the `:path` accordingly
  pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'Core',
    'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
    'RCTText',
    'RCTNetwork',
    'RCTWebSocket', # needed for debugging
    # Add any other subspecs you want to use in your project
  ]
  # Explicitly include Yoga if you are using RN >= 0.42.0
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

@hotchemi
Copy link
Contributor

Addressed, thx guys!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants