2

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)
Community
  • 1
  • 1
Manju
  • 251
  • 2
  • 9
  • Please edit your question. Add the output of the command: `$ lipo -info libstripe.a`. You may need to change the name of the library. I guessed that its called `libstripe.a`. – jww Sep 14 '14 at 05:34
  • Based on your edit, it appears you don't have the Stripe library. You should fix that problem first. Also, you reference an iOS library, but you have an undefined symbol for `x86_64`. What, exactly, are you trying to build for? – jww Sep 14 '14 at 17:51
  • I do have the Stripe library, I've cloned it from github. (https://stripe.com/docs/mobile/ios ) – Manju Sep 16 '14 at 06:36

2 Answers2

1

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?

Josh Gafni
  • 2,831
  • 2
  • 19
  • 32
0

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.