0

アプリケーションに instagram を実装しています。「https://github.com/crino/instagram-ios-sdk」のコードに従っています。

このコードは正常に機能しており、Instagram 呼び出しはアプリ デリゲートで行われます。"self.instagram = [[Instagram alloc] initWithClientId:APP_ID delegate:nil]"

しかし、アプリデリゲートではなくビューコントローラーでこれを使用したいです。それをしようとすると、「-(void)authorize:(NSArray *)scopes」メソッドが呼び出されないため、Instagram が読み込まれません。

これを解決する方法を教えてください。

4

2 に答える 2

0

解決策を見つけました。私のコード:

    self.webView = [[UIWebView alloc] initWithFrame:self.view.bounds];

     self.webView.delegate = self;

 NSURLRequest* request = [NSURLRequest requestWithURL:[NSURL URLWithString: [NSString stringWithFormat:kAuthenticationEndpoint, kClientId, kRedirectUrl]]];

 [self.webView loadRequest:request];

 [self.view addSubview:self.webView];

どこ:kAuthenticationEndpoint=@"https://instagram.com/oauth/authorize/?client_id=%@&redirect_uri=%@&response_type=token%22;

于 2013-08-06T13:54:15.093 に答える
-2

私のコード:

    UIWebView *webViewInstagram = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
    webViewInstagram.delegate = self;
    [webViewInstagram setDelegate:self];
    [self.view addSubview:webViewInstagram]; 

    NSString *urlRedirect = @"REDIRECT_URL";
    NSString *clientId = @"CLIENT_ID";
    NSString *url = [NSString stringWithFormat:@"https://instagram.com/oauth/authorize/?client_id=%@&redirect_uri=%@&response_type=token",clientId, urlRedirect];

    NSURLRequest* request = [NSURLRequest requestWithURL:[NSURL URLWithString: url] cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:30];

   [webViewInstagram loadRequest:request];
于 2014-12-02T00:54:14.603 に答える