0
FB 및 Twitter 게시를 모두 사용하도록 앱을 업그레이드했습니다 ... 원래 Twitter 기능에서 업그레이드했지만 지금은 FBSheet 및 Twitter 시트가 올 때 메시지를 게시하면 앱의 초점이 사라지고 더 이상 그 아래의 화면에 액세스 할 수 없습니다. 게시물에 대한 내 사례 설명은 다음과 같습니다. 나는 명백한 것을 찾을 수 없습니다.iOS 6.1에서 social.h 기능을 사용할 때 입력 기능 손실
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;
}
의견이 있으십니까?
.. 나는 많은 코드를 정리 할 수있었습니다 좋아 .. (심지어 전환을 중복 것을 발견했다 간단한 If 문 집합으로 돌아가서) 문제는 Twitter와 Facebook이 모두 활성화 된 경우에만 발생합니다. 트위터 게시물이 너무 빨라서 페이스 북에 내 계정에 교차 게시 된 것 같습니다 ...이 시점에서 나는 화면 잠금을 얻을 수 있습니다. –