ios - uploading to the wrong URL? when integrate Google drive and youtube API in objective c -
I tried to integrate Google driver and YouTube API into a single driver. Integrated both APIs to upload videos successfully
I logged in using Google Drive and uploaded the video to Google Drive successfully. While trying to upload a video to YouTube, with the same login, I'm getting under the error
The same scenario is also the sub-contrast.
Exclude the application 'NSInternalInconsistencyException' due to exception exception, 'Unexpected response data (upload to wrong URL?)'
Below is the code used for authentication.
If (@ "youtube" is avastostring: TYPE) {self.youtubeService = [[GTLServiceYouTube alloc] in this]; Self.youtubeService.authorizer = [GTMOAuth2ViewControllerTouch authForGoogleFromKeychainForName: kKeychainItemName Client ID: kClientID Client Secret: kClientSecret]; If (! [Has the right of himself]) {// is not authorized yet, request authorization and press Login UI on the navigation stack. [[Self-Navigation Controller] Push ViewController: [Make Self-Controller] Animated: Yes]; } Else {// my code}} if (@ "drive" isEqualToString: type) {self.driveService = [[GTLServiceDriver alloc] init]; Self.driveService.authorizer = [GTMOAuth2ViewControllerTouch authForGoogleFromKeychainForName: kKeychainItemName client ID: kClientID client secret: kClientSecret]; If (! [The Authorized Driver]] {// is not authorized yet, request authorization and press Login UI on the navigation stack. [[Self-Navigation Controller] Push ViewController: [Self-Creating Ord Controller Driver] Animated: Yes]; } Else {// my code}} // do makes Eighth controller to authorize access to YouTube - (GTMOAuth2ViewControllerTouch *) createAuthController {GTMOAuth2ViewControllerTouch * authController; AuthController = [[GTMOAuth2ViewControllerTouch alloc] initWithScope: kGTLAuthScopeYouTube client ID: kClientID client seat: kClientSecret Key Cihnaitmnam: Kekecanitm Name of Representative: Self finished selector: @selector (viewController: finishedWithAuth: error :)]; Return authController; } // Complete the authentication process, and updates the YouTube service with new credentials. - (void) ViewController: (GTMOAuth2ViewControllerTouch *) ViewController finishedWithAuth: (GTMOAuth2Authentication *) authResult error: (NSError *) error {if (error = zero!) {[Utils showAlert: @ "Internal Server Error" message: error.localizedDescription]; Self.youtubeService.authorizer = Zero; } And {self.youtubeService.authorizer = authResult; }} // Creates Athens controller to authorize access to Google Drive - (GTMOAuth2ViewControllerTouch *) createAuthControllerDriver {GTMOAuth2ViewControllerTouch * authController; AuthController = [[GTMOAuth2ViewControllerTouch alloc] initWithScope: kGTLAuthScopeDrive client ID: kClientID client secret: kClientSecret Key Cihnaitmnam: Kekecanitm Name of Representative: Self finished Editor: @selector (viewController: finishedWithAuth: error :)]; Return authController; } // To complete the authentication process, and update the drive service with new credentials // - (void) ViewController: (GTMOAuth2ViewControllerTouch *) ViewController finishedWithAuthDriver: (GTMOAuth2Authentication *) authResult error: (NSError *) error {if (error = zero!) {[Utils showAlert: @ "Internal Server Error" message: error.localizedDescription]; Self.driveService.authorizer = Zero; } And {self.driveService.authorizer = authResult; }} // Check if user is authorized - (BOOL) is authorized {return ((GTMOAuth2Authentication *) self.youtubeService.authorizer); } - (BOOL) is the authorized driver {return ((GTMOAuth2Authentication *) self.driveService.authorizer); }
I check the URL for the existing scope of authority and the same credentials used to log I I think it may be a problem, there is no telling How can I solve it? This is the reason why I do not have access to both API access.
It has been defined both the scope should be fine for the same OAuth2, both from the The services were started I can not see the whole code here, but you can reuse one of the parameters.
There is a complete sample for YouTube uploads that can be compared to your code:
Comments
Post a Comment