有没有任何方法可以检测用户是否真的按下了应用程序中的推特/脸书帖子按钮



我正在努力为那些在推特上发布我的广告消息或在Facebook上发布我广告消息的用户提供"奖励积分"。如何检测是否…

1) 用户真的按下了帖子按钮(这样我就可以在应用程序中给他们加分)?

2) 用户没有更改消息框(我的广告)中的任何文本?

附带说明一下,是否可以使这些消息框不可编辑?这是我的代码,可以实际呈现要发布的每个消息:

- (IBAction)tweetButtonPressed:(id)sender
{
    if([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
    {
        SLComposeViewController *tweetSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
        [tweetSheet setInitialText:@"My advertisement message goes here."];
        [self presentViewController:tweetSheet animated:YES completion:nil];
    }
    else
    {
        UIAlertView *alertView = [[UIAlertView alloc]
                                  initWithTitle:@"Twitter Connection Failed"
                                  message:@"Make sure your device has an internet connection and you are connected to Twitter through your iPhone settings."
                                  delegate:self
                                  cancelButtonTitle:@"OK"
                                  otherButtonTitles:nil];
        [alertView show];
    }
}

- (IBAction)facebookPostButtonPressed:(id)sender
{
    if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
    {
        SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
        [controller setInitialText:@"My advertisement message goes here."];
        [self presentViewController:controller animated:YES completion:nil];
    }
    else
    {
        UIAlertView *alertView = [[UIAlertView alloc]
                                  initWithTitle:@"Facebook Connection Failed"
                                  message:@"Make sure your device has an internet connection and you are connected to Facebook through your iPhone settings."
                                  delegate:self
                                  cancelButtonTitle:@"OK"
                                  otherButtonTitles:nil];
        [alertView show];
    }
}

您可以使用completon hander来知道他是否按下了帖子按钮,但您无法知道帖子的内容。如果你真的想,你需要自己实现facebook,你甚至可以查看帖子的隐私。我这么说是因为当应用程序要求我发布时,我总是以"私人"的身份发布,所以没有人看到,但我仍然可以获得"奖金"。

Apple Docs

Possible values for the result parameter of the completionHandler property.
Declaration
OBJECTIVE-C
typedef NS_ENUM (NSInteger,
   SLComposeViewControllerResult ) {
   SLComposeViewControllerResultCancelled,
   SLComposeViewControllerResultDone 
 };
Constants
SLComposeViewControllerResultCancelled
The view controller is dismissed without sending the post. For example, the user selects Cancel or the account is not available.
Available in iOS 6.0 and later.
SLComposeViewControllerResultDone
The view controller is dismissed and the message is being sent in the background. This occurs when the user selects Done.
Available in iOS 6.0 and later.

https://developer.apple.com/library/ios/documentation/NetworkingInternet/Reference/SLComposeViewController_Class/#//apple_ref/c/tdef/SLComposeViewControllerResult

最新更新