0

FacebookアカウントのOAuth認証が必要なiOSアプリがありますが、API呼び出しには独自のサーバーを使用する必要があります。そこで、特定のボタンがクリックされたときに、ログインURLを使用してFBLogin画面(UIWebView)を開きたいと思います。

私は次のコードを持っています:

FBWebViewController.h

#import <UIKit/UIKit.h>

@interface FBWebViewController : UIViewController <UIWebViewDelegate>
- (void)initFBWebView;
@end

FBWebViewController.m

- (void)initFBWebView {
NSLog(@"DetailViewController->initUIWebView {");

    UIWebView *aWebView;

    //  init and create the UIWebView
    aWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 400)];
    aWebView.autoresizesSubviews = YES;
    aWebView.autoresizingMask=(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth);

    //set the web view delegates for the web view to be itself
    [aWebView setDelegate:self];

    //Set the URL to go to for your UIWebView
    NSString *urlAddress = @"http://www.google.com";

    //Create a URL object.
    NSURL *url = [NSURL URLWithString:urlAddress];

    //URL Requst Object
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];

    //load the URL into the web view.
    [aWebView loadRequest:requestObj];

    //add the web view to the content view
    [self.view addSubview:aWebView];

}

そして私のAuthorize.mファイルでは、すべてのAPI呼び出しなどを処理します。

- (void)fbLogin:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options {
    FBWebViewController *webview = [[FBWebViewController alloc] init];
    [webview view];
    [webview initFBWebView];
}

何も起こりません。WebViewは開かれていません。initWithFbWebViewメソッドにいくつかのデバッグステートメントを配置すると、メソッドが呼び出されて最後まで実行されますが、画面が表示されません。

私は何が間違っているのですか?

4

0 に答える 0