Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void) facebookFetch
- {
- NSString* query = @"<my_query">;
- NSDictionary *queryParam = @{ @"q": query };
- [FBSettings setLoggingBehavior:[NSSet setWithObjects:
- FBLoggingBehaviorFBRequests,
- nil]];
- // Make the API request that uses FQL
- [FBRequestConnection startWithGraphPath:@"/fql"
- parameters:queryParam
- HTTPMethod:@"GET"
- completionHandler:^(FBRequestConnection *connection,
- id result,
- NSError *error) {
- if (error) {
- NSLog(@"Error: %@", [error localizedDescription]);
- } else {
- NSLog(@"Result: %@", result);
- }
- }];
- }
- /** Background task **/
- -(void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
- {
- NSLog(@"####### background task!");
- if (![FBSession activeSession].isOpen) {
- NSLog(@"fbsession is NOT open!");
- } else {
- NSLog(@"fbsession is open!");
- [self facebookFetch];
- }
- completionHandler(UIBackgroundFetchResultNewData);
- URL: https://graph.facebook.com//fql?sdk=ios&access_token=ACCESS_TOKEN_REMOVED&q=<my_query>&migration_bundle=fbsdk%3A20131212&format=json
- Method: GET
- UserAgent: FBiOSSDK.3.13.1
- MIME: multipart/form-data; boundary=3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f
- - (void) facebookFetch:(void (^)(UIBackgroundFetchResult))backgroundCompletion
- {
- NSString* query = @"<my_query">;
- NSDictionary *queryParam = @{ @"q": query };
- [FBSettings setLoggingBehavior:[NSSet setWithObjects:
- FBLoggingBehaviorFBRequests,
- nil]];
- // Make the API request that uses FQL
- [FBRequestConnection startWithGraphPath:@"/fql"
- parameters:queryParam
- HTTPMethod:@"GET"
- completionHandler:^(FBRequestConnection *connection,
- id result,
- NSError *error) {
- if (error) {
- NSLog(@"Error: %@", [error localizedDescription]);
- } else {
- NSLog(@"Result: %@", result);
- }
- if (backgroundCompletion) {
- backgroundCompletion(UIBackgroundFetchResultNewData);
- }
- }];
- }
- /** Background task **/
- -(void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
- {
- NSLog(@"####### background task!");
- if (![FBSession activeSession].isOpen) {
- NSLog(@"fbsession is NOT open!");
- } else {
- NSLog(@"fbsession is open!");
- [self facebookFetch:completionHandler];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement