How to read any facebook user public timeline using iOS Social framework?

helper

I really have spend hours to try to solve this question unsuccesfuly! I just want to be able to read any user's timeline (public messages) from facebook... Technically (for simplicity) I would prefer to only use frameworks from the iOS sdk (ie. not having to use the facebook one). Therefore I currently only use Social.framework and Accounts.framework

What I've succeed to do so far is to read the facebook timeline of the currently logged user (the one identified on the device) BUT when I try to sustitute the "me" by "ANOTHER_USER_ID" in the following url @"https://graph.facebook.com/me/feed" it only returns an empty data field (no "message" node).

The "strange" fact is that I can successfully reach any feed of corporate type (like "cocacola" for exemple) using @"https://graph.facebook.com/cocacola/feed".

So my question is how to reach the feed of a "simple" user (for exemple "shireesh.asthana"), so that I can read it's "message"?

My process so far :

  1. Create an app on https://developers.facebook.com/ to get an AppID
  2. Use this AppID in my code to be able to send request using SLRequest

Below is the code I'm currently using :

ACAccountStore *account = [[ACAccountStore alloc] init];
    ACAccountType *accountType = [account
                                  accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];

    // Specify App ID and permissions
    NSDictionary *options = @{
                              ACFacebookAppIdKey: @"1111111111111", // My AppID here
                              //ACFacebookPermissionsKey: @[@"read_stream"],
                              ACFacebookPermissionsKey: @[@"email", @"read_stream"],
                              ACFacebookAudienceKey:ACFacebookAudienceFriends
                              };

    [account requestAccessToAccountsWithType:accountType
                                     options:options completion:^(BOOL granted, NSError *error)
     {
         if (granted == YES)
         {
             NSArray *arrayOfAccounts = [account
                                         accountsWithAccountType:accountType];

             if ([arrayOfAccounts count] > 0)
             {
                 ACAccount *facebookAccount = [arrayOfAccounts lastObject];

                 // I want the messages and the author
                 NSDictionary *parameters = @{@"fields": @"message,from"};

                 NSURL *feedURL = [NSURL URLWithString:@"https://graph.facebook.com/HERE_THE_USER_ID/feed"]; // Work with "cocacola" but not with "shireesh.asthana"

                 SLRequest *getRequest = [SLRequest
                                           requestForServiceType:SLServiceTypeFacebook
                                           requestMethod:SLRequestMethodGET
                                           URL:feedURL 
                                           parameters:parameters];

                 getRequest.account = facebookAccount;

                 [getRequest performRequestWithHandler:
                  ^(NSData *responseData, NSHTTPURLResponse
                    *urlResponse, NSError *error)
                  {
                      dataSource = [NSJSONSerialization
                                    JSONObjectWithData:responseData
                                    options:NSJSONReadingMutableLeaves
                                    error:&error];

                      // Reach the main queue to process result
                      dispatch_async(dispatch_get_main_queue(), ^{
                          NSLog(@"Read %d messages", [dataSource[@"data"] count]);
                          if ([dataSource[@"data"] count] != 0) {
                              // Do stuff in case of success...
                          } else {
                              // Do stuff in case of ERROR...
                          }
                      });
                  }];
             } else {
                 // Case of no facebook account on the device...
             }
         } else {
             // User don't grant the app to access its facebook info...
         }
     }];
Sahil Mittal

So my question is how to reach the feed of a "simple" user (for exemple "shireesh.asthana"), so that I can read it's "message"?

The reason could be -

  1. The <user> has no public posts,

  2. The <user> has Turn off Platform in the App Settings

(of-course, the <user> here is not the user in session)

P.S. Shireesh Asthana (who works at Facebook), don't have any public posts

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

How to get user timeline using fabric?

분류에서Dev

iOS sdk using facebook user details for registration

분류에서Dev

How to fetch Facebook user information in ios

분류에서Dev

Share image On facebook in watchKit using the Social sdk

분류에서Dev

How can I query keywords within a user's timeline using Twitter's API v1.1?

분류에서Dev

