Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone SLComposeViewController_Iphone_Ios_Facebook_Social - Fatal编程技术网

Iphone SLComposeViewController

Iphone SLComposeViewController,iphone,ios,facebook,social,Iphone,Ios,Facebook,Social,我想在facebook上发布一些没有图像的东西,但当我发布图像时,它不起作用,并发出错误警报。但当我在帖子中添加图像时,它会成功发布。所有我想我张贴没有图像。有没有办法做到这一点 尝试摆脱SLComposeViewController的alloc和init行,因为您正在使用类方法ComposeViewController ForService Type重新创建,该类方法返回自动释放的对象。。。。。(除非在ARC下) 所以看起来是这样的: -(IBAction)post:(id)sender {

我想在facebook上发布一些没有图像的东西,但当我发布图像时,它不起作用,并发出错误警报。但当我在帖子中添加图像时,它会成功发布。所有我想我张贴没有图像。有没有办法做到这一点

尝试摆脱SLComposeViewController的alloc和init行,因为您正在使用类方法ComposeViewController ForService Type重新创建,该类方法返回自动释放的对象。。。。。(除非在ARC下)

所以看起来是这样的:

-(IBAction)post:(id)sender
{
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
    mySocialComposer = [[SLComposeViewController alloc]init];
    mySocialComposer = [SLComposeViewController    
    composeViewControllerForServiceType:SLServiceTypeFacebook];
    [mySocialComposer setInitialText:@"Hello World"];
    [mySocialComposer addImage:[IIImage imageNamed:@"myImage.png"]];

    [self presentViewController:mySocialComposer animated:YES completion:nil];
 }

 [mySocialComposer setCompletionHandler:^(SLComposeViewControllerResult result){

    NSString *outout = [[NSString alloc] init];

    switch (result) {
        case SLComposeViewControllerResultCancelled:
            outout = @"Post Cancled";
            break;
            case SLComposeViewControllerResultDone:
            outout = @"Post Done";

        default:
            break;
    }
    UIAlertView *myalertView = [[UIAlertView alloc]initWithTitle:@"FaceBook"  
    message:outout delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
    [myalertView show];
    }];


}

否则,代码在我看来很好,除非您在其他地方使用此
mySocialComposer
实例进行操作

您第二次这样做是因为您的internet正在工作。在您多次按下按钮后,这种情况是否会持续发生?是的,internet正在工作,并且在按下一次按钮后,这种情况会持续发生。请尝试摆脱SLComposeViewController的alloc和init行,因为您正在使用类方法composeViewControllerForServiceType重新创建,该类方法返回一个自动删除的对象……我也这样做了,但我遇到了同样的问题。以及错误消息。“:CGImageCreate:无效的图像大小:0 x 0。”提示为空。我没有使用弧。但是我发现了一个问题,我没有用它来添加图像,如果我用它来添加图像,它可以正常工作多次。但是我不想用它来添加图像,所以有没有办法不用添加图像就可以做到这一点:)查看本教程:Null这是我遵循的同一个教程。我的问题是,我想在没有任何图像或url的情况下发表这篇文章。为此,我注释掉[myllcomposersheet addImage:[UIImage imagename:@“image”];[mySLComposerSheet addURL:[NSURL URLWithString:@];执行此操作时,我收到错误:CGImageCreate:无效图像大小:0 x 0。在控制台中。
-(IBAction)post:(id)sender
{
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
mySocialComposer = [SLComposeViewController    
composeViewControllerForServiceType:SLServiceTypeFacebook];
[mySocialComposer setInitialText:@"Hello World"];

[self presentViewController:mySocialComposer animated:YES completion:nil];
 }

 [mySocialComposer setCompletionHandler:^(SLComposeViewControllerResult result){
NSString *outout = [[NSString alloc] init];

switch (result) {
    case SLComposeViewControllerResultCancelled:
        outout = @"Post Cancled";
        break;
        case SLComposeViewControllerResultDone:
        outout = @"Post Done";

    default:
        break;
}
UIAlertView *myalertView = [[UIAlertView alloc]initWithTitle:@"FaceBook"  
message:outout delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
[myalertView show];
}];