Git Product home page Git Product logo

Comments (14)

brod-ie avatar brod-ie commented on May 21, 2024 4

Good news, you can get MMKV working with use_framework! if you utilise Microsoft's CocoaPods Pod Linkage plugin.

You'll need to follow their setup instructions and then modify this project's Podspec to include :linkage => :dynamic as in my fork.

Then install via bundle exec pod install.

@mrousavy I believe this linkage flag I added to the Podspec won't affect pod installations that don't use the cocoapods-pod-linkage extension (I tested by commenting out the plugin inclusion in my Podfile, deintegrated and reinstalled with no installation errors).

Update: Even simpler, you don't need to edit the Podspec of this library, you can just default the linkage to static in your target:

use_frameworks! :linkage => :static

This will then use static libraries for MMKV whilst still using frameworks for Swift pods that require them 🎉

from react-native-mmkv.

kanzitelli avatar kanzitelli commented on May 21, 2024 2

@oferRounds yes, unfortunately. I could only make my project run by removing react-native-mmkv and using regular AsyncStorage :(

as I understand, react-native-mmkv is based on JSI which is getting broken after using use_framework!. Also it was breaking some Pods which had s.dependency 'React' in .podspec file. But it has to be s.dependency 'React-Core'.

from react-native-mmkv.

oferRounds avatar oferRounds commented on May 21, 2024

Perhaps it’s due to the fact my pod file includes use_frameworks!?

from react-native-mmkv.

mrousavy avatar mrousavy commented on May 21, 2024

Are you using Apple Silicone (M1 chip)? Can you build the example app?

from react-native-mmkv.

oferRounds avatar oferRounds commented on May 21, 2024

Ahmmm, yes, I use the Apple Silicone (M1 chip), can this be related?

from react-native-mmkv.

kanzitelli avatar kanzitelli commented on May 21, 2024

hey guys @oferRounds @mrousavy

I started getting this error when I turned hermes engine off in Pods.

Screenshot 2021-06-25 at 03 46 52

And also, I couldn't make the project run when I was using use_frameworks! and hermes engine on. Some libraries, like @react-native-community/netinfo and react-native-fbsdk-next, couldn't import hermes.h and something like that. If anybody knows why it happens could you share an explanation? 😅

"react-native": "^0.64.2"
"react-native-mmkv": "^1.1.6"

from react-native-mmkv.

oferRounds avatar oferRounds commented on May 21, 2024

Hi @kanzitelli, thanks for this! I actually still on react-native 0.63, so hermes is not available for me
But as you said, it seems to me that the use_frameworks! is the one causing the issues

from react-native-mmkv.

oferRounds avatar oferRounds commented on May 21, 2024

@brod-ie nice! Thank you! Will try

from react-native-mmkv.

brod-ie avatar brod-ie commented on May 21, 2024

@oferRounds Even simpler! Updated my comment 😀

from react-native-mmkv.

oferRounds avatar oferRounds commented on May 21, 2024

OMG thank you!!! Will soon check and update

from react-native-mmkv.

mrousavy avatar mrousavy commented on May 21, 2024

Let me know if v2.0.0 still has that error :)

from react-native-mmkv.

kesha-antonov avatar kesha-antonov commented on May 21, 2024

Good news, you can get MMKV working with use_framework! if you utilise Microsoft's CocoaPods Pod Linkage plugin.

You'll need to follow their setup instructions and then modify this project's Podspec to include :linkage => :dynamic as in my fork.

Then install via bundle exec pod install.

@mrousavy I believe this linkage flag I added to the Podspec won't affect pod installations that don't use the cocoapods-pod-linkage extension (I tested by commenting out the plugin inclusion in my Podfile, deintegrated and reinstalled with no installation errors).

Update: Even simpler, you don't need to edit the Podspec of this library, you can just default the linkage to static in your target:

use_frameworks! :linkage => :static

This will then use static libraries for MMKV whilst still using frameworks for Swift pods that require them 🎉

Thanks! We should add this to the README

from react-native-mmkv.

felixSchl avatar felixSchl commented on May 21, 2024

There is a simpler fix which does not require installing a plugin:

  pre_install do |installer|
    installer.pod_targets.each do |pod|
      if pod.name.eql?('react-native-mmkv')
        def pod.build_type;
          Pod::BuildType.static_library
        end
      end
    end
  end

Put this in the block defining the pod somewhere under the use_frameworks! call.

from react-native-mmkv.

tkmin avatar tkmin commented on May 21, 2024

There is a simpler fix which does not require installing a plugin:

  pre_install do |installer|
    installer.pod_targets.each do |pod|
      if pod.name.eql?('react-native-mmkv')
        def pod.build_type;
          Pod::BuildType.static_library
        end
      end
    end
  end

Put this in the block defining the pod somewhere under the use_frameworks! call.

@felixSchl
exactly where should I put those codes..? still getting build error

$RNFirebaseAsStaticFramework = true

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'

target 'fondee' do
  use_frameworks!
  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => false
  )



  target 'fondeeTests' do
    use_frameworks!
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  # use_flipper!()

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end

  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
  pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone"
  # pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"

end

from react-native-mmkv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.