0

I am currently implementing iOS Salesforce Chatter integration into iPad app. When Salesforce Mobile SDK was added (inlcuding MKNetworkKit-iOS) I got duplicate error on Reachability.o. I understand that we have Reachability added into MKNewtorkKit-iOS, but I also have to have access to it from insdie my project.

Currently I am accessing reachability (from within my code) by adding #import "Reachability.h"

If I get read of Reachibility class from my project, I need to gain access to MKNetworkKit-iOS copy of reachability class, but I can't import anything like "MKNetworkKit-iOS/Reachabilty.h" - tried quite a few combination hoping that Xcode autocomplete did not work properly for this library, but no luck.

Currently using Xcode 5.1 with iOS SDK 7.1 and latest Salesfroce Mobile SDK 2.1.1 (all changes pulled today).

Error I am seeing:

duplicate symbol _kReachabilityChangedNotification in: /FULL_PATH_TO_BUILD_LOCATION/Build/Intermediates/LDPConference.build/Debug-iphoneos/LDPConference.build/Objects-normal/armv7/Reachability.o /FULL_PATH_TO_PROJECT/SalesforceMobileSDK/MKNetworkKit-iOS/libMKNetworkKit-iOS.a(Reachability.o) duplicate symbol _OBJC_CLASS_$_Reachability in: /FULL_PATH_TO_BUILD_LOCATION/Build/Intermediates/LDPConference.build/Debug-iphoneos/LDPConference.build/Objects-normal/armv7/Reachability.o /FULL_PATH_TO_PROJECT/SalesforceMobileSDK/MKNetworkKit-iOS/libMKNetworkKit-iOS.a(Reachability.o) duplicate symbol _OBJC_METACLASS_$_Reachability in: /FULL_PATH_TO_BUILD_LOCATION/Build/Intermediates/LDPConference.build/Debug-iphoneos/LDPConference.build/Objects-normal/armv7/Reachability.o /FULL_PATH_TO_PROJECT/SalesforceMobileSDK/MKNetworkKit-iOS/libMKNetworkKit-iOS.a(Reachability.o) ld: 3 duplicate symbols for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Thanks a lot of your time looking into this, J

Justas
  • 136
  • 7

2 Answers2

3

You can remove any of the two Reachability.m files from the compilation.

Go to Project Settings -> Build Phases -> Compile Sources -> Select Reachability.m -> Delete it.

This won't delete the file from the system, only from the compilation. The header will be used and the implementation won't be duplicated.

You can also rename one of the classes to avoid naming conflicts.

redent84
  • 18,901
  • 4
  • 62
  • 85
  • One Reachability.m file added manually, so it will be in "Compile Sources". But another Reachability.m file has been added into "MKNetworkKit-iOS" library and it will not add into "Compile Sources". – Ganesh G Dec 22 '14 at 19:54
  • @G.Ganesh The other Reachability.m file will be in the "Compile Sources" of the "MKNetworkKit-iOS" library. – redent84 Dec 23 '14 at 00:13
1

Thanks a lot @redent84. Worked great.

I have also received answer with alternative solution from Kevin Hawkins on Salesforce forum as well:

Another solution would be to piggyback on the reachability exposed through SFNetworkEngine:

[SFNetworkEngine sharedInstance].reachabilityChangedHandler = ^(SFNetworkStatus newStatus) {
    // Handle your network changes here.
};

That's ultimately leveraging MKNetworkKit's reachability functionality.

same topic on salesforce forum here

Justas
  • 136
  • 7