Nishant
Nishant

Reputation: 51

In facebook not see notification when I send to invitation to my friend ios xcode

I tried to invite to my friend on facebook by invitation code and then one notification should be show on friend facebook profile but this is not done some where is may be problem here is my code

    -(void)sendinvitation
{
        [FBWebDialogs
         presentRequestsDialogModallyWithSession:nil
         message:@"Learn how to make your iOS apps social."
         title:nil
         parameters:nil
         handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
             if (error) {
                 // Error launching the dialog or sending the request.
                 NSLog(@"Error sending request.");
             } else {
                 if (result == FBWebDialogResultDialogNotCompleted) {
                     // User clicked the "x" icon
                     NSLog(@"User canceled request.");
                 } else {
                     // Handle the send request callback
                     NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
                     if (![urlParams valueForKey:@"request"]) {
                         // User clicked the Cancel button
                         NSLog(@"User canceled request.");
                     } else {
                         // User clicked the Send button
                         NSString *requestID = [urlParams valueForKey:@"request"];
                         NSLog(@"Request ID: %@", requestID);
                     }
                 }
             }
         }];
 }
- (NSDictionary*)parseURLParams:(NSString *)query {
    NSArray *pairs = [query componentsSeparatedByString:@"&"];
    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
    for (NSString *pair in pairs) {
        NSArray *kv = [pair componentsSeparatedByString:@"="];
        NSString *val =
        [kv[1] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
        params[kv[0]] = val;
    }
    return params;


}

This Code Return a request id also like this

Request ID: 648466181891572

please help me

Upvotes: 0

Views: 472

Answers (1)

user3681635
user3681635

Reputation: 11

you must add a platform as "Facebook app" to your facebook app ! as you did for addind ios paltform. in settings of your app. it needs two urls . one with http another https. then it will show notifications !

Upvotes: 1

Related Questions