标签: social-framework

如何为Twitter /行动表制作社交分享例外?

我使用以下代码在我的应用程序中调用操作表共享:

- (IBAction)sendPost:(id)sender
{
    NSArray *activityItems = nil;
    UIImage *appIcon = [UIImage imageNamed:@"appIcon.png"];
    NSString *postText = [[NSString alloc] initWithFormat:@"LETS ASSUME THIS STRING IS LONGER THAN 140 CHARACTERS THAT TWITTER PROHIBITS BUT CAN STILL BE SHARED VIA FACEBOOK, EMAIL, TEXT"];
    activityItems = @[postText,appIcon];
    UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
    [self presentViewController:activityController animated:YES completion:nil];
}
Run Code Online (Sandbox Code Playgroud)

问题是这个:postText超过140个字符,所以不可能通过twitter分享,字符数将是-x(你通过twitter分享的红色字符数),我的问题是:怎么能我做了一个例外,以便shortPostText在选择Twitter进行共享时使用的是另一条消息吗?

一旦你sendPost发送了动作,我就看不到为twitter明确设置字符串的方法了:

在此输入图像描述

编辑:我不明白为什么有人会对这个问题进行投票,我不会问如何制作if/else语句或如何编程.这是一个真正的问题,需要一个真正的答案.

更新:我需要解决这个问题,因为当用户尝试通过我的应用程序中的Twitter共享时,这是我得到的:

在此输入图像描述

红色/负号字符指示符和非活动帖子按钮,因此除非字符数减少到0或更少,否则不允许帖子转到twitter.

twitter objective-c uiactionsheet ios social-framework

8
推荐指数
1
解决办法
1059
查看次数

在尝试获取用户Feed时,社交框架返回"(#803)无法通过用户名(用户名)查询用户"

我正在使用iOs社交框架来从特定用户检索Facebook提要.为此,在进行身份验证后,我正在执行以下操作:

NSURL *requestURL = [NSURL URLWithString:@"https://graph.facebook.com/username"];
SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodGET
                                                  URL:requestURL parameters:nil];
request.account = self.facebookAccount;

[request performRequestWithHandler:^(NSData *data, NSHTTPURLResponse *response, NSError *error) { ... }];
Run Code Online (Sandbox Code Playgroud)

响应返回:

error =     {
        code = 803;
        message = "(#803) Cannot query users by their username (username)";
        type = OAuthException;
    };
Run Code Online (Sandbox Code Playgroud)

如果我使用/me而不是用户名,同样的工作,但我想检索其他公共提要.

我也尝试使用用户的id,这也适用于我的用户,但我不能为其他用户工作,请求返回以下内容:

code = 2500;
        message = "The global ID 100008339709776 is not allowed. Please use the application specific ID instead.";
        type = OAuthException;
Run Code Online (Sandbox Code Playgroud)

我也尝试将访问令牌作为参数传递,但行为是相同的.

有任何想法吗?

facebook objective-c facebook-graph-api social-framework

7
推荐指数
1
解决办法
2万
查看次数

如果未在iOS 6上配置Twitter或Facebook帐户怎么办?

如果他们尚未登录,是否有人知道如何让用户输入他们的Facebook或Twitter帐户登录信息?例如,用户尝试使用Facebook登录我的应用程序,而无需在iOS设置中配置Facebook帐户.例如,我可以要求他以警报方式进行此操作,但是如何将他带到设置的确切部分呢?

twitter facebook ios ios6 social-framework

6
推荐指数
1
解决办法
3633
查看次数

iOS 7 SLComposeViewController:检查是否实际发布了推文?

我目前正在使用SLComposeViewController将用户的分数发布到twitter或facebook(取决于他们点击的按钮).当他们分享时,他们会获得虚拟货币奖励.我面临的问题是它只会告诉我用户是否点击发送或取消.如何检查推文是否实际发布到Twitter?这将有助于打击用户尝试两次提交相同推文的情况(twitter不允许).

这是我现在的代码:

//Check if user can send tweet
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) {
SLComposeViewController *tweetSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];

