1
是否可以將圖片上傳到相冊幷包含小型html代碼作爲標題?iOS:將照片發佈到Facebook和小型html作爲標題
我想使用新的Graph API來做到這一點。
以下代碼有效,但是當我將我的文本變量設置爲html代碼時,標題顯示爲純文本,並且所有的html標籤都可見。
另外,在下面的代碼中,當item.text不爲null時,its.title會被完全忽略。
if (item.shareType == SHKShareTypeImage && item.image)
{
if (item.title)
NSLog(@"title = %@", item.title);
[params setObject:item.title forKey:@"caption"];
if (item.text) {
NSString *mytext = [NSString stringWithFormat:@"%@\n\nCreated by iPhone app FaceMod: %@", item.text,appURL];
[params setObject:mytext forKey:@"message"];
}
[params setObject:item.image forKey:@"picture"];
// There does not appear to be a way to add the photo
// via the dialog option:
[[SHKFacebook facebook] requestWithGraphPath:@"me/photos"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
[self retain]; //must retain, because FBConnect does not retain its delegates. Released in callback.
return YES;
}
我的理解是,後置HTML的方式就是使用「動作」鍵:
NSString *actions = [NSString stringWithFormat:@"{\"name\":\"%@ %@\",\"link\":\"%@\"}",
SHKLocalizedString(@"Get"), SHKCONFIG(appName), SHKCONFIG(appURL)];
[params setObject:actions forKey:@"actions"];
但是,這並不工作,要麼和「行動」的html代碼會被忽略,並且不Facebook的出現。
感謝您的幫助。