0

I'm losing my mind on a problem since 1 entire week... I have a ReactNative project, that runs very well on Android Simulator, but not on Xcode.

  1. My code

Actually, I have in my package.json :

Package.json

...
"react": "15.4.2",
"react-native": "^0.40.0",
...
"react-native-onesignal": "^3.0.3",
...

I can run npm install or npm update without any error.

Furthermore, I have in my Podfile, for my iOS project, in the iOS folder:

Podfile

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'MyApp' do
    pod 'OneSignal'
end

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['SWIFT_VERSION'] = '3.0'
        end
    end
end

When I run pod install, it's working well and create the .xcworkspace file. When I open it, I can see the first error:

Error in finding file

So I have googled it, and found the react-native-onesignal repo on GitHub, with a recommendation from the developer about my problem: he says to correctly follow iOS installation steps. I have done it, by adding in Header Search Path this : $(SRCROOT)/../node_modules/react-native-onesignal/ios in recursive : Add header properly

Now, OneSignal.h is found, but I get a new error telling me that the library is duplicated: Error duplicate

For information, here is my library, my files, and my build phases:

Library in General

Library

Files in Xcode

Files

Build Phases

Build phases


  1. What I have tried

I have tried to:

  • delete the main.m, since it seems to be duplicated,
    • delete one copy of the library, in both library in General or Library in Build phases,
    • delete manually one copy in the files system in Xcode,
    • remove $(inherited) flag in Other Files Flag in my target Build Settings: the build succeeded, but my app is not working anymore ... I tried to remove other flags, but no results.

No solutions and I'm getting mad.

John
  • 226
  • 1
  • 3
  • 14

2 Answers2

1

Since version 0.40, react-native doesn't play along well with cocoapods. I had a similar fight for days, it got solved only when dropping cocoapods completely. But before giving up, try also deleting derived data folder which can be found at Xcode > File > Project Settings.

Simon
  • 138
  • 7
1

So, I solved my problem. In fact, my package.json was installing react-native-onesignal in version ^3.0.2, so 3.0.3 currently. Hence, since 3.0.3 has removed CocoaPods from process, it was not running... I put in package.json '3.0.2'. I will remove Cocoapods and use 3.0.3 later.

John
  • 226
  • 1
  • 3
  • 14