0

フェイスブック SDK 3.0 を使用して Facebook を統合しました。サンプル コード「HelloFacebookSample」を使用してステータスを投稿しました。AppId を使用して Info.plist ファイルを変更しました。私はarmv7s、armv7アーキテクチャの問題を示す問題を抱えています.YEに「アクティブなアーキテクチャのみをビルドする」ことでそれを解決します。

Facebookのログイン/ログアウト用のボタンを表示するコードがあります

#import "HFViewController.h"

#import "AppDelegate.h"
 #import <CoreLocation/CoreLocation.h>


 @interface HFViewController () <FBLoginViewDelegate>


 @property (strong, nonatomic) IBOutlet UIButton *buttonPostStatus;

 @property (strong, nonatomic) id<FBGraphUser> loggedInUser;

 - (IBAction)postStatusUpdateClick:(UIButton *)sender;


 - (void)showAlert:(NSString *)message
       result:(id)result
        error:(NSError *)error;


 @end

 @implementation HFViewController
 @synthesize shareStringFb;
 @synthesize buttonPostStatus = _buttonPostStatus;

 @synthesize loggedInUser = _loggedInUser;


 - (void)viewDidLoad {    
[super viewDidLoad];

// Create Login View so that the app will be granted "status_update" permission.
self.buttonPostStatus.enabled = YES;

FBLoginView *loginview = [[FBLoginView alloc] init];

loginview.frame = CGRectOffset(loginview.frame, 5, 5);
loginview.delegate = self;

[self.view addSubview:loginview];

[loginview sizeToFit];
statusText.text=self.shareStringFb;
{
    // if the session is closed, then we open it here, and establish a handler for state changes
}

}

 -(IBAction)backClick:(id)sender
 {
[self.view removeFromSuperview];

 }

 - (void)viewDidUnload {

self.buttonPostStatus = nil;

self.loggedInUser = nil;

[super viewDidUnload];
 }



 - (void)loginViewShowingLoggedInUser:(FBLoginView *)loginView {
// first get the buttons set for login mode

  self.buttonPostStatus.enabled = YES;

 }

 - (void)loginViewFetchedUserInfo:(FBLoginView *)loginView
                        user:(id<FBGraphUser>)user {
// here we use helper properties of FBGraphUser to dot-through to first_name and
// id properties of the json response from the server; alternatively we could use
// NSDictionary methods such as objectForKey to get values from the my json object

 self.loggedInUser = user;
 }

 - (void)loginViewShowingLoggedOutUser:(FBLoginView *)loginView {

   self.buttonPostStatus.enabled = NO;

  }

// Post Status Update ボタン ハンドラ - (IBAction)postStatusUpdateClick:(UIButton *)sender {

// Post a status update to the user's feed via the Graph API, and display an alert view 
// with the results or an error.

 NSString *message = [NSString stringWithFormat:@"Updating %@'s status at %@", 
                     self.loggedInUser.first_name, [NSDate date]];

 [FBRequestConnection startForPostStatusUpdate:self.shareStringFb
                            completionHandler:^(FBRequestConnection *connection, id          result, NSError *error) {

                                [self showAlert:message result:result error:error];
                                self.buttonPostStatus.enabled = YES;
                            }];

self.buttonPostStatus.enabled = NO;       

}

// 写真投稿ボタンのハンドラ

シミュレーターではログイン/ログアウトのボタンが1つ表示されますが、デバイスでテストするとそのボタンは表示されません。

何が問題なのか教えてください。なぜそれが表示されないのですか? iOS 5 と 6 の両方に Fb を統合する他の方法はありますか?

4

2 に答える 2

0

この facebook SDK (3.1) for iOS6 に使用し ます

于 2013-01-10T07:12:54.047 に答える