PayPal集成了iOS 8 App

时间:2014-10-12 23:26:17

标签: ios objective-c paypal

我已经下载并使用了paypal ios应用程序的github项目。 https://github.com/paypal/PayPal-iOS-SDK 我跑得很好,没有任何错误。当我尝试将它链接到我的iOS 8 swift项目时,我可以加载所有文件并连接视图控制器就好了,我相信我的桥头文件工作正常。我基本上将示例应用程序中的所有viewcontroller文件移动到我的项目中,并将我需要的内容连接起来。我相信我有客户端ID和秘密ID工作。当我尝试创建FuturePaymentViewController时:

 - (IBAction)getUserAuthorizationForFuturePayments:(id)sender {

       NSLog(@"\n\n\nbegin getting user authorization\n\n\nPAYPAL CONFIG::::   %@", self.payPalConfig);
       PayPalFuturePaymentViewController *futurePaymentViewController = [[PayPalFuturePaymentViewController alloc] initWithConfiguration:self.payPalConfig delegate:self];

       //breaks here when trying to send the config init.


        NSLog(@"\n\n\nafter initializtion of paypal future payment view controller\n\n\n");

        [self presentViewController:futurePaymentViewController animated:YES completion:nil];
        NSLog(@"after present");
 }

我得到的错误是:

 PAYPAL CONFIG::::   <PayPalConfiguration: 0x7fb23e212af0>


 2014-10-12 16:31:38.979 Project[2161:69146] -[PayPalFuturePaymentViewController       payPalServiceManager]: unrecognized selector sent to instance 0x7fb23e2207d0
 2014-10-12 16:31:38.981 Project[2161:69146] *** Terminating app due to uncaught exception     'NSInvalidArgumentException', reason: '-[PayPalFuturePaymentViewController payPalServiceManager]:      unrecognized selector sent to instance 0x7fb23e2207d0'
 *** First throw call stack:
(
0   CoreFoundation                      0x00000001055bf3f5 __exceptionPreprocess + 165
1   libobjc.A.dylib                     0x0000000105258bb7 objc_exception_throw + 45
2   CoreFoundation                      0x00000001055c650d -[NSObject(NSObject)     doesNotRecognizeSelector:] + 205
3   CoreFoundation                      0x000000010551e7fc ___forwarding___ + 988
4   CoreFoundation                      0x000000010551e398 _CF_forwarding_prep_0 + 120
5   CutInLineSwift                      0x000000010262c0b1 -[PayPalFuturePaymentViewController initWithConfiguration:delegate:] + 361
6   CutInLineSwift                      0x00000001025d28de -[ZZMainViewController getUserAuthorizationForFuturePayments:] + 190
7   UIKit                               0x00000001029639ee -[UIApplication sendAction:to:from:forEvent:] + 75
8   UIKit                               0x0000000102a69bd0 -[UIControl _sendActionsForEvents:withEvent:] + 467
9   UIKit                               0x0000000102a68f9f -[UIControl touchesEnded:withEvent:] + 522
10  UIKit                               0x00000001029a93b8 -[UIWindow _sendTouchesForEvent:] + 735
11  UIKit                               0x00000001029a9ce3 -[UIWindow sendEvent:] + 683
12  UIKit                               0x0000000102976ae1 -[UIApplication sendEvent:] + 246
13  UIKit                               0x0000000102983bad _UIApplicationHandleEventFromQueueEvent + 17370
14  UIKit                               0x000000010295f233 _UIApplicationHandleEventQueue + 1961
15  CoreFoundation                      0x00000001054f4ad1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
16  CoreFoundation                      0x00000001054ea99d __CFRunLoopDoSources0 + 269
17  CoreFoundation                      0x00000001054e9fd4 __CFRunLoopRun + 868
18  CoreFoundation                      0x00000001054e9a06 CFRunLoopRunSpecific + 470
19  GraphicsServices                    0x00000001071eb9f0 GSEventRunModal + 161
20  UIKit                               0x0000000102962550 UIApplicationMain + 1282
21  CutInLineSwift                      0x00000001025d093e top_level_code + 78
22  CutInLineSwift                      0x00000001025d097a main + 42
23  libdyld.dylib                       0x0000000105f93145 start + 1
 )
  libc++abi.dylib: terminating with uncaught exception of type NSException

这不应该破坏,因为与示例项目没有什么不同,但我不知道为什么会这样。请帮帮我,谢谢!

1 个答案:

答案 0 :(得分:1)

戴夫来自PayPal。

我相信您的问题将通过我们integration instructions的第3步解决:

  

在项目的构建设置中(在TARGETS部分,而不是PROJECTS部分):

     
      
  • -lc++ -ObjC添加到Other Linker Flags
  •   

另外,请注意我们的示例代码Step 1,这表示在调用其他方法之前必须先调用[PayPalMobile initializeWithClientIdsForEnvironments:]来初始化SDK。