Natan R.
Natan R.

Reputation: 5181

Schedule a post with Facebook iOS SDK 3.0

I am using the Facebook SDK 3.0 on iOS to try to schedule a post to a profile or page. When I try without scheduling, everything goes ok. However, when I put the following

//scheduleDate is a NSDate between the range 10 minutes - 6 months from now
NSString *timestamp = [NSString stringWithFormat:@"%.0f", [scheduleDate timeIntervalSince1970]];
[requestToPost.parameters setObject:timestamp forKey:@"scheduled_publish_time"];

I receive error 400 and com.facebook.sdk error 5.

Anyone have any idea why it's not working?

Upvotes: 1

Views: 588

Answers (3)

Natan R.
Natan R.

Reputation: 5181

So, it turns out that I needed to be aware of two things here:

1 - As Hemang pointed out, the parameter published must be defined to NO. So, setting something like [requestToPost.parameters setObject:@"0" forKey:@"published"];

or

[requestToPost.parameters setObject:[NSNumber numberWithBool:NO] forKey:@"published"]; is mandatory in this case.

2 - From my tests and from the docs, scheduling posts only work for Facebook Pages and not for people (profiles).

Also, it's worth saying again that the date should be between the range 10 minutes - 6 months from 'now'.

Upvotes: 0

Hemang
Hemang

Reputation: 27050

As answered by Alex L, reference from this post dated on, September 27, 2012 that scheduled_publish_time and published parameters will now be silently ignored.

However, when you receive error response code 400 it means

400 Bad Request. The request cannot be fulfilled due to bad syntax. Reference Here

One more result on this is here. published parameter set to false should work as said in post.

Something like :

[requestToPost.parameters setValue:[NSNumber numberWithBool:FALSE] forKey:@"published"];

A detailed response is available here seems helpful.

Also found that scheduled_publish_time should be in NSTimeInterval format. So only numbers between 0-9 would allowed i.e. 1000.0 and 1000 makes difference. You should specified 1000.

Updated: There's an app Facebook Pages Manager having the concept of scheduled_post. So there's still possibility of this functionality available by Facebook. Here's a YouTube Video showing the same function. I hope you would definitely get the solution and will make available to us too. Some more references. References 1 References 2 of schedule post allowing apps.

Upvotes: 1

Alex L
Alex L

Reputation: 8449

Facebook is phasing out scheduled posts for pages.

Sept 2012: To publish an Offer a corresponding ad must also be created and go live. The parameters scheduled_publish_time and published parameters are deprecated, and will be silently ignored.

Upvotes: 1

Related Questions