naoufal / react-native-safari-view

A React Native wrapper for Safari View Controller.

Home Page:https://www.npmjs.com/package/react-native-safari-view

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

react-native link with CocoaPods-based iOS projects (RN > 0.51.0) fails

mvanroon opened this issue · comments

See #81

RN 0.51 introduced linking dependancies using a CocoaPods.
Because RNSV has a .podspec file, RN will try to link it using CocoaPods to no avail, producing the following error:

schermafbeelding 2017-12-06 om 14 40 56

I'm on react 16.0.0, react-native 0.51.0 and RNSV 2.1.0. When I rename the Podfile prior to link-ing, everything works as expected.

Apparently RN prefers CocoaPods over linking the project directly, even when you only use CocoaPods for additional dependencies, which is pretty annoying.
Although I can imagine it's configurable in some way.
Thanks for reporting!

I tried to rename the Podfile, then link, and got the libSafariViewManager.a to appear but I still got the error above. I also tried to add SafariServices.framework, after still getting Native Module Null but now I get the error below

screenshot 2018-01-25 10 51 31

Terminal Error
error: bundling failed: Error: EISDIR: illegal operation on a directory, read at Object.fs.readSync (fs.js:680:19) at Object.readSync (.../node_modules/graceful-fs/polyfills.js:138:28) at tryReadSync (fs.js:478:20) at Object.fs.readFileSync (fs.js:515:19) at Module._readSourceCode (.../node_modules/metro/src/node-haste/Module.js:189:29) at Module._getCacheProps (.../node_modules/metro/src/node-haste/Module.js:369:29) at Module._readFromTransformCache (.../node_modules/metro/src/node-haste/Module.js:330:29) at Module.readCached (.../node_modules/metro/src/node-haste/Module.js:317:19) at Promise.resolve.then (.../node_modules/metro/src/node-haste/Module.js:297:27) at process._tickCallback (internal/process/next_tick.js:103:7)

Realized this seems be a Yarn specific issue, if anyone else encounters just try to run with npm instead.

Having the same issue here

Has anyone found a fix for this?

You have to manually link your Safari library to react native. Since Cocoapods causes linking issues

Firstly add SafariViewManager.xproject to your library folder (this you can find in /node_modules/react-native-safari-view/SafariViewManager.xcodeproj)
screen shot 2018-02-14 at 1 37 53 pm

You need to drag and drop SafariViewManager.xcodeproj here in the library

and then Link binary with Library add libSafariViewManager.a

screen shot 2018-02-14 at 1 37 14 pm

Thats it.

@AishwaryaSurana's solution worked for me. Thanks.