Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Get all Facebook chat messages in iPhone

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 216
    Comment on it

    Note :- Facebook provides only 25 latest chat conversation messages

    /This is completion handler method and takes 3-4 sec to load chat messages from FB/

    NSMutableArray *arrConversation = [[NSMutableArray alloc]init];
    
    NSArray *arrPermission = @[@"read_mailbox"];
        if ([[FBSession activeSession]isOpen]) {
    [FBRequestConnection startWithGraphPath:@"/me?fields=inbox" completionHandler:^(FBRequestConnection *connection,id user, NSError *error) {
        if (error) {
            //Sorry check permission or network.
        } else {
    
        //Here we can save conversations into an array and print that array...
        arrConversation = [[user valueForKey:@"inbox"] valueForKey:@"data"];
         NSLog(@"%@", arrConversation);
        }
    }];
        }else{
            [FBSession openActiveSessionWithReadPermissions:arrPermission
                                               allowLoginUI:YES
                                          completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
                                              if (error) {
                                                  //Sorry check permission or network.
                                              } else {
                                                 NSLog(@"%u", status); 
                                              }
                                          }];
            }
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: