-3

こんにちは、私はiOS用のアプリを作成するのが初めてなので、質問が少しばかげている場合は申し訳ありません。Facebookにログインして友達リストを取得することが一部にすぎないアプリを作成しようとしているので、Facebookから開発者に提供する例を使用したいのですが、次のようないくつかのメソッドを持つappDelegateファイルがあります。


#import "FPAppDelegate.h"
#import "FPViewController.h"
@implementation FPAppDelegate
@synthesize window = _window;
@synthesize rootViewController = _rootViewController;
- (BOOL)application:(UIApplication *)application
 .......
    return [FBSession.activeSession handleOpenURL:url]; 
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [FBFriendPickerViewController class];
    ........

    return YES;
}
- (void)applicationWillTerminate:(UIApplication *)application {
    [FBSession.activeSession close];
}

そして、hファイルとmファイルを含むFPViewControllerのxibファイルがあるので、この例をアプリで使用するためのより良い方法は、2つのappDelegateファイルを使用できないことを理解し、UIResponderであるFPAppDelegateをUIViewControllerクラスに変更しようとしていますこのように私のアプリのどこかからそれをプッシュするには:

- (IBAction)loginFacebook:(id)sender
{
        NSLog(@"Facebook");
   delegateViewController *appDelegate = [[delegateViewController alloc] initWithNibName:nil bundle:NULL];
    [self.navigationController pushViewController: appDelegate animated:YES];
}

ここで、delegateViewControllerは、次のように変更した例のFPAppDelegateです。

#import "delegateViewController.h"
#import "AppDelegate.h"
#import "FPViewController.h"
@interface delegateViewController ()
@end
@implementation delegateViewController
@synthesize window2=_window2;
@synthesize rootViewController2=_rootViewController2;
- (BOOL)application:(UIApplication *)application
     ......
    return [FBSession.activeSession handleOpenURL:url];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [FBFriendPickerViewController class];
    ......
    self.window2 = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window2.rootViewController = navigationController;
    [self.window2 makeKeyAndVisible];
    return YES;
}
- (void)applicationWillTerminate:(UIApplication *)application {
   ........
    [FBSession.activeSession close];
}

しかし、それは機能していないので、xibファイルも変更する必要がある場合はどうなりますか?または、プロジェクトのappDelegateファイルを変更しますか?または、私のアプリでこの例を使用する別の方法がありますか?これを説明してほしい。

4

1 に答える 1

0

UIKitフレームワークを理解してiOSアプリの開発を開始できるように、Appleチュートリアルを実行することから始める必要があります。

http://developer.apple.com/library/ios/#referencelibrary/GettingStarted/RoadMapiOS/chapters/Introduction.html

于 2013-01-27T02:43:24.140 に答える