gpt4 book ai didi

iphone - 将照片发布到 Facebook

转载 作者:行者123 更新时间:2023-12-03 21:06:47 25 4
gpt4 key购买 nike

我正在努力寻找一些在 Facebook 上发布的示例代码。下面是我找到的代码。但是,我可以知道如何修改它以便我发布图像而不是文本吗?

FBStreamDialog* dialog = [[[FBStreamDialog alloc] init] autorelease];
dialog.userMessagePrompt = @"Enter your message:";
dialog.attachment = [NSString stringWithFormat:@"{\"name\":\"%@ got straight A's!\",\"href\":\"http://www.raywenderlich.com/\",\"caption\":\"%@ must have gotten real lucky this time!\",\"description\":\"\",\"media\":[{\"type\":\"image\",\"src\":\"http://www.raywenderlich.com/wp-content/themes/raywenderlich/images/logo.png\",\"href\":\"http://www.raywenderlich.com/\"}]}", _facebookName, _facebookName];
dialog.actionLinks = @"[{\"text\":\"Get MyGrades!\",\"href\":\"http://www.raywenderlich.com/\"}]";
[dialog show];

此外,我尝试发布的图像是重叠图像。这意味着它上面没有文件名。它是声明为 imageall 的属性,如下代码所示。

CGRect subviewFrame3 = [self.comment.superview convertRect:self.comment.frame toView:self.imageall]; [self.imageall addSubview:self.comment]; self.comment.frame = subviewFrame3;

UIGraphicsBeginImageContext(self.imageall.frame.size);
[self.imageall.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsGetCurrentContext();

self.outputView.image = image;

非常感谢。

最佳答案

给你

- (void)uploadPhoto:(id)target {

//Just for demonstration.
NSString *path = @"http://www.facebook.com/images/devsite/iphone_connect_btn.jpg";
NSURL *url = [NSURL URLWithString:path];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *img = [[UIImage alloc] initWithData:data];
NSDictionary *params = nil;
[[FBRequest requestWithDelegate:self] call:@"facebook.photos.upload" params:params dataParam:(NSData*)img];

}

关于iphone - 将照片发布到 Facebook,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6394898/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com