Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8626103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:56:39+00:00 2026-06-12T07:56:39+00:00

I have a method which sends out a request and has a delegate responder.

  • 0

I have a method which sends out a request and has a delegate responder. The method is being called by a KVO responder. The code works fine when I call it from viewDidLoad, but when I make the request from the KVO method, it doesn’t trigger the delegate method.

here is my KVO responder:

//observe app delegates userdata to check for when user data is available or data is changed
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
                        change:(NSDictionary *)change
                       context:(void *)context
{
    if ([keyPath isEqualToString:@"userData"] )
    {
        //goto facebook logic
        [self FBFriendSuggester];
    }
}

and the method it calls:

-(void)FBFriendSuggester
{
    NSDictionary * fb_credentials = nil;
    if([prefs objectForKey:@"facebookCredentials"])
    {
        fb_credentials = [prefs objectForKey:@"facebookCredentials"];
        if ([fb_credentials objectForKey:@"expiry"] && [fb_credentials objectForKey:@"fbtoken"]) {
            NSLog(@"found stored Facebook credentials.");
            ApplicationDelegate.facebook.accessToken = [fb_credentials objectForKey:@"fbtoken"];
            ApplicationDelegate.facebook.expirationDate = [fb_credentials objectForKey:@"expiry"];
        }
    }
    if ([ApplicationDelegate.facebook isSessionValid]) {
        printf("_valid facebook\n");
        [ApplicationDelegate.facebook requestWithGraphPath:@"me/friends" andDelegate:self];
    }else
        printf("_invalid facebook\n");
}

and the delegate method:

- (void)request:(FBRequest *)request didLoad:(id)result{
    NSLog(@"result2:%@",result);

    NSDictionary * rawObject = result;
    NSArray * dataArray = [rawObject objectForKey:@"data"];

    for (NSDictionary * f in dataArray) {
        [friends addObject:[[KNSelectorItem alloc] initWithDisplayValue:[f objectForKey:@"name"]
                                                            selectValue:[f objectForKey:@"id"]
                                                               imageUrl:[NSString stringWithFormat:@"http://graph.facebook.com/%@/picture?type=square", [f objectForKey:@"id"]]]];
    }
    [friends sortUsingSelector:@selector(compareByDisplayValue:)];
    [self pickerPopup:self];
}

the delegate method doesn’t get called in this scenario, but it does work fine when i call -(void)FBFriendSuggester directly from the controller. I don’t know what to do, i tried setting a notification to respond in hopes that it would trigger the delegate, but that didn’t work either.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:56:40+00:00Added an answer on June 12, 2026 at 7:56 am

    I was able to work around my problem by issuing:

    [self performSelectorOnMainThread:@selector(FBFriendSuggester) withObject:nil waitUntilDone:NO];
    

    It would be great to know why this works like this though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a method which I am trying to call dynamically. That method has
I have a server which takes a request for a WSDL and sends back
I have this post request code in jquery, which seems to send the request
My code works (yeah!) which sends json to a server.. would appreciate any thoughts
I have this method which lets me translate the position of an object, animating
I have this method which leaks ~ 6KB : + (EInspectorFacilityInfo*) newWithNode: (CXMLNode*) node
I have a method which returns single word as a String. I need to
I have a method which takes a list and do some processing on it
I have a method which i want to convert to Extension Method public static
i have a method which takes in a DotNetOpenAuth (formally known as DotNetOpenId) Response

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.