I have ejected my expo app from SDK30 and then try to manually install your library as described in readme.
When I trying to build my application for IOS, I am getting the error:
duplicate symbol _OBJC_IVAR_$_DDLogMessage._threadID in:
/Users/alekseyrebenkov/Library/Developer/Xcode/DerivedData/--------------------bhfjsybpbrvoqjfqvfadebydyiwd/Build/Products/Debug-iphonesimulator/CocoaLumberjack/libCocoaLumberjack.a(DDLog.o)
/Users/alekseyrebenkov/Library/Developer/Xcode/DerivedData/--------------------bhfjsybpbrvoqjfqvfadebydyiwd/Build/Products/Debug-iphonesimulator/libRCTBackgroundGeolocation.a(CocoaLumberjack.o)
ld: 116 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
In fact, I have more longer error log, I can give it to you, if it really need.
The application built without errors.
I am getting the error.
I don't know :(
I don't sure because of my app was developing a long time and I don't know how exactly reproduce my error.
Can you please list all plugins you're using?
@mauron85 would you like to get my package.json dependency list or my pod packages?
This is my package.json dependencies list
"autobahn": "^18.3.2",
"axios": "^0.18.0",
"babel-plugin-transform-decorators-legacy": "^1.3.5",
"babel-preset-env": "^1.7.0",
"expo": "^30.0.0",
"expokit": "1.7.1",
"lodash": "^4.17.10",
"mobx": "^4.3.0",
"mobx-react": "^5.1.2",
"moment": "^2.22.1",
"react": "16.3.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz",
"react-native-autobahnjs": "^0.1.6",
"react-native-easy-toast": "^1.1.0",
"react-native-elements": "1.0.0-beta5",
"react-native-maps-directions": "^1.6.0",
"react-native-mauron85-background-geolocation": "^0.5.0-alpha.47",
"react-native-phone-call": "^1.0.6",
"react-native-simple-toast": "^0.0.8",
"react-navigation": "^2.0.4",
"socket.io-client": "^2.1.1",
"wamp.js": "^0.2.5",
"wampy": "^6.2.0",
"when": "^3.7.8"
I would say you're using libCocoaLumberjack in your project (or maybe some other library you're using is using it). I can't tell from you package list, which one it might be. But maybe you can check in Xcode.

I forgot to say, that this plugin is already linking libCocoaLumberjack. So when some other plugin/library is using it, then you have this linking error.
Also you can remove expo and other expo related libs from your package json as you've already ejected from expo. Delete node_modules and reinstall. The less packages, the better (less possible conflicts).
One more question. Any chance you've installed https://github.com/transistorsoft/react-native-background-geolocation in the past?
Maybe. But if so, I removed this dependency before eject app and then I removed my node_modules and install again all my dependencies.
I can't remove the whole expo because I am using ExpoKit after eject
I don't know why, but for some reasons, I don't have Libraries folder in my XCode project. I've added your library right in my project. I forgot to say about it.
Maybe. But if so, I removed this dependency before
that is not enough. You must unlink it with react-native unlink. Even that may not be enough. It depends if that plugin does proper unlink. Try undo all steps mentioned in its install procedure:
Or you can start new project with freshly installed node_modules and migrate your code base from old project.
The reason, is that this library brought the additional dependency on lumberjack -> the cause of your problem. Since you're not using it anymore (according to package.json), there is no need to have it in your project (even though it's not in node_modules anymore, there are still leftovers somewhere in the project).
Can I have this problem even if I have installed and remove that library before ejected my app? At that moment I didn't have any access to android or ios folders in my project.
How did you remove? Deleting it from package.json and node_modules is not enough. Not matter if you ejected before or after.
Thanks for your answers. For now, I see that I really have CocoaLumberjack in my pods folders. After I have removed my pods folder and install pods again, CocoaLumberjack appeared in my pods folder again.
Also, I have checked RNBG installation procedure and I didn't find any signs of that library in my project.
When I am trying to find CocoaLumberjack in whole my project, I find this in that file
/myappdir/ios/Pods/Local Podspecs/ExpoKit.podspec.json
"CocoaLumberjack": [
"~> 3.2.1"
],
It seems like ExpoKit has CocoaLumberjack as a dependency.
Since ExpoKit is using CocoaPods, I'm not sure how to resolve this. I would have to replicate your exact setup.
Okay, I will try to reproduce this issue on a minimal project configuration and come back later. Thank you, anyway)
So, it turned out to be easy to reproduce it.
expo init testapp"react-native": "https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz",
"expo": "^30.0.0",
"react": "16.3.1"
and run yarn install)
expo ejectHere is my expo diagnostics report. Maybe it will be useful:
Expo CLI 2.3.5 environment info:
System:
OS: macOS 10.14.1
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.13.0 - ~/.nvm/versions/node/v10.13.0/bin/node
Yarn: 1.10.1 - /usr/local/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v10.13.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5056338
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
expo: ^30.0.0 => 30.0.2
react: 16.3.1 => 16.3.1
react-native: https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz => 0.55.4
npmGlobalPackages:
expo-cli: 2.3.5
It's kind of complicated to resolve this and not break anything else.
Expokit is installing lumberjack from cocoapod file. Not sure how they link the lumberjack. If statically we have to use same version as them. So it basically means to write cocoapod file for this library.
Which I'm not going to do, as I have no experience with cocoapods. To be honest I don't think cocopads, are event good fit for react-native (we have npm).
But what I can do is extract lumberjack from the plugin. So it could be installed as separate package from npm or cocoapod.
But it should be possible to hack your app to use lumberjack installed by Expokit.
I would:
delete CocoaLumberjack.h and CocoaLumberjack.m in Libraries/RCTBackgroundGeolocation.xcodeproj