tweetSheet.completionHandler = ^(SLComposeViewControllerResult result) {
switch(result) {
     //This means the user cancelled without sending the Tweet
     case SLComposeViewControllerResultCancelled:
          NSLog(@"User Canceled");
          break;

     //This means the user hit 'Send'
     case SLComposeViewControllerResultDone:
     NSLog(@"User Tapped Send");
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{

     //Show alert & reward user here

     break;
     }                  
     dispatch_async(dispatch_get_main_queue(), ^{
         [self dismissViewControllerAnimated:NO completion:^{
         NSLog(@"Tweet Sheet has been dismissed.");
         }];
     });
     };
         [tweetSheet setInitialText:[NSString stringWithFormat:@"Just scored …
Run Code Online (Sandbox Code Playgroud)

twitter objective-c ios social-framework

6
推荐指数
1
解决办法
626
查看次数

在非ARC项目中使用TWRequest似乎泄漏

使用TWRequest时,Instruments(Leaks)报告内存泄漏,我无法真正看到我做错了什么.

以下是重现问题的步骤:

创建一个新的Xcode项目(禁用ARC),添加Twitter框架,然后将以下行添加到代码中(例如在viewDidLoad中):

TWRequest *postRequest = [[TWRequest alloc] initWithURL:[NSURL URLWithString:@"http://api.twitter.com/1/statuses/public_timeline.json"] parameters:nil requestMethod:TWRequestMethodGET];

[postRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
    NSLog(@"in performrequest");

    [postRequest release];
}]; 
Run Code Online (Sandbox Code Playgroud)

在使用Instruments(Leaks)分析此代码之后,它告诉我带有"performRequestWithHandler"的行正在泄漏:

仪器截图

标记线

有什么想法可以防止这种泄漏?

我在这里发现了一个类似的问题,但它似乎与我所描述的问题无关.

memory-leaks instruments ios twrequest social-framework

5
推荐指数
1
解决办法
564
查看次数

SLComposeViewController带有屏幕截图但没有图像附件

我注意到Mobile Safari的Twitter和Facebook共享添加了当前页面的屏幕截图而没有实际共享它,例如:

来自Mobile Safari的Twitter分享 Facebook分享来自Mobile Safari

我试图通过SLComposeViewController复制它,但是调用addImage:实际上将UIImage添加到tweet/facebook相册(如预期的那样).

有没有办法只显示页面的屏幕截图而不添加图像?

编辑:看起来SLComposeViewController符合UIAppearanceContainer但是UI_APPEARANCE_SELECTOR没有记录.

objective-c ios ios6 slcomposeviewcontroller social-framework

5
推荐指数
1
解决办法
1676
查看次数

ACAccount Facebook:必须使用活动访问令牌来查询有关当前用户的信息

我正在使用iOS 6 Social框架来访问用户的Facebook数据.我试图用我的应用程序中的当前用户喜欢ACAccountSLRequest.我有一个ACAccount名为的有效Facebook帐户参考,facebook我试图让用户喜欢这样:

SLRequest *req = [SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodGET URL:url parameters:nil];
req.account = facebook;
[req performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
     //my handler code.
}
Run Code Online (Sandbox Code Playgroud)

这里url@"https://graph.facebook.com/me/likes?fields=name";在我的处理程序,我得到这样的响应:

{
error =     {
    code = 2500;
    message = "An active access token must be used to query information about the current user.";
    type = OAuthException;
};
}
Run Code Online (Sandbox Code Playgroud)

框架不应该处理访问令牌吗?我发现了一个类似的帖子通过新的iOS6社交框架查询Facebook用户数据,但是将访问令牌参数硬编码到URL中是没有意义的,因为逻辑上访问令牌/登录检查应该由框架自动处理.在我看过的所有示例中,没有人手动使用访问令牌:

http://damir.me/posts/facebook-authentication-in-ios-6

iOS 6 Facebook发布程序最终以"remote_app_id与存储ID不匹配"错误 等结束.

我使用iOS6专用方法和内置的社交框架,我没有使用Facebook SDK.我错过了什么吗?

谢谢,

能够.

facebook-access-token ios6 acaccount social-framework

5
推荐指数
2
解决办法
2274
查看次数

在iOS 6中,使用社交框架失败了Facebook上的朋友墙

我正在尝试使用iOS 6+中的社交框架在我的facebook朋友墙上发布iOS应用程序的邀请.但它给了我以下错误

error =     {
        code = 200;
        message = "(#200) Feed story publishing to other users is disabled for this application";
        type = OAuthException;
    };
Run Code Online (Sandbox Code Playgroud)

我知道这是由于Facebook禁用Facebook博客此stackoverflow问题中提到的此功能

在stackoverlow的页面上,写入使用feed对话框.但我看不到在Social框架中使用feed对话框的任何选项.

在iOS 6中使用Social Framewrok在朋友墙上进行POST的替代方法是什么?

任何形式的帮助表示赞赏.提前致谢.

facebook-wall facebook-graph-api ios6 social-framework

5
推荐指数
0
解决办法
2250
查看次数

通过iOS App在Twitter上分享视频

是否可以使用SLRequest共享视频?

我可以使用相同的方式共享图像

SLRequest *postRequest = [SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodPOST URL:requestURL parameters:message];

if (isImage)
{
    NSData *data = UIImagePNGRepresentation(imgSelected);
    [postRequest addMultipartData:data withName:@"media" type:@"image/png" filename:@"TestImage.png"];
}

postRequest.account = account;

[postRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error)
{
    if (!error)
    {
        NSLog(@"Upload Sucess !");
    }
}];
Run Code Online (Sandbox Code Playgroud)

twitter video objective-c ios social-framework

5
推荐指数
1
解决办法
5281
查看次数

如何从ios 6中的twitter获取用户信息?

我正在尝试整合Ios 6和twitter以使用slcomposeviewcontroller发送推文,但我无法弄清楚如何从Twitter帐户获取用户信息.

有谁能够帮我?

twitter ios ios6 slcomposeviewcontroller social-framework

4
推荐指数
1
解决办法
5266
查看次数