Async-storage: AsyncStorage iOS not Work RN V0.59.2

Created on 4 Apr 2019  ·  15Comments  ·  Source: react-native-async-storage/async-storage

You want to:

Details


Simulator Screen Shot - iPhone X - 2019-04-03 at 17 22 34

bug iOS

Most helpful comment

I've initialized a new RN project (RN 0.59.1) to test it out. I was able to successfully link and run the app (with and without pods).

Here're the steps I did:

  1. Init project
  2. Add @react-native-community/async-storage via yarn add
  3. Go to ios/, pod init
  4. My Podfile, before linking:
target 'YOUR_PROJECT_NAME_HERE' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!
  platform :ios, '9.0'


  node_modules_path = '../node_modules'

  pod 'yoga', path: "#{node_modules_path}/react-native/ReactCommon/yoga/yoga.podspec"
  pod 'React', path: "#{node_modules_path}/react-native"

end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "React"
      target.remove_from_project
    end
  end
end
  1. Run react-native link @react-native-community/async-storage in root directory
    Command adds a line in Podfile, just below pod 'React':
  pod 'react-native-async-storage', :path => '../node_modules/@react-native-community/async-storage'`
  1. Run pod install in ios/
  2. Open ios/ProjectName.xcworkspace (mind .xcworkspace extension) and press run OR run react-native run-ios in root

If anyone still have some issues, before you post that you got the same problem - please provide some more info/repro steps.
Please check if problem exists for you if in a new RN app - it might mean that you're missing some steps, like pod installing, in your original project.

thanks.

All 15 comments

Hey @cristianmgb ,

Did you follow the points listen in the red screen?

yes, i did. And didnt work out. but the problem is only in IOS because in android works perfectly. im using the version RN 0.59.2.

@cristianmgb
This error comes from the fact that Async Storage is not linked, and if linked, you'd need to rebuild native part.

Try this:

  • Stop packager
  • Run react-native link @react-native-community/async-storage once again, to make sure it's linked (no errors, just message saying it's already done)
  • run react-native run-ios to get fresh build
  • run the packager with --clearCache flag

Let me know how did it go.

i follow all the steps and still not work.
i created a new project whit all the step you give me and still not work.
this is my pod file.
Captura de Pantalla 2019-04-04 a la(s) 3 16 31 p  m

@cristianmgb I just hit this same issue. The guide is missing the rather important point of react-native link then cd ios pod install.

Inside your xCode you should see:
image

Hope this helps

@cristianmgb I just hit this same issue. The guide is missing the rather important point of react-native link then cd ios pod install.

Inside your xCode you should see:
image

Hope this helps

Captura de Pantalla 2019-04-04 a la(s) 4 54 29 p  m

the issues continues. And now show this Error: jest-haste-map: Haste module naming collision:
Duplicate module name: react-native
This error is caused by hasteImpl returning the same name for different files.

@cristianmgb Hmm. I think my podfile already accounts for that madness from AppCenter doing the same to me:

target 'RN_app' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!
  platform :ios, '9.0'

  pod 'AppCenter/Crashes', '~> 1.14.0'
  pod 'AppCenter/Analytics', '~> 1.14.0'
  pod 'AppCenterReactNativeShared', '~> 1.13.0'

  node_modules_path = '../node_modules'

  pod 'yoga', path: "#{node_modules_path}/react-native/ReactCommon/yoga/yoga.podspec"
  pod 'React', path: "#{node_modules_path}/react-native"

  pod 'ReactNativeSocketMobile', path: "#{node_modules_path}/@getgreenline/react-native-socket-mobile/ios"

  pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'

  pod 'SentryReactNative', :path => '../node_modules/react-native-sentry'

  pod 'react-native-async-storage', :path => '../node_modules/@react-native-community/async-storage'

end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "React"
      target.remove_from_project
    end
  end
end

First, thanks for replying us :)

I'm also having this issue here :( ( I've followed every step several times.)

I have the same problem

Hey,

Are you using pods by any chance?

Hey,

Are you using pods by any chance?

Captura de Pantalla 2019-04-04 a la(s) 3 16 31 p  m

This is my pod file.

Captura de Pantalla 2019-04-05 a la(s) 2 18 08 p  m

I've initialized a new RN project (RN 0.59.1) to test it out. I was able to successfully link and run the app (with and without pods).

Here're the steps I did:

  1. Init project
  2. Add @react-native-community/async-storage via yarn add
  3. Go to ios/, pod init
  4. My Podfile, before linking:
target 'YOUR_PROJECT_NAME_HERE' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!
  platform :ios, '9.0'


  node_modules_path = '../node_modules'

  pod 'yoga', path: "#{node_modules_path}/react-native/ReactCommon/yoga/yoga.podspec"
  pod 'React', path: "#{node_modules_path}/react-native"

end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "React"
      target.remove_from_project
    end
  end
end
  1. Run react-native link @react-native-community/async-storage in root directory
    Command adds a line in Podfile, just below pod 'React':
  pod 'react-native-async-storage', :path => '../node_modules/@react-native-community/async-storage'`
  1. Run pod install in ios/
  2. Open ios/ProjectName.xcworkspace (mind .xcworkspace extension) and press run OR run react-native run-ios in root

If anyone still have some issues, before you post that you got the same problem - please provide some more info/repro steps.
Please check if problem exists for you if in a new RN app - it might mean that you're missing some steps, like pod installing, in your original project.

thanks.

I've initialized a new RN project (RN 0.59.1) to test it out. I was able to successfully link and run the app (with and without pods).

Here're the steps I did:

  1. Init project
  2. Add @react-native-community/async-storage via yarn add
  3. Go to ios/, pod init
  4. My Podfile, before linking:
target 'YOUR_PROJECT_NAME_HERE' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!
  platform :ios, '9.0'


  node_modules_path = '../node_modules'

  pod 'yoga', path: "#{node_modules_path}/react-native/ReactCommon/yoga/yoga.podspec"
  pod 'React', path: "#{node_modules_path}/react-native"

end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "React"
      target.remove_from_project
    end
  end
end
  1. Run react-native link @react-native-community/async-storage in root directory
    Command adds a line in Podfile, just below pod 'React':
  pod 'react-native-async-storage', :path => '../node_modules/@react-native-community/async-storage'`
  1. Run pod install in ios/
  2. Open ios/ProjectName.xcworkspace (mind .xcworkspace extension) and press run OR run react-native run-ios in root

If anyone still have some issues, before you post that you got the same problem - please provide some more info/repro steps.
Please check if problem exists for you if in a new RN app - it might mean that you're missing some steps, like pod installing, in your original project.

thanks.

work for me. 👍

We've updated the docs. Closing this for now.

thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cpojer picture cpojer  ·  34Comments

alex-mironov picture alex-mironov  ·  71Comments

srivatsav picture srivatsav  ·  26Comments

Krizzu picture Krizzu  ·  36Comments

StevenMasini picture StevenMasini  ·  22Comments