2013-04-22 8 views
8

मैं अपने आईओएस ऐप को आजमाने के लिए फेसबुक में उपयोगकर्ताओं को आमंत्रित करने की कोशिश कर रहा हूं (जो अभी तक स्टोर में नहीं है, अभी तक इसे खत्म नहीं किया है)।फेसबुक में आईओएस एप्लिकेशन से फेसबुक उपयोगकर्ताओं को आमंत्रित करें: निमंत्रण नहीं भेजा जा रहा है

मैं फेसबुक एपीआई का उपयोग एक उपयोगकर्ता को प्रमाणित और उसके बाद के लिए निम्न कोड का उपयोग करने का प्रयास करें:

- (void)shareWithFriends:(id)sender 
{ 
    UIAlertView *alert = [[UIAlertView alloc] 
          initWithTitle:@"Invite Friends" 
          message:@"If you enjoy using this app, would you mind taking a moment to invite a few friends that you think will also like it?" 
          delegate:self 
          cancelButtonTitle:@"No Thanks" 
          otherButtonTitles:@"Tell Friends!", nil]; 
    [alert show]; 
} 

- (void)alertView:(UIAlertView *)alertView 
didDismissWithButtonIndex:(NSInteger)buttonIndex { 
    if (buttonIndex == 0) { 
     // User has clicked on the No Thanks button, do not ask again 
     NSLog(@"Chitty user says he doesn't wanna share"); 
    } else if (buttonIndex == 1) { 
     // User has clicked on the Tell Friends button 
     [self performSelector:@selector(sendRequest) withObject:nil afterDelay:0.5]; 
    } 
} 

- (void)sendRequest { 
    // Display the requests dialog 

    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:nil]; 
    [FBWebDialogs presentRequestsDialogModallyWithSession:nil 
                message:[NSString stringWithFormat:@"Try this app, brah!"] 
                title:nil 
               parameters:params 
                handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) { 
                 if (error) { 
                  // Case A: Error launching the dialog or sending request. 
                  NSLog(@"Error sending request."); 
                 } else { 
                  if (result == FBWebDialogResultDialogNotCompleted) { 
                   // Case B: User clicked the "x" icon 
                   NSLog(@"User canceled request."); 
                  } else { 
                   NSLog(@"Request Sent."); 
                  } 
                 }}]; 


} 

हालांकि, जब मैं जो मैं करने के लिए निमंत्रण भेजने के लिए चाहते करने के लिए उपयोगकर्ताओं को चुनें और फिर हिट भेजें। कुछ नहीं हुआ। मुझे "अनुरोध भेजा गया" मिलता है। एनएसएलओजी के माध्यम से लेकिन मेरे दोस्त को यह प्राप्त नहीं हो रहा है।

कोई विचार?

उत्तर

0

आप पैराम्स कबूल कर रहे हैं?

मैं जानता हूँ कि अमेरिकन प्लान एपीआई कृपया कोई कार्य पूरा होने भेजता है, तो आप

4

मैंने देखा है कि सूचना संदेश केवल फेसबुक अनुप्रयोग दोनों Android/iOS में आ रहा है, फिर भी वेब उपयोगकर्ता कर सकते हैं 'प्राप्तकर्ता के रूप में एक खाली फेसबुक उपयोगकर्ता नाम भेजने यह नहीं देखता, मुझे आशा है कि यह फेसबुक से कार्यान्वयन नहीं है? यह भी सुनिश्चित करने के लिए कि आपके आविष्कार सफलतापूर्वक भेजे गए हैं, आपको परिणामURL क्वेरी को पार्स करना होगा।

NSDictionary *parameters = @{@"to":@""}; 

[FBWebDialogs presentRequestsDialogModallyWithSession:nil 
                 message:SL_FB_INVITE_DESCRIPTION 
                 title:SL_FB_INVITE_TITLE 
                parameters:parameters 
                 handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) 
     { 
      if(error) 
      { 
       NSLog(@"Some errorr: %@", [error description]); 
       UIAlertView *alrt = [[UIAlertView alloc] initWithTitle:@"Invitiation Sending Failed" message:@"Unable to send inviation at this Moment, please make sure your are connected with internet" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; 
       [alrt show]; 
       [alrt release]; 
      } 
      else 
      { 
       if (![resultURL query]) 
       { 
        return; 
       } 

       NSDictionary *params = [self parseURLParams:[resultURL query]]; 
       NSMutableArray *recipientIDs = [[[NSMutableArray alloc] init] autorelease]; 
       for (NSString *paramKey in params) 
       { 
        if ([paramKey hasPrefix:@"to["]) 
        { 
         [recipientIDs addObject:[params objectForKey:paramKey]]; 
        } 
       } 
       if ([params objectForKey:@"request"]) 
       { 
        NSLog(@"Request ID: %@", [params objectForKey:@"request"]); 
       } 
       if ([recipientIDs count] > 0) 
       { 
        //[self showMessage:@"Sent request successfully."]; 
        //NSLog(@"Recipient ID(s): %@", recipientIDs); 
        UIAlertView *alrt = [[UIAlertView alloc] initWithTitle:@"Success!" message:@"Invitation(s) sent successfuly!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; 
        [alrt show]; 
        [alrt release]; 
       } 

      } 
     } 
                friendCache:nil]; 

- (NSDictionary *)parseURLParams:(NSString *)query 
{ 
    NSArray *pairs = [query componentsSeparatedByString:@"&"]; 
    NSMutableDictionary *params = [[[NSMutableDictionary alloc] init] autorelease]; 
    for (NSString *pair in pairs) 
    { 
     NSArray *kv = [pair componentsSeparatedByString:@"="]; 

     [params setObject:[[kv objectAtIndex:1] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding] 
        forKey:[[kv objectAtIndex:0] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; 
    } 

    return params; 
} 
0

आप कैसे जानते हैं कि अनुरोध अन्य उपयोगकर्ताओं तक नहीं पहुंच पाया है? आपको पता होना चाहिए कि उन्हें कोई अधिसूचना नहीं मिलेगी, वे this लिंक पर जाकर इसका उपयोग कर सकते हैं:

आपके कैनवास पृष्ठ वाले प्लेटफ़ॉर्म के रूप में आपके ऐप में एक फेसबुक ऐप होना चाहिए। फिर उपयोगकर्ताओं को अधिसूचना मिलेगी।

0

यह हमेशा आपके ऐप के प्लेटफॉर्म पर निर्भर करता है। उदाहरण के लिए: यदि आपके पास एक ऐप है जो केवल मोबाइल पर उपलब्ध है, तो आमंत्रित मित्रों को केवल उनके फोन पर अनुरोध ही मिलेगा, न कि facebook.com पर। अगर आपके पास facebook.com पर कैनवास ऐप भी है, तो यह facebook.com पर भी दिखाई देगा।

आप ऐप्स द्वारा भेजे गए अनुरोधों के "अनुभव प्राप्त करें" [1] के बारे में दस्तावेज़ में इसके बारे में अधिक पढ़ सकते हैं।

[1] https://developers.facebook.com/docs/games/requests/v2.0#receive

संबंधित मुद्दे