How to delete application request in iOS Facebook SDK?

When executing application requests on Facebook using the iOS SDK, the developer guide requires developers to clear the request when opening the application.

Delete Queries

When a user is redirected to your application by clicking the "Accept Request" button, you must delete the request after accepting it. Requests are not automatically deleted after they are clicked, so developers are responsible for clearing them after they are accepted. https://developers.facebook.com/docs/requests/#deleting

Is there a function to clear all notifications or other helpers?

+4
source share
1 answer

The following API will clear a specific application request:

FBRequest *request = [facebookObject requestWithGraphPath:@"REQUEST-ID_USER-ID" andParams:[NSMutableDictionary dictionary] andHttpMethod:@"DELETE" andDelegate:self]; 

Replace the request ID for the request ID and Facebook user ID for the USER-ID (underline between them is important). Change andDelegate and andParams as needed, but do not pass the nil object to andParams , otherwise it will complete completely.

To remove all requests, you need to iterate over all the requests passed in the url:

 - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url; 

which is probably implemented in your application.

All user request identifiers are separated by commas in the request_ids parameter of the target_url parameter in the target_url url . This only happens when the user clicks on the notification of the application in the iOS Facebook application, and your facebook application supports iOS Native Deep Linking .

+5
source

Source: https://habr.com/ru/post/1393698/


All Articles