Reputation: 251
I just started to try out the Stripe's new SDK for Apple pay integration and hitting an error in the first step itself. I'm using the Xcode 6 GM version. I followed these instructions.
I included the Stripe library by cloning from GitHub and copied the folder into my project.
I have not even begun to code anything, I keep hitting the MACH-O linker error during the build.
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_STPTestPaymentAuthorizationViewController", referenced from:
objc-class-ref in Stripe.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have tried deleting the 'Derived Data' folder and cleaning the Build Folder as specified in this link: XCode/PhoneGap - Apple Mach-O Linker Error. No use. I've tried including the library in both Objective-C and Swift language projects.
Anyone facing this issue or could give any hints on how to resolve it? Other Swift projects are compiling fine, it's this one that is troublesome.
Okay, I tried out the lipo command, here's the output:
yoda:~ manju$ lipo -info libstripe.a
fatal error: /Users/manju/Documents/xcode 6/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't open input file: libstripe.a (No such file or directory)
Upvotes: 2
Views: 1369
Reputation: 1
I had the same problem, and as Joshua Said above, the
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
#endif
Is causing the issue.
However, removing it from the source would've meant that I would have to remove the check from every file in every project I imported Stripe into, and that seemed a little excessive.
I got the project to compile after looking at Stripe's example code in the StripeExample-Prefix.pch file (under supporting files) which has the following:
//
// Prefix header
//
// The contents of this file are implicitly included at the beginning of every source file.
//
#import <Availability.h>
#ifndef __IPHONE_5_0
#warning "This project uses features only available in iOS SDK 5.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif
Once I added the #import <Availability.h>
to my .pch and set "Precompile Prefix Header" to Yes my Build Settings, my project compiled without any issue.
Upvotes: 0
Reputation: 2881
The reason why it is not compiling is because of the:
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
#endif
in STEPTestPaymentAuthorizationViewController and PKPayment+STPTestKeys both .h and .m files
This must mean that __IPHONE_OS_VERSION_MAX_ALLOWED is < 80000. I have iOS 8 and the latest version of XCode as of this week. Do you know how I can set max allowed to an earlier iOS version?
Upvotes: 1