views:

450

answers:

2

Hi There, I am developing an iPhone application that will send sms the logged in user friends'. I am using FacebookConnect for the same. The problem is I am getting the uid of all friends but what is the way to send SMS to these uids(friends UID).

Thanks, UPT

+1  A: 
texmex5
Sorry for such silly mistake. But by reverting this change still not going inside if..
KPT
A: 

Please have a look on the following code and I am not able to send the message to friends: To get friends UID:

NSDictionary* params = [NSDictionary dictionaryWithObject:fql forKey:@"query"];

// sessionView = session;

[[FBRequest requestWithDelegate:self] call:@"facebook.friends.get" params:params];

in delegate:

-(void)request:(FBRequest*)request didLoad:(id)result

//doing the following code:

if (@"facebook.friends.get" == request.method) {

    NSArray* users = result;

    myList =[[NSArray alloc] initWithArray: users];

    for(NSInteger i=0;i<[users count];i++) {

        NSDictionary* user = [users objectAtIndex:i];

        NSString* uid = [user objectForKey:@"uid"];

        //          NSString* fql = [NSString stringWithFormat:

        //                           @"select name from user where uid == %@", uid];

        //NSDictionary* params = [NSDictionary dictionaryWithObject:fql forKey:@"query"];

        //[[FBRequest requestWithDelegate:self] call:@"facebook.fql.query" params:params];


        NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys:uid, @"uid", @"checkSMSCanSend", @"callback", nil];
        [[FBRequest requestWithDelegate:self] call:@"facebook.sms.canSend" params:params];
    }

and for SMS.canSend: if (@"facebook.sms.canSend" == request.method) {

    UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"SMS" message:@"User can send SMS successfully." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alert show];
    [alert release];
}

But this is not getting called. Please help to SMS friends.

KPT
please format your code correctly.
texmex5
edited my post.
texmex5
Does the > -(void)request:(FBRequest*)request didLoad:(id)result method execute? Are you sure that the uid you pass to the method is not null?
texmex5
Yes It's not NULL
KPT