How to make an action button which takes user to Facebook app in iOS?

분류에서Dev

How to generate Facebook User Access Token using curl

분류에서Dev

How to Give Access to non-public Amazon S3 bucket folders using Parse authenticated user

분류에서Dev

How to get user details when authenticating with social sign in with Flutter?

분류에서Dev

how to access user profile info on Login in Social Connect Module in Sitecore

분류에서Dev

Getting information about the user from Facebook using django_facebook

분류에서Dev

Start Facebook Chat with Another user using Facebook ID

분류에서Dev

How to access user languages inside GraphObject using Facebook PHP SDK v4

분류에서Dev

How to use Facebook Graph API to Get user's location/City using PHP?

분류에서Dev

is there any performance impacts of using whole methods as public in java?

분류에서Dev

재 로깅없이 Facebook에서 앱 요청 및 Social Framework에서 세션 사용

분류에서Dev

how to get all friends in facebook using graph api v2.0 (ios)?

분류에서Dev

how to share a Photo Or link on facebook wall without using FBSDKShareDialog from native ios app

분류에서Dev

Deleting facebook user role in app when user hasn't yet accepted the invitation (pending) using facebook graph

분류에서Dev

How to register any user with 1 month plan?

분류에서Dev

CSS for image like in facebook and other social media

분류에서Dev

Facebook Social Button 플러그인

분류에서Dev

How to access current_user in partial of public_activity gem?

분류에서Dev

How can I display a meaningful login error messages to user within python-social-auth?

분류에서Dev

A application Post on User's walls using Facebook PHP registration API?

분류에서Dev

how to login with facebook with custom login button using facebook sdk

분류에서Dev

How to get list of all my facebook friends using facebook api?

분류에서Dev

How to get a facebook closed group posts using facebook SDK for .NET

분류에서Dev

Video uploading issues using Facebook IOS app for other users

Related 관련 기사

  1. 1

    How to get user timeline using fabric?

  2. 2

    iOS sdk using facebook user details for registration

  3. 3

    How to fetch Facebook user information in ios

  4. 4

    Share image On facebook in watchKit using the Social sdk

  5. 5

    How can I query keywords within a user's timeline using Twitter's API v1.1?

  6. 6

    How to make an action button which takes user to Facebook app in iOS?

  7. 7

    How to generate Facebook User Access Token using curl

  8. 8

    How to Give Access to non-public Amazon S3 bucket folders using Parse authenticated user

  9. 9

    How to get user details when authenticating with social sign in with Flutter?

  10. 10

    how to access user profile info on Login in Social Connect Module in Sitecore

  11. 11

    Getting information about the user from Facebook using django_facebook

  12. 12

    Start Facebook Chat with Another user using Facebook ID

  13. 13

    How to access user languages inside GraphObject using Facebook PHP SDK v4

  14. 14

    How to use Facebook Graph API to Get user's location/City using PHP?

  15. 15

    is there any performance impacts of using whole methods as public in java?

  16. 16

    재 로깅없이 Facebook에서 앱 요청 및 Social Framework에서 세션 사용

  17. 17

    how to get all friends in facebook using graph api v2.0 (ios)?

  18. 18

    how to share a Photo Or link on facebook wall without using FBSDKShareDialog from native ios app

  19. 19

    Deleting facebook user role in app when user hasn't yet accepted the invitation (pending) using facebook graph

  20. 20

    How to register any user with 1 month plan?

  21. 21

    CSS for image like in facebook and other social media

  22. 22

    Facebook Social Button 플러그인

  23. 23

    How to access current_user in partial of public_activity gem?

  24. 24

    How can I display a meaningful login error messages to user within python-social-auth?

  25. 25

    A application Post on User's walls using Facebook PHP registration API?

  26. 26

    how to login with facebook with custom login button using facebook sdk

  27. 27

    How to get list of all my facebook friends using facebook api?

  28. 28

    How to get a facebook closed group posts using facebook SDK for .NET

  29. 29

    Video uploading issues using Facebook IOS app for other users

뜨겁다태그

보관