Viro: Cannot upgrade to v2.3.0 because of use-frameworks!

Created on 18 Jan 2018  路  11Comments  路  Source: viromedia/viro

Hi! Great to see a new version has been released.

I have followed the upgrade instructions in your release notes. I have however not added the use_frameworks! line to my Podfile, because this breaks other dependencies.

But installing without the use_frameworks! line does not work either. The console shows the message /Frameworks/ViroKit.framework/ViroKit | Reason: image not found

Is there another way of upgrading? Any tips?

Most helpful comment

Ok, so this was not easy at all.

Adding use_frameworks! is out of the question. Not only Firebase breaks, but also Fabric and Crashlytics. Also, yoga has a bug... https://github.com/facebook/react-native/issues/17274#issuecomment-356349187

Adding the dependency frameworks manually works. For instance following this procedure for AWS: https://github.com/aws/aws-sdk-ios#frameworks. But then it breaks for another dependency, of course... (GTMSessionFetcher.framework). Adding all the dependencies manually is not really a solution.

I hope you can provide ViroReact as a static dependency that does not depend on use_frameworks!. I am sure this is a breaking change for many of your users. We will postpone upgrade for now.

All 11 comments

Hi @draperunner,

You can try including the framework into your project manually, it's located at node_modules/react-viro/ios/dist/ViroRenderer/ViroKit.framework.

I'd be interested to see if that works for you, or if you'll need to somehow manually link all its dependencies too.

Thanks,

You're right. Manual linking did not work. It fails because of the AWS dependencies: Library not loaded: @rpath/AWSCore.framework/AWSCore.

We will try and make use of use_frameworks! and instead fix the dependency that fails in that case (just Firebase, it seems).

Ok, so this was not easy at all.

Adding use_frameworks! is out of the question. Not only Firebase breaks, but also Fabric and Crashlytics. Also, yoga has a bug... https://github.com/facebook/react-native/issues/17274#issuecomment-356349187

Adding the dependency frameworks manually works. For instance following this procedure for AWS: https://github.com/aws/aws-sdk-ios#frameworks. But then it breaks for another dependency, of course... (GTMSessionFetcher.framework). Adding all the dependencies manually is not really a solution.

I hope you can provide ViroReact as a static dependency that does not depend on use_frameworks!. I am sure this is a breaking change for many of your users. We will postpone upgrade for now.

Hi guys, and thanks for a great library! This is however a major issue for us, we cannot proceed with upgrading at this point.. Is there a workaround for us that cannot use_frameworks ?

Hi @draperunner,

The reason we moved to use_frameworks! was because another user had a dependency on the AWS Libraries and in our past implementation of providing a static library, they would get issues due the fact that they would be compiling against the AWS library twice (once in our library and again in their own). With use_frameworks! all the dependencies are now linked in the developer's Podfile and they can then manage the dependencies on their own.

I am curious as to why Firebase, Fabric and Crashlytics break for you. Our testbed and internal apps use both Fabric & Crashlytics libraries alongside our new update. Maybe we can see if we can fix the issue with using frameworks here.

If we can't, then we'll look into alternatives for our next release.

Thanks,

React-native does not seem to support this very well. As you can see from this (https://github.com/facebook/react-native/issues/16039) issue, if you build with use_frameworks they've had this problem for a long time without anyone fixing it.

A simple react-native project can be built (0.51.0), but only if we add (to package.json):

scripts: {
     ...
    "postinstall": "sed -i '' 's/#import <RCTAnimation\\/RCTValueAnimatedNode.h>/#import <React\\/RCTValueAnimatedNode.h>/' ./node_modules/react-native/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h; sed -i '' 's/#import <fishhook\\/fishhook.h>/#import <React\\/fishhook.h>/' ./node_modules/react-native/Libraries/WebSocket/RCTReconnectingWebSocket.m"
}

I've also tried to downgrade react-native, but each version has different issues.

For Firebase it's mostly using this (https://rnfirebase.io/docs/v3.2.x/installation/ios) framework for sending events from javascript that's causing the problem (see the top-most information box about use_frameworks). This can also be fixed by reading the latest release notes where they now say they suppport use_frameworks, but only if we remove react-native-firebase from the Podfile.

In our case its now Mapbox thats the issue. They also have an open issue about their framework not supporting use_frameworks (https://github.com/mapbox/react-native-mapbox-gl/issues/965
). I've tried to add the library manually, but then there are other issues.. Will dig more into that.

Hi @KimAM,

Thanks for the updates on the progress you guys are making.

Let me see if I understand your status:

For React Native, there's an erroneous import on their part which can be fixed by adding a postinstall step to your package.json.

It sounds like for your Firebase dependency, you need to remove react-native-firebase from the Podfile and link it to your project via react-native link.

In the case of react-native-mapbox they needed to update their Pods .spec file to declare a dependency on React.

Those sound like issues that prevent those projects from working 100% with CocoaPods.

--

I am curious why your project has a CocoaPods dependency on React Native to start. From what we can tell, if you run react-native init ProjectName it creates a React Native project without the need for CocoaPods at all (by linking the source code directly into the xcodeproj itself).

Keep us updated and let us know if you need any help,

It was a choice a while back ago to move all dependencies to Cocoapods (including react-native). But we took the step today to link react-native manually into xcodeproj, s氓 all is working fine now :-) You can just close the issue!

Hi @KimAM,

That's great to hear! Glad you got it working.

Let us know if you have any other issues!

@KimAM can you elaborate a bit on how you linked react-native manually to fix this issue? Does that mean you were able to continue using use_frameworks!

Sure!

In short we moved all of the React Native depedendencies (and React Native itself) from the Podfile. They are not added via Cocoapods by default when creating a new project, so we're basically back to the standard way of manually linking react native and all its dependencies. Our Podfile looks like this now:

platform :ios, '9.3'
modules_path = '../../../node_modules'
react_native_path = modules_path + '/react-native'

target 'clients' do
  use_frameworks!

  pod 'Fabric'
  pod 'Crashlytics'
  pod 'Firebase/Analytics'

  pod 'ViroReact', :path => modules_path + '/react-viro/ios/'
  pod 'ViroKit', :path => modules_path + '/react-viro/ios/dist/ViroRenderer/'

end 
Was this page helpful?
0 / 5 - 0 ratings

Related issues

yabeow picture yabeow  路  4Comments

WillGeller picture WillGeller  路  3Comments

funkyfourier picture funkyfourier  路  3Comments

dittmarconsulting picture dittmarconsulting  路  6Comments

vuthanhtrung0504 picture vuthanhtrung0504  路  5Comments