0

I'm creating an game where I have a share button. In this share button I would like to share text and a link. It is important that the user can't edit the text since they would be able to change the score. What is the best solution for this? I've searched, but in most guides, you're able to change the text as a user.

What's the solution?

sangony
  • 11,636
  • 4
  • 39
  • 55
user3423384
  • 667
  • 2
  • 8
  • 18
  • If it's a UITextView, just set the editable property to NO. Or you could just use a UILabel. – CrimsonChris May 08 '14 at 19:38
  • possible duplicate of [Prevent users from modifying part of the text in SLComposeViewController](http://stackoverflow.com/questions/13477970/prevent-users-from-modifying-part-of-the-text-in-slcomposeviewcontroller) – Carl Veazey May 08 '14 at 19:56

1 Answers1

4

The short answer is that you're not supposed to post something on a user's behalf without giving them the option of editing the comment/status. You can do it with an API call (rather than a share sheet), but this should only be used to post content that the user entered elsewhere in the app.

// NOTE: pre-filling fields associated with Facebook posts,
// unless the user manually generated the content earlier in the workflow of your app,
// can be against the Platform policies: https://developers.facebook.com/policy

[FBRequestConnection startForPostStatusUpdate:@"User-generated status update."
                        completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
                    if (!error) {
                      // Status update posted successfully to Facebook
                      NSLog(@"result: %@", result);
                    } else {
                      // An error occurred, we need to handle the error
                      // See: https://developers.facebook.com/docs/ios/errors
                      NSLog(@"%@", error.description);
                    }
                  }];

This is from Facebook's "Sharing in iOS" documentation

Another option (though possibly also against the rules) is to create an image from the text and let the user share the image. Before doing this, however, put yourself in the user's shoes - do you really need to post something like that?

Foster Bass
  • 898
  • 10
  • 11
  • Well a lot games has a share function where you share your score on your facebook? how can that be against the rules? – user3423384 May 08 '14 at 19:52
  • 2
    Per https://developers.facebook.com/docs/apps/review/prefill, that's a violation. Yes, it happens all the time but since I was showing code that could be used for this, I wanted to make it clear that it's not allowed according to Facebook. You could post their score on a server and share a link to the post (as in the example in the video on the policy page). – Foster Bass May 08 '14 at 19:56