有什么方法可以检测用户是否实际按下了应用程序中的 Twitter/Facebook post 按钮?
Is there any way to detect if a user actually pressed the Twitter/Facebook post button in app?
我正在尝试为在 Facebook 上发布我的广告消息或 post 我的广告消息的用户提供 "bonus points"。我如何检测是否...
1) 用户实际上按下了post按钮(这样我就可以在应用程序中给他们奖励积分)?
2) 用户没有更改消息框的任何文字(我的广告)?
附带说明一下,是否可以将这些消息框设置为不可编辑?这是我实际将消息呈现给 post 每个人的代码:
- (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];
}
}
你可以通过compliton hander知道他是否按下了post按钮,但是你无法知道post的内容是什么。
如果你真的想要,你需要自己实现 facebook,你甚至可以检查 post 的隐私。
我这样说是因为当一个应用程序要求我 post 我总是这样做 "Private" 所以没有人看到但我仍然得到 "Bonus".
Apple 文档
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.
我正在尝试为在 Facebook 上发布我的广告消息或 post 我的广告消息的用户提供 "bonus points"。我如何检测是否...
1) 用户实际上按下了post按钮(这样我就可以在应用程序中给他们奖励积分)?
2) 用户没有更改消息框的任何文字(我的广告)?
附带说明一下,是否可以将这些消息框设置为不可编辑?这是我实际将消息呈现给 post 每个人的代码:
- (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];
}
}
你可以通过compliton hander知道他是否按下了post按钮,但是你无法知道post的内容是什么。 如果你真的想要,你需要自己实现 facebook,你甚至可以检查 post 的隐私。 我这样说是因为当一个应用程序要求我 post 我总是这样做 "Private" 所以没有人看到但我仍然得到 "Bonus".
Apple 文档
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.