FB と Twitter の両方の投稿を使用するようにアプリをアップグレードしています...元の Twitter 機能からアップグレードしましたが、FBSheet と Twitter シートが表示され、メッセージを投稿すると、アプリがフォーカスを失い、できなくなりました。その下の画面にアクセスします。投稿に対する私のケースステートメントは次のとおりです...明白なものは何も見つかりません。
int social_status = 0;
if (twitterEnabled) {
social_status=1;
}
if (facebookEnabled) {
social_status=2;
}
if (twitterEnabled && facebookEnabled) {
social_status = 3;
}
switch (social_status ) {
case kTwitterOn:{
SLComposeViewController *tweetSheet =[[SLComposeViewController alloc] init];
// Sets viewcontroller to twitter type
tweetSheet=[SLComposeViewController composeViewControllerForServiceType: SLServiceTypeTwitter];
SLComposeViewControllerCompletionHandler __block completionHandler=^(SLComposeViewControllerResult result){
[tweetSheet dismissViewControllerAnimated:YES completion:nil];
switch(result){
case SLComposeViewControllerResultCancelled:
default:
{
NSLog(@"Cancelled.....");
}
break;
case SLComposeViewControllerResultDone:
{
NSLog(@"Posted....");
}
break;
}};
tweetSheet=[SLComposeViewController composeViewControllerForServiceType: SLServiceTypeTwitter];
[tweetSheet setInitialText:message];
[tweetSheet setCompletionHandler:completionHandler];
[self presentViewController:tweetSheet animated:YES completion:nil];
tweetSheet=nil;
}
break;
case kFacebookOn: {
SLComposeViewController *faceBookSheet=[[SLComposeViewController alloc] init];
// Sets viewcontroller to FB type
faceBookSheet=[SLComposeViewController composeViewControllerForServiceType: SLServiceTypeFacebook];
SLComposeViewControllerCompletionHandler __block completionHandler=^(SLComposeViewControllerResult result){
[faceBookSheet dismissViewControllerAnimated:YES completion:nil];
switch(result){
case SLComposeViewControllerResultCancelled:
default:
{
NSLog(@"Cancelled.....");
}
break;
case SLComposeViewControllerResultDone:
{
NSLog(@"Posted....");
}
break;
}
};
//Calls the function for set Text
[faceBookSheet setInitialText:message];
[faceBookSheet setCompletionHandler:completionHandler];
//Presenting the FB sheet
[self presentViewController:faceBookSheet animated: YES completion: nil];
faceBookSheet=nil;
}
break;
case kTwitterAndFacebookOn:{
SLComposeViewController *tweetSheet =[[SLComposeViewController alloc] init];
// Sets viewcontroller to twitter type
tweetSheet=[SLComposeViewController composeViewControllerForServiceType: SLServiceTypeTwitter];
SLComposeViewControllerCompletionHandler __block completionHandler=^(SLComposeViewControllerResult result){
[tweetSheet dismissViewControllerAnimated:YES completion:nil];
switch(result){
case SLComposeViewControllerResultCancelled:
default:
{
NSLog(@"Cancelled.....");
}
break;
case SLComposeViewControllerResultDone:
{
NSLog(@"Posted....");
}
break;
}
};
tweetSheet=[SLComposeViewController composeViewControllerForServiceType: SLServiceTypeTwitter];
[tweetSheet setInitialText:message];
[tweetSheet setCompletionHandler:completionHandler];
[self presentViewController:tweetSheet animated:YES completion:nil];
tweetSheet=nil;
SLComposeViewController *faceBookSheet=[[SLComposeViewController alloc] init];
// Sets viewcontroller to FB type
faceBookSheet=[SLComposeViewController composeViewControllerForServiceType: SLServiceTypeFacebook];
SLComposeViewControllerCompletionHandler __block completionHandler2=^(SLComposeViewControllerResult result){
[faceBookSheet dismissViewControllerAnimated:YES completion:nil];
switch(result){
case SLComposeViewControllerResultCancelled:
default:
{
NSLog(@"Cancelled.....");
}
break;
case SLComposeViewControllerResultDone:
{
NSLog(@"Posted....");
}
break;
}
};
//Calls the function for set Text
[faceBookSheet setInitialText:message];
[faceBookSheet setCompletionHandler:completionHandler2];
//Presenting the FB sheet
[self presentViewController:faceBookSheet animated: YES completion: nil];
faceBookSheet=nil;
}
break;
default:
{
// We show this Alert if there is no Twitter Enablement
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Quorum Reached" message:message delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil];
[alert show];
}
break;
}
助言がありますか?