dpa99c / phonegap-launch-navigator

Phonegap/Cordova plugin which launches native route navigation apps for Android, iOS and Windows
369 stars 131 forks source link

Reachability filenames collide with other plugins #152

Closed tuliogoiania closed 7 years ago

tuliogoiania commented 7 years ago

Hello, thank you for the plugin, it is very useful, congratulations for the development.

I tried using it in the current version of my project, but it can not be compiled after adding the plugin. It has version errors.

I do not know if the information below will be enough to help, in case I need to run another command, please let me know.

Thank you very much.

ionic info

@ionic/cli-utils  : 1.9.2
ionic (Ionic CLI) : 3.9.2

global packages:

Cordova CLI : 7.0.1

local packages:

@ionic/app-scripts : 2.1.3
Cordova Platforms  : android 6.2.3 ios 4.4.0
Ionic Framework    : ionic-angular 3.6.0

System:

Android SDK Tools : 26.0.2
ios-deploy        : 1.9.1
Node              : v6.11.1
npm               : 3.10.10
OS                : macOS Sierra
Xcode             : Xcode 8.3.3 Build version 8E3004b

Error message when build

    (truncated) ... UserNotifications
    /Users/tg/docker/comp2/easier123/ionic-motorista-v35/platforms/ios/build/device/libCordova.a -framework
    Accelerate -framework CoreData -framework CoreLocation -framework CoreTelephony -framework CoreText -framework
    GLKit -framework ImageIO -lc++ -lz -framework OpenGLES -framework QuartzCore -framework SystemConfiguration
    -framework UIKit -framework GoogleMapsBase -framework GoogleMaps -framework GoogleMapsCore -weak_framework
    AudioToolbox -weak_framework AVFoundation -weak-lsqlite3 -framework CoreBluetooth -framework CoreMotion
    -framework Photos -framework AddressBook -framework EventKit -framework Contacts -framework UserNotifications
    -lPods-Easier\ 123\ Driver -framework MapKit -Xlinker -dependency_info -Xlinker
    /Users/tg/Library/Developer/Xcode/DerivedData/Easier_123_Driver-eiitjpafspssjpeyzoouxznvowny/Build/Intermediates/ArchiveIntermediates/Easier\
    123\ Driver/IntermediateBuildFilesPath/Easier\ 123\ Driver.build/Debug-iphoneos/Easier\ 123\
    Driver.build/Objects-normal/arm64/Easier\ 123\ Driver_dependency_info.dat -o
    /Users/tg/Library/Developer/Xcode/DerivedData/Easier_123_Driver-eiitjpafspssjpeyzoouxznvowny/Build/Intermediates/ArchiveIntermediates/Easier\

    123\ Driver/IntermediateBuildFilesPath/Easier\ 123\ Driver.build/Debug-iphoneos/Easier\ 123\
    Driver.build/Objects-normal/arm64/Easier\ 123\ Driver
    duplicate symbol _OBJC_CLASS_$_Reachability in:

    /Users/tg/Library/Developer/Xcode/DerivedData/Easier_123_Driver-eiitjpafspssjpeyzoouxznvowny/Build/Intermediates/ArchiveIntermediates/Easier
    123 Driver/IntermediateBuildFilesPath/Easier 123 Driver.build/Debug-iphoneos/Easier 123
    Driver.build/Objects-normal/arm64/Reachability-1B95AE6762BD987D.o

    /Users/tg/Library/Developer/Xcode/DerivedData/Easier_123_Driver-eiitjpafspssjpeyzoouxznvowny/Build/Intermediates/ArchiveIntermediates/Easier
    123 Driver/IntermediateBuildFilesPath/Easier 123 Driver.build/Debug-iphoneos/Easier 123
    Driver.build/Objects-normal/arm64/Reachability-A47B088AD957FFB4.o
    duplicate symbol _OBJC_METACLASS_$_Reachability in:

    /Users/tg/Library/Developer/Xcode/DerivedData/Easier_123_Driver-eiitjpafspssjpeyzoouxznvowny/Build/Intermediates/ArchiveIntermediates/Easier
    123 Driver/IntermediateBuildFilesPath/Easier 123 Driver.build/Debug-iphoneos/Easier 123
    Driver.build/Objects-normal/arm64/Reachability-1B95AE6762BD987D.o

....

