2017-06-29 63 views
0

我有我的傳出和傳入的URIInstagram的重定向URI不匹配,註冊URI iOS應用

self.outgoingRedirect = @"https://courseera.com"; 
self.incomingRedirect = @"https://myscheme.com"; 

和代碼的其餘部分看起來像這 -

[[NXOAuth2AccountStore sharedStore] 
    setClientID:@"xxx" 
    secret:@"xxx" 
authorizationURL:[NSURL 
URLWithString:@"https://api.instagram.com/oauth/authorize"] 
tokenURL:[NSURL 
URLWithString:@"https://api.instagram.com/oauth/access_token"] 
redirectURL:[NSURL URLWithString:self.outgoingRedirect] 
forAccountType:@"Instagram"]; 

返回YES; }

(BOOL) application:(UIApplication)app openURL:(NSURL *)url options: 
(NSDictionary *)options{ 

if([self.incomingRedirect containsString:[url scheme] ] && 
[self.incomingRedirect containsString:[url host]]){ 

NSURL *constructed = [NSURL URLWithString:[NSString 
stringWithFormat:@"%@?%@",self.outgoingRedirect,[url query]]]; 
NSLog(@"We received a callback URL"); 
return [[NXOAuth2AccountStore sharedStore] 
handleRedirectURL:constructed]; 
} 

else{ 

return [[NXOAuth2AccountStore sharedStore] handleRedirectURL:url]; 
} 
}; 

我得到一個錯誤「重定向URI不匹配註冊重定向URI。」

+0

你在你的應用程序的Instagram開發門戶中輸入了什麼重定向URI? –

+0

我已將URI添加爲http://myscheme.com – sarah

回答

0

問題是,Instagram只是將您重定向到myscheme.com。相反,你需要在instagram.html網頁被擊中試圖重定向到igCLIENTID://authorize IOS會認識到這一點,並且知道烏爾應用程序將處理做設定烏爾redirectURIhttps://myscheme.com/instagram.html?igCLIENTID://authorize並在項目中設置UR爲instagramredirect uriigCLIENTID://authorize和烏爾myScheme網站是什麼這將啓動你的應用程序。 Instagram只是開始執行此操作,您以前可能無法使用httpsredirect uri,但情況不再如此。

相關問題