auth0 / react-native-lock

[DEPRECATED] A wrapper of Lock to use with React Native (iOS & Android)
MIT License
277 stars 77 forks source link

Add support to include library using `.xcodeproj` without CocoaPods #4

Closed hzalaz closed 8 years ago

hzalaz commented 9 years ago

Need to have a Lock as a static library and all resources bundle (with images and xib files)

cancan101 commented 9 years ago

Any way we can prioritize this approach?

As of now even if we get the CP approach to work, it looks like removing the various RN projects breaks functionality in XCode.

cancan101 commented 8 years ago

@hzalaz What I did have success with is using cocoapods to install the dependencies of the Lock but not the RN code itself. In other words, my Podfile has:

pod 'Lock'
pod 'Lock/TouchID'
pod 'Lock/SMS'
pod 'Lock/Email'

Right now I just add the m/h files in this repos manually to my project. Theoretically those should be addable through another project, I would imagine? image

That way I don't need to tinker with how React in included.

hzalaz commented 8 years ago

Yes, but the ideal will be with the Lock static lib instead of using CocoaPods to build it. It's a workaround but you'll probably need to use CocoaPods for all your native dependencies otherwise you might get duplicated symbols, e.g. if an react-native third party lib includes a dependency already included by cocoapods. Might not happen ofter but I'd rather avoid those cases

cancan101 commented 8 years ago

Agreed on not ideal and I would prefer to not use CP at all here. That being said I am not too worried about conflict here as the only items pulled in through CP are Auth0.

hzalaz commented 8 years ago

Yes, but Auth0 has a couple of dependencies, e.g. Facebook SDK in Lock-Facebook

carbureted commented 8 years ago

Any solution that doesn't require pulling out the react subprojects would be very very very strongly preferable - there are other useful react-native libraries that seem to expect react-native components to be included in the traditional way, and I expect that pulling them out is going to lead to major maintenance headaches down the road (most immediately on major react-native updates).

hzalaz commented 8 years ago

@carbureted short of rewriting the entire objc Lock library for react-native, which is not in our plans right now, I can't come up with a perfect solution for this since react native provides no support for this kind of libs that have a native dependency and most libraries are very simple (just one or two objc files with no dependencies) Also the way React core is included in the Xcode project is the least recommended way to include a native library in any app so it makes our work a little harder.

That being said, I have almost finished a compromise solution to this issue at the cost of losing the native integration like using facebook sdk to login. Lock will be added using and .xcodeproj that includes the bridge code between Lock.iOS-RN and the lock itself already compiled as a static library (with all the basic dependencies bundled there). So the flow to include it will be similar of what is the "recommended" way in RN now, and let's hope it doesn't change soon :). I'll post it here when its done (my goal is end of february)

cancan101 commented 8 years ago

This worked pretty well for me: https://github.com/auth0/react-native-lock-ios/issues/4#issuecomment-164509322

hzalaz commented 8 years ago

@cancan101 yes, that will be our suggestion if you really want native integrations. I have to test that setup when you also include fb sdk as a rn dependency

carbureted commented 8 years ago

@cancan101 I'm pretty new to ios/xcode development - maybe there's a basic step I missed, but just dragging in the files as depicted gives me import errors. Did you need to modify any code?

@hzalaz I don't need anything other than the most basic email/password authentication, so the solution you mentioned sounds good to me.

podviaznikov commented 8 years ago

@cancan101 can you please provide ore information where do you put these files from the screenshot. I never worked with XCode before and can't understand where should I copy those files

kennu commented 8 years ago

I've been spending hours trying to get this to work, without success, very frustrating. I wish Auth0 could provide a solution that would just work out-of-the-box, together with all other React Native libraries.

tal952 commented 8 years ago

+1

hzalaz commented 8 years ago

Closing this, the module react-native-lock provides a .xcodeproj file but cocoapods is still needed to fetch native dependencies. However if using rpm, most of the heavy work is done automatically.