Braintree iOS SDK说没有已知的类方法

时间:2015-04-28 10:33:41

标签: ios xcode braintree

我收到此错误。任何人吗?

-(void)clientToken{

NSURL *clientTokenURL = [NSURL URLWithString:@"http://tectutiveclients.com/projects/carboss/api/getToken"];

 NSMutableURLRequest *clientTokenRequest = [NSMutableURLRequest requestWithURL:clientTokenURL];

[clientTokenRequest setValue:@"text/plain" forHTTPHeaderField:@"Accept"];

 [NSURLConnection
 sendAsynchronousRequest:clientTokenRequest
 queue:[NSOperationQueue mainQueue]
 completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
     // TODO: Handle errors in [(NSHTTPURLResponse *)response statusCode] and connectionError
   clientToken = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];

     // Initialize `Braintree` once per checkout session


       [Braintree setupWithClientToken:clientToken
       completion:^(Braintree *braintree, NSError *error) {
           UIViewController *dropin = [braintree dropInViewControllerWithDelegate:self];
           [self presentViewController:[[UINavigationController alloc] initWithRootViewController:dropin]
                              animated:YES
                            completion:nil];

       // No known class method for selector setupwithClientToken Error

       }];


     UIViewController *dropin = [self.braintree dropInViewControllerWithDelegate:self];
     [self presentViewController:[[UINavigationController alloc] initWithRootViewController:dropin]
                        animated:YES
                      completion:nil];
     }];
}

1 个答案:

答案 0 :(得分:4)

我在Braintree工作。如果您还有其他问题,请get in touch with our support team

这是文档中的不准确之处。相反,请使用braintreeWithClientToken:

示例:

NSString *clientToken = [[NSString alloc] initWithData:data 
                                              encoding:NSUTF8StringEncoding];

// Initialize `Braintree` once per checkout session
self.braintree = [Braintree braintreeWithClientToken:clientToken];

感谢您指出这一点!文档将很快更新。