radarlabs / react-native-radar

React Native module for Radar, the leading geofencing and location tracking platform
https://radar.com
Apache License 2.0
170 stars 32 forks source link

iOS Manual Link doesn't work #69

Closed vadimshvetsov closed 5 years ago

vadimshvetsov commented 5 years ago

It's related to https://github.com/radarlabs/react-native-radar/issues/42

This solution doesn't work for CI, because it installs RNRadar Library again and without configured Framework Search Path.

Fast solution can be adding by default ${SRCROOT}/../../../ios to RNRadar target framework search path and we can have inside our ios folder the RadarSDK.framework

russellcullen commented 5 years ago

Thanks for the report, would you mind sharing some details?

vadimshvetsov commented 5 years ago

I have the same report as the author of the issue: https://github.com/radarlabs/react-native-radar/issues/42

#import <RadarSDK/RadarSDK.h> Not found inside node_modules/react-native-radar/ios/RNRadarUtils.m:1:9: In file included from /Users/Vadim/Development/Qlean/cleaners/node_modules/react-native-radar/ios/RNRadarUtils.m:1:

But my project has this string and its works correctly inside project.

The case in RNRadar target search path.

My manually linked RadarSDK.framework exist in my-react-native-project/ios/RadarSDK.framework

I have no pods or carthage and won't use it further, so my case is manual linking

Version of react-native-radar is 2.1.6 (latest) SDK manually downloaded 2-3 days ago, it's latest too

russellcullen commented 5 years ago

Thanks for the info, how are you manually linking the RadarSDK framework?

vadimshvetsov commented 5 years ago

At first I did a copy of RadarSDK.framework folder into my-rn-project/ios/

Then I made a reference of this folder in my main target General -> Linked Frameworks and Libraries

Then I checked that RadarSDK.framework appeared in main target Build Phases -> Link Binary With Libraries

russellcullen commented 5 years ago

You'll also want to make sure you've linked the projects with react-native link react-native-radar after ejecting the code.

vadimshvetsov commented 5 years ago

Oh, yeah, of course - it was first what I did after installing react-native-radar

And I have

#import <RadarSDK/RadarSDK.h>

Inside my AppDelegate.m and it has no error

russellcullen commented 5 years ago

And the react native side of things works as well? Running the app and calling the Radar JavaScript methods all work fine?

vadimshvetsov commented 5 years ago

It works perfectly when I add manually ${SRCROOT}/../../../ios to RNRadar target framework search paths for using my project ios folder to resolve RadarSDK.framework dependency.

But ofc when it ships from npm it hasn't this path inside my CI

By default RNRadar has: image So here is no case for manual linking, while pods and carthage cases resolves properly.

russellcullen commented 5 years ago

Yeah that makes sense regarding CI. We'll get that search path added to the native project in our next release to address this issue, apologies!

~In the meantime, as a temporary workaround, it looks like ${SRCROOT}/../../../ios/RadarSDK is currently one of the listed search paths, if you add and link the RadarSDK.framework from that directory then everything should work.~

vadimshvetsov commented 5 years ago

How soon the release would be done? Maybe it's easier to wait for that :)

I can't see the ${SRCROOT}/../../../ios/RadarSDK in the list. Where is it listed?

russellcullen commented 5 years ago

Ah whoops, I was looking at the header search paths instead of framework ones, you're correct.

You could make a Pods/RadarSDK directory and work from there, but a new release should be going out sometime today, if you don't mind waiting.

vadimshvetsov commented 5 years ago

Wow, thats awesome, thank you so much, I'll wait then for 2.1.7 better.

By the way, I've tested already background location in Android and can't understand one thing. Would it works after Radar.startTracking() in background mode with proper permissions, while I've closed the app completely?

russellcullen commented 5 years ago

That's correct. You'll need to make sure that your event listeners are registered outside of the component lifecycle as described in our README. If so, you'll receive events in the background, otherwise you'll just receive events for as long as those listeners are active.

vadimshvetsov commented 5 years ago

Wow, that's really important note, thanks!

russellcullen commented 5 years ago

Fixed in https://github.com/radarlabs/react-native-radar/releases/tag/2.1.7

Please let us know if you have any problems with the new version, always happy to help!

vadimshvetsov commented 5 years ago

Thanks, it builds perfectly in CI now!