Skip to content

AsyncStorage iOS not Work RN V0.59.2 #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cristianmgb opened this issue Apr 3, 2019 · 15 comments
Closed

AsyncStorage iOS not Work RN V0.59.2 #56

cristianmgb opened this issue Apr 3, 2019 · 15 comments
Labels
bug Something isn't working platform: iOS This is iOS specific

Comments

@cristianmgb
Copy link

You want to:

Details

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

@cristianmgb cristianmgb changed the title AsyncStorage iOS not Work AsyncStorage iOS not Work RN V0.59.2 Apr 3, 2019
@krizzu
Copy link
Member

krizzu commented Apr 4, 2019

Hey @cristianmgb ,

Did you follow the points listen in the red screen?

@krizzu krizzu added bug Something isn't working platform: iOS This is iOS specific labels Apr 4, 2019
@cristianmgb
Copy link
Author

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.

@krizzu
Copy link
Member

krizzu commented Apr 4, 2019

@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.

@cristianmgb
Copy link
Author

cristianmgb commented Apr 4, 2019

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

@Sam-Hoult
Copy link

@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
Copy link
Author

cristianmgb commented Apr 4, 2019

@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.

@Sam-Hoult
Copy link

@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

@clucasalcantara
Copy link
Contributor

clucasalcantara commented Apr 4, 2019

First, thanks for replying us :)

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

@QShengW
Copy link

QShengW commented Apr 5, 2019

I have the same problem

@krizzu
Copy link
Member

krizzu commented Apr 5, 2019

Hey,

Are you using pods by any chance?

@cristianmgb
Copy link
Author

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.

@cristianmgb
Copy link
Author

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

@krizzu
Copy link
Member

krizzu commented Apr 7, 2019

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.

@cristianmgb
Copy link
Author

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. 👍

krizzu pushed a commit that referenced this issue Apr 10, 2019
After the discussions on issue #56 I've noticed that we have missing information about iOS Linking and almost none about the manual linking process, this PR aims to provide this missing info.
@krizzu
Copy link
Member

krizzu commented Apr 11, 2019

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

thanks.

@krizzu krizzu closed this as completed Apr 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working platform: iOS This is iOS specific
Projects
None yet
Development

No branches or pull requests

5 participants