card.io-iOS-SDK
card.io-iOS-SDK copied to clipboard
Linker error -- "framework not found IOBluetooth for architecture x86_64"
Hi,
I tried to integrate card.io into our iOS app by first going the CocoaPods route, and then the manual route ("If you don't use CocoaPods, then").
Going the CocoaPods route, I got the following linker error:
ld: framework not found IOBluetooth for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Going the manual route, it looked promising because everything built. But when I ran the app and tried to do the following...
CardIOPaymentViewController *scanViewController = [[CardIOPaymentViewController alloc] initWithPaymentDelegate:self];
[self presentViewController:scanViewController animated:YES completion:nil];
...the app crashed with the following exception:
Terminating app due to uncaught exception 'CardIO-IncompleteIntegration', reason: 'Please add -ObjC to 'Other Linker Flags' in your project settings. (+[NSObject testForObjCLinkerFlag]: unrecognized selector sent to class 0x1128f0170)'
However, adding -ObjC to 'Other Linker Flags' did not solve the issue. Instead, I am back to square one: I got the IOBluetooth linker error again.
I think this may be related to #186
Any thoughts on this issue?
IOBluetooth seems to be an x86 Mac OS X app framework (not available on iOS; iOS uses CoreBluetooth only). Does your app either in code or in the target build configuration try to reference any IOBluetooth code in any way?
Interesting! Our code actually does reference IOBluetooth! Well, not our code, but a framework we are using. The framework has the following imports:
#ifdef __x86_64__
#import <Cocoa/Cocoa.h>
#import <IOBluetooth/objc/IOBluetoothDevice.h>
#import <IOBluetooth/objc/IOBluetoothSDPUUID.h>
#import <IOBluetooth/objc/IOBluetoothRFCOMMChannel.h>
#import <IOBluetoothUI/objc/IOBluetoothDeviceSelectorController.h>
#else
#import <ExternalAccessory/ExternalAccessory.h>
#import <UIKit/UIKit.h>
#endif
I guess it assumes that if we are x86_64, then we are a Mac instead of an iOS device. (Sounds like an incorrect assumption to me.)
As a short-term, hacky solution, I can probably modify this framework to remove that behavior, especially since we aren't developing for Macs. However, I only get this linker error when trying to use card.io. Does card.io define x86_64?
Actually, I can't modify the framework as there are binary files that we didn't generate. I look forward to maybe using card.io if there's a way to get around this flag being set!
@nickjwallin Does this only occur in the simulator? If you tried it on a device, does it run?
Going from memory here, try calling a card.io class method (like libraryVersion or whatever it's called) before doing anything else with the rest of the library instead of adding the flag. No promises.
Try to set "Other Linker Flags" as "-ObjC"