/Users/tg/Library/Developer/Xcode/DerivedData/Easier_123_Driver-eiitjpafspssjpeyzoouxznvowny/Build/Intermediates/ArchiveIntermediates/Easier 123 Driver/IntermediateBuildFilesPath/Easier 123 Driver.build/Debug-iphoneos/Easier 123

    Driver.build/Objects-normal/arm64/Reachability-A47B088AD957FFB4.o
    ld: 4 duplicate symbols for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    ** ARCHIVE FAILED **

    The following build commands failed:
            Ld
    /Users/tg/Library/Developer/Xcode/DerivedData/Easier_123_Driver-eiitjpafspssjpeyzoouxznvowny/Build/Intermediates/ArchiveIntermediates/Easier\
    123\ Driver/IntermediateBuildFilesPath/Easier\ 123\ Driver.build/Debug-iphoneos/Easier\ 123\
    Driver.build/Objects-normal/arm64/Easier\ 123\ Driver normal arm64
    (1 failure)
    Error: Error code 65 for command: xcodebuild with args:
    -xcconfig,/Users/tg/docker/comp2/easier123/ionic-motorista-v35/platforms/ios/cordova/build-debug.xcconfig,-workspace,Easier
    123 Driver.xcworkspace,-scheme,Easier 123
    Driver,-configuration,Debug,-destination,generic/platform=iOS,-archivePath,Easier 123
    Driver.xcarchive,archive,CONFIGURATION_BUILD_DIR=/Users/tg/docker/comp2/easier123/ionic-motorista-v35/platforms/ios/build/device,SHARED_PRECOMPS_DIR=/Users/tg/do

cker/comp2/easier123/ionic-motorista-v35/platforms/ios/build/sharedpch

dpa99c commented 7 years ago

This is mostly a duplicate of #144:

This plugin uses the Apple Reachibility implementation to determine if there's currently an internet connection (see the source code here and here).

However, as this SO answer points out:

Important Note: The Reachability class is one of the most used classes in projects so you might run into naming conflicts with other projects like ShareKit. If this happens, you'll have to rename one of the pairs of Reachability.h and Reachability.m files to something else to resolve the issue.

In a native iOS app this is easily resolved. However, in a Cordova app it's not so trivial if your linking issues are be due to multiple instances of the Reachability files being included by separate Cordova plugins. That's not something that can easily be resolved by this plugin though, and is something you'll probably have to resolve either by editing the native project generated by Cordova in XCode, or modifying the conflicting plugins to rename the Reachability files so they don't conflict.

tuliogoiania commented 7 years ago

Thank you very much for reply, I will check then the best way to resolve this conflict.

I guess it has something to do with the "onesignal" plugin.

If you want to leave open the post, when you can correct, put here what we did, otherwise you can close it.

Again Thank you very much for the answer and for your plugin.

gregor-srdic commented 7 years ago

Could you provide any guidance on how to resolve this issue by editing the native project generated by Cordova in XCode?

dpa99c commented 7 years ago

@gregor-srdic Rename Reachability.h and Reachability.m in Plugins/uk.co.workingedge.phonegap.plugin.launchnavigator/ to something like LN_Reachability.h and LN_Reachability.m and update the name in the import.

Thinking about it, that's something I could in the plugin by default: namespacing it, should resolve the issue for everyone. Will reopen and implement shortly.

gregor-srdic commented 7 years ago

Thanks, I appreciate such a prompt response. However, I tried to fix this based on your suggestion, but then I have run into the problem with CDVLogger :S

anthonywg commented 6 years ago

The fix resolved most of the issues with the duplicate symbols for me, however there is one more.

10-Oct-2017 10:02:24 duplicate symbol _kReachabilityChangedNotification in:
10-Oct-2017 10:02:24 /Users/bambooagent/Library/Developer/Xcode/DerivedData/XXX-ajulpjidcsimmjefjtsjqrlufjzy/Build/Intermediates/XXX.build/Release-iphonesimulator/XXX.build/Objects-normal/x86_64/Reachability.o
10-Oct-2017 10:02:24 /Users/bambooagent/Library/Developer/Xcode/DerivedData/XXX-ajulpjidcsimmjefjtsjqrlufjzy/Build/Intermediates/XXX.build/Release-iphonesimulator/XXX.build/Objects-normal/x86_64/LN_Reachability.o
10-Oct-2017 10:02:24 ld: 1 duplicate symbol for architecture x86_64
10-Oct-2017 10:02:24 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Would it be possible to rename this too?