change import in MaurLogging.h to (look at ExpoKit)
#import "CocoaLumberjack/CocoaLumberjack.h"
FMDBLogger.h to:#import "CocoaLumberjack/CocoaLumberjack.h"
#import "CocoaLumberjack/DDAbstractDatabaseLogger.h"
Libraries/RCTBackgroundGeolocation.xcodeproj -> Add Link to Binary with Librariesadd lib or framework CocoaLumberjack (again it depends on ExpoKit)
Edit: step 4. is probably not necessary as Expokit should link CocoaLumberjack framework (or static lib) for you.
Hello @mauron85. Could you explain, step by step, how to hack app on the example of testing application, which I was using for reproducing the problem?
Problem is when I am following your instructions from the last message, my applications builts successful, but after launch the application in the simulator, I'm getting the error:

I guess the line in source code is this one https://github.com/mauron85/background-geolocation-ios/blob/5734e7191e6eef893419c5b44614e978a0b65f99/BackgroundGeolocation/MAURLocationManager.m#L266
this is not very helpful and nothing I can relate to your problem. Just regular line. Please try to look for some error message.
Basically it fails to allocate MAURLocationManager in static method sharedInstance. But reasons why are not known from that screenshot.
2018-11-13 12:05:37:744 -------------------[15105:354739] Backing up original handler.
2018-11-13 12:05:37:744 -------------------[15105:354739] Setting new handler.
2018-11-13 12:05:37:766 -------------------[15105:354658] 2018-11-13 12:05:37.767 [info][tid:com.facebook.react.BackgroundGeolocationQueue][RCTBackgroundGeolocation.m:62] RCTBackgroundGeolocation #configure
2018-11-13 12:05:37:769 -------------------[15105:354658] BgGeo #configure: Config: distanceFilter=50 stationaryRadius=50 desiredAccuracy=0 activityType=OtherNavigation activitiesInterval=10000 isDebugging=1 stopOnTerminate=1 url=http://192.168.81.15:3000/location syncThreshold=100 maxLocations=10000 httpHeaders={
"X-FOO" = bar;
} pauseLocationUpdates=0 saveBatteryOnBackground=0 locationProvider=1 postTemplate={
foo = bar;
lat = "@latitude";
lon = "@longitude";
}
2018-11-13 12:05:37:791 -------------------[15105:354658] 2018-11-13 12:05:37.792 [info][tid:com.facebook.react.BackgroundGeolocationQueue][RCTBackgroundGeolocation.m:233] RCTBackgroundGeolocation #checkStatus
2018-11-13 12:05:37:805 -------------------[15105:354739] 2018-11-13 12:05:37.806 [info][tid:com.facebook.react.JavaScript] '[INFO] BackgroundGeolocation service is running', false
2018-11-13 12:05:37:809 -------------------[15105:354739] 2018-11-13 12:05:37.809 [info][tid:com.facebook.react.JavaScript] '[INFO] BackgroundGeolocation services enabled', true
2018-11-13 12:05:37:820 -------------------[15105:354739] 2018-11-13 12:05:37.820 [info][tid:com.facebook.react.JavaScript] [INFO] BackgroundGeolocation auth status: 2
2018-11-13 12:05:37:824 -------------------[15105:354744] 2018-11-13 12:05:37.824 [info][tid:com.facebook.react.BackgroundGeolocationQueue][RCTBackgroundGeolocation.m:76] RCTBackgroundGeolocation #start
2018-11-13 12:05:37:826 -------------------[15105:354744] BgGeo #start: 0
2018-11-13 12:05:37:877 -------------------[15105:354561] CRASH: Invalid parameter not satisfying: !stayUp || CLClientIsBackgroundable(internal->fClient) Stack Trace: (
0 CoreFoundation 0x0000000114c231bb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x0000000113578735 objc_exception_throw + 48
2 CoreFoundation 0x0000000114c22f42 +[NSException raise:format:arguments:] + 98
3 Foundation 0x000000010fcbc877 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
4 CoreLocation 0x000000010f4af2d0 CLClientStopVehicleHeadingUpdates + 27847
5 ------------------- 0x000000010b60c39b -[MAURLocationManager init] + 363
6 ------------------- 0x000000010b60e604 __37+[MAURLocationManager sharedInstance]_block_invoke + 52
7 libdispatch.dylib 0x0000000115d2a602 _dispatch_client_callout + 8
8 libdispatch.dylib 0x0000000115d2c0c4 _dispatch_once_callout + 66
9 ------------------- 0x000000010b60e5a8 +[MAURLocationManager sharedInstance] + 136
10 ------------------- 0x000000010b5d2ddf -[MAURActivityLocationProvider onCreate] + 47
11 ------------------- 0x000000010b610978 -[MAURBackgroundGeolocationFacade getProvider:error:] + 648
12 ------------------- 0x000000010b60fdc2 __41-[MAURBackgroundGeolocationFacade start:]_block_invoke + 146
13 libdispatch.dylib 0x0000000115d2a602 _dispatch_client_callout + 8
14 libdispatch.dylib 0x0000000115d387be _dispatch_async_and_wait_invoke + 176
15 libdispatch.dylib 0x0000000115d2a602 _dispatch_client_callout + 8
16 libdispatch.dylib 0x0000000115d3799a _dispatch_main_queue_callback_4CF + 1541
17 CoreFoundation 0x0000000114b883e9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
18 CoreFoundation 0x0000000114b82a76 __CFRunLoopRun + 2342
19 CoreFoundation 0x0000000114b81e11 CFRunLoopRunSpecific + 625
20 GraphicsServices 0x00000001171191dd GSEventRunModal + 62
21 UIKitCore 0x000000011e45981d UIApplicationMain + 140
22 ------------------- 0x000000010a56f560 main + 112
23 libdyld.dylib 0x0000000115da0575 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
I've found it in my debug log. Can it be helpful?
Ok. This is much more helpful. Do you have all background modes and usage descriptions in your Info.plist?
https://github.com/mauron85/react-native-background-geolocation#ios-setup
Yes, I've set background modes to location and add usage descriptions too.

This is exactly same error as described here https://github.com/mauron85/react-native-background-geolocation/issues/60/ and also you can find many links on stackoverflow. I'm pretty sure it's related to background modes and usage descriptions (even though your settings seems ok). Not sure but I see "Required background modes" as string, and IMO it should be array.
Try right click on Info.plist -> Edit as source code and check if it's array
<key>UIBackgroundModes</key>
<array>
<string>location</string>
</array>
You can also enable same thing in Project -> Capabilities -> Background Modes -> Location Updates
Thank you, very much! I don't know, what should I do without your help. It's my fault, I have not paid enough attention to UIBackgroundModes type :(
P.S.: Sorry for my English and I'm sorry to disturb you:)
Closing as resolved.
Hello,
Got same issue, I've fixed it by :
"${SRCROOT}/../../../../ios/Pods/Headers/Public/CocoaLumberjack" to System Header Search Paths on BackgroundGeolocation.xcodeproj (see Build Settings tab)./node_modules/react-native-mauron85-background-geolocation/ios/common/BackgroundGeolocation/CocoaLumberjack.h./node_modules/react-native-mauron85-background-geolocation/ios/common/BackgroundGeolocation/CocoaLumberjack.mreact-native-mauron85-background-geolocation will then use CocoaLumberjack from Expo CocoaPods
We need better solution for this. I believe RN team is also looking for universal solution. I've already started discussion related to this issue.
https://github.com/react-native-community/discussions-and-proposals/issues/60
Hi @mauron85, I followed your hack way above, but got 'CocoaLumberjack/CocoaLumberjack.h' file not found', do you have any idea on this? thanks
Edit: I'm a little confused about step4, can you kindly provide details, thanks.
@iwantooxxoox I got the same problem and managed to fix it. I got a solution working here. You can add it like this in your package.json: "react-native-mauron85-background-geolocation": "https://github.com/alexbuicescu/react-native-background-geolocation#a295dbba40174d3c428cd437697ab0c1876ea4e6" (instead of "react-native-mauron85-background-geolocation": "0.5.0"). I use this solution with jenkins as I don't have to do anything manually.
If you want a manual fix:
${SRCROOT}/../../../../ios/Pods/Headers/Public to System Header Search Paths on Libraries/RCTBackgroundGeolocation.xcodeproj/BackgroundGeolocation.xcodeproj (see Build Settings tab), same as here but without the trailing /CocoaLumberjack
Most helpful comment
But it should be possible to hack your app to use lumberjack installed by Expokit.
I would:
delete CocoaLumberjack.h and CocoaLumberjack.m in

Libraries/RCTBackgroundGeolocation.xcodeprojchange import in
MaurLogging.hto (look at ExpoKit)FMDBLogger.hto:Libraries/RCTBackgroundGeolocation.xcodeproj->Add Link to Binary with Librariesadd lib or framework CocoaLumberjack (again it depends on ExpoKit)
Edit: step 4. is probably not necessary as Expokit should link CocoaLumberjack framework (or static lib) for you.