venmo / venmo-ios-sdk

Make and accept payments in your iOS app via Venmo
MIT License
178 stars 57 forks source link

Venmo iOS sdk crashing application, when Venmo returning back to app after login to Venmo from safari #87

Open userdivya opened 9 years ago

userdivya commented 9 years ago

I am using Venmo iOS sdk in my application, i have done pod file installation and all. I have Venmo app id and secret key, using same i am able to login to venmo from the sample app provided by Venmo, but if i use same app id and secret key in my application then it is getting crashed in "startLoading" method in "VENURLProtocol.m" class. Getting '[NSURL queryDictionary]: unrecognized selector sent to instance' this error.

Below is the method in which my app is crashing.This method gets executed after clicking on Allow button on Venmo login page. (in safari)

-(void)startLoading {

NSString *host = [self.request.URL host];

NSLog(@"self.request.URL = %@",self.request.URL);

NSDictionary *queryDictionary = [self.request.URL queryDictionary];  ///////Application is crashing here

if ([host isEqualToString:@"oauth"]) {

    NSString *oAuthErrorCode = [queryDictionary valueForKey:@"error"];

    if (oAuthErrorCode) {
        NSString *oAuthErrorMessage = queryDictionary[@"message"] ?: @"";
        NSError *oAuthError = [NSError errorWithDomain:VenmoSDKDomain
                                                  code:VENSDKErrorTransactionFailed
                                           description:oAuthErrorMessage
                                    recoverySuggestion:@"Please try again."];
        if ([Venmo sharedInstance].OAuthCompletionHandler) {
            [Venmo sharedInstance].OAuthCompletionHandler(NO, oAuthError);
        }

Help me if anyone has used the Venmo iOS sdk and faced this kind of error.

Thanks in advance.