0

私は iOS 開発に非常に慣れていません。ウォール投稿のために Twitter と Facebook を統合する必要があるアプリケーションを作成しています。私はこれに必要なすべてのコーディングを行っており、シミュレーターでは正常に動作していますが、デバイスでは動作していません。

Facebook統合のコーディングとしてのもう1つの質問は、他の「デモ」アプリケーションからコピーしたものです。自分のアプリケーション用にするには、他に何を変更する必要がありますか。Facebookの壁で自分のアプリによって更新が行われたのを見ると、「デモ」アプリ名が投稿に付いています。

ガイドしてください!!よろしくお願いします!!

4

4 に答える 4

1

フェイスブック

ドキュメントを読む前に、コーディング部分にジャンプしたようです。Facebook SDK を統合してコードを記述する前に、Facebook 開発者コンソールで新しいアプリ セクションを作成し、Facebook アプリ ID を取得する必要があります。Facebook デモ アプリケーションに同梱されているアプリ ID ではなく、プロジェクトでそのアプリ ID を使用する必要があります。

ドキュメントはプロセスを完全に説明しています。ここで書き直す必要はありません。必ず最後までお読みください。

ツイッター

ツイッターでも問題が発生しているかどうかはわかりません(質問は不明です)。はいの場合、Twitter への接続方法を教えてください。しかし、一般的に、あなたの質問の調子からすると、それぞれの開発者コンソールでのアプリ セクションの作成とアプリ ID の取得に関するドキュメントを読んでいないようです。

于 2012-11-05T06:49:53.683 に答える
0

共有キットフレームワークを使用できます、 http: //getsharekit.com

于 2012-11-05T09:02:49.727 に答える
0

どれだけの統合が必要か、iOS 6を必要とするかどうかはわかりませんが、iOS 6では、FacebookとTwitterを統合する方がはるかに簡単です。

これがすべてのコードです:

ヘッダーファイル:

#import "Social/Social.h"

メインファイル:

    //Twitter
    if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) {
        SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];

        SLComposeViewControllerCompletionHandler myBlock = ^(SLComposeViewControllerResult result){
            if (result == SLComposeViewControllerResultCancelled) {
                NSLog(@"Cancelled");
            } else {
                NSLog(@"Done!");
            }

            [controller dismissViewControllerAnimated:YES completion:Nil];
        };
        controller.completionHandler = myBlock;

        [controller setInitialText:@"Status Text"];

        [self presentViewController:controller animated:YES completion:Nil];

    } else {
        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Sorry" message:@"You can't send a tweet right now. You must be online and signed into at least one Twitter account." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alertView show];
    }

    //Facebook
    if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {

        SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];

        SLComposeViewControllerCompletionHandler myBlock = ^(SLComposeViewControllerResult result){
            if (result == SLComposeViewControllerResultCancelled) {
                NSLog(@"Cancelled");
            } else {
                NSLog(@"Done!");
            }

            [controller dismissViewControllerAnimated:YES completion:Nil];
        };
        controller.completionHandler = myBlock;

        [controller setInitialText:@""];

        [self presentViewController:controller animated:YES completion:Nil];

    } else {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Facebook Error" message:@"Either you are not logged into Facebook or your Facebook username and password are incorrect." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
        [alert show];
    }
于 2012-11-05T07:04:58.697 に答える
0

アプリケーションにtwitterを統合するに従って、このコードを試してください

self.fullimage に画像の任意の URL を書き込みます。

buildTweetSheet メソッドを呼び出して、twitter に投稿します。

Twitter.framework をインポート

輸入

@property(nonatomic,strong) TWTweetComposeViewController *_tweetSheet;

@synthesize _tweetSheet; -(void)buildTweetSheet { NSLog(@"buildTweetSheet");

_tweetSheet = [[TWTweetComposeViewController alloc] init];


UIImage *eimage=UIImage *eimage=[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:self.fullimage]]];





[_tweetSheet setInitialText:@""];

[_tweetSheet addImage:eimage];

[_tweetSheet setInitialText:@""];

[self presentModalViewController:_tweetSheet animated:YES];

TWTweetComposeViewControllerCompletionHandler completionHandler = ^(TWTweetComposeViewControllerResult result)

{
    if(result == TWTweetComposeViewControllerResultDone) {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Done" message:@"Image Posted Successfully" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alert show];

    }
    else {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Failed" message:@"Image Posted Failed" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alert show];

    }

    [self dismissModalViewControllerAnimated:YES];
};

[_tweetSheet setCompletionHandler:completionHandler];

}

于 2012-11-07T15:02:07.687 に答える