Rudolf J
Rudolf J

Reputation: 517

Why doesn't facebook accept my UIImage?

If I use the Facebook method:

[FBRequestConnection startForUploadPhoto:sendPicture
                               completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
                                   if (!error) {

Facebook does, in same cases explained below, not always accept my UIImage. If I create an image as in:

CASE 1: UIImage *sendPicture = [UIImage imageNamed:@"f_logo.png"]

Then it does accept my UIImage, but if I create them image like (in this example, postImageView is an UIImageView):

CASE 2: UIImage *sendPicture = self.postImageView.image;

Then it does not accept my UIImage.

What could be wrong here? This is the error message:

Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0xa06c970 {com.facebook.sdk:ErrorInnerErrorKey=Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=0xa076840 {NSErrorFailingURLStringKey=https://graph.facebook.com/me/photos?sdk=ios&access_token=BAAFZAZBNVZCfS0BACpZBJgjDz6kXZCt7t3pjiTz7rLVZAZCOXytAyReqvcuNjwJ4ntLHBrAtYodFcsoRFZBWZB5ZAzZA4w1HPLGdv1DtAevuur7yQCZC6N8gnc6U7WruoBLsN158nzTKvXa6MAZDZD&migration_bundle=fbsdk0X1.68E7002A9AC18P-98220130120&format=json, NSErrorFailingURLKey=https://graph.facebook.com/me/photos?sdk=ios&access_token=BAAFZAZBNVZCfS0BACpZBJgjDz6kXZCt7t3pjiTz7rLVZAZCOXytAyReqvcuNjwJ4ntLHBrAtYodFcsoRFZBWZB5ZAzZA4w1HPLGdv1DtAevuur7yQCZC6N8gnc6U7WruoBLsN158nzTKvXa6MAZDZD&migration_bundle=fbsdk0X1.3C8500A0449BP-85920130120&format=json, NSLocalizedDescription=The request timed out., NSUnderlyingError=0xb82a090 "The request timed out."}, com.facebook.sdk:HTTPStatusCode=200, com.facebook.sdk:ErrorSessionKey=<FBSession: 0xb85c5b0, state: FBSessionStateOpen, loginHandler: 0xb85b4b0, appID: 380400245374253, urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0xb854bf0>, expirationDate: 2013-05-31 20:51:54 +0000, refreshDate: 2013-04-02 10:06:39 +0000, attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(
"publish_stream")>}

Thanks!

Upvotes: 0

Views: 199

Answers (2)

Rudolf J
Rudolf J

Reputation: 517

At the end, what turned out to be the problem, was that my UIImage was too large. I sized it down, and then Facebook accepted my post.

Upvotes: 2

Jensen2k
Jensen2k

Reputation: 8408

When you create an UIImage with the imageNamed-method, it creates an autoreleased instance.

Instead, try initializing the object yourself.

UIImage *sendPicture = [[UIImage alloc] initWithImageNamed:@"f_logo.png"];

I've had problems using autoreleased objects myself.

Upvotes: 0

Related Questions