【发布时间】:2014-10-13 13:17:03
【问题描述】:
我正在使用以下字符串在我的应用程序的 facebook 帖子中格式化 URL。
NSString *stringAppURLFormatted = [NSString stringWithFormat:@"<a href= 'https://www.facebook.com'> New Game Name </a>"];
输出是
<a href= 'https://www.facebook.com'> New Game Name </a>
虽然我期待输出是
New Game Name
如何纠正?
更新
基本上,我使用下面的代码,将NSString 添加到NSMutableDictionary。我不太确定如何将已被广泛推荐的UIActivityViewController 方法应用于此方法。
-(void)postPictureWithText:(UIImage*)picture withTitle:(NSString*) title andDescription (NSString*)description
{
NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
//NSDictionary* paramsImmutable = params.copy;
NSString *stringAppURLFormatted = [NSString stringWithFormat:@"<a href= 'https://www.facebook.com'> New Game Name </a>"];
[params setObject:stringAppURLFormatted forKey:@"message"];
[params setObject:UIImagePNGRepresentation(picture) forKey:@"picture"];
[FBRequestConnection startWithGraphPath:@"me/photos"
parameters:params
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error)
{
if (error)
{
//failure
NSLog(@"ERROR in posting to facebook");
}
else
{
//success
NSLog(@"Result after posting image successfully = %@",result);
}
// button.enabled = YES;
}];
}
【问题讨论】:
-
我刚刚更新了问题
标签: ios objective-c nsstring