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 8267661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:36:56+00:00 2026-06-08T05:36:56+00:00

I’ve been trying this Twitter api stuff and it’s really confusing… I keep getting

  • 0

I’ve been trying this Twitter api stuff and it’s really confusing…

I keep getting EXC_BAD_ACCESS bad access with the following code… What is the problem here?

NSURL *followingURL = [NSURL URLWithString:@"https://api.twitter.com/1/users/lookup.json"];
// Pass in the parameters (basically '.ids.json?screen_name=[screen_name]')
id fromIntToNum = [NSNumber numberWithInteger: friID];
NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:@"159462573", @"user_id", nil];
// Setup the request
twitterRequest = [[TWRequest alloc] initWithURL:followingURL
                                                parameters:parameters
                                             requestMethod:TWRequestMethodGET];
// This is important! Set the account for the request so we can do an authenticated request. Without this you cannot get the followers for private accounts and Twitter may also return an error if you're doing too many requests
[twitterRequest setAccount:theAccount];
// Perform the request for Twitter friends
[twitterRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
    if (error) {
        /*
        // deal with any errors - keep in mind, though you may receive a valid response that contains an error, so you may want to look at the response and ensure no 'error:' key is present in the dictionary
        NSLog(@"%@",error);*/
    } else {
        /*NSError *jsonError = nil;
        // Convert the response into a dictionary
        NSDictionary *twitterGrabbedUserInfo = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONWritingPrettyPrinted error:&jsonError];
        // Grab the Ids that Twitter returned and add them to the dictionary we created earlier
        NSLog(@"%@", [twitterGrabbedUserInfo objectForKey:@"screen_name"]);*/
    }

}];

I separated the line the my code fails on…

What could be causing this Twitter API problem?

The following line causes the crash:::

[twitterRequest performRequestWithHandler:^(NSData *responseData,
                NSHTTPURLResponse *urlResponse, NSError *error) {

I will also sometimes get this error:

[__NSCFNumber credentialForAccount:]: unrecognized 

UPDATE: I commented out the handler and I made TwitterRequest and ivar, but it still crashes…

  • 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-08T05:36:57+00:00Added an answer on June 8, 2026 at 5:36 am

    In your block you look for an error, but if you get one you log it and continue on. You should put an “else” statement in and only proceed if no error.

    Why not try to comment out all your code in the handler – don’t do anything – and see if you get the crash. Then try with just the error code. Then try with the JSON serialization, and finally the last line. If you can find the part of the block that is causing the problem that would help.

    Also, I suspect that performRequestWithHandler: does not block, but expects you to notify your class within the block that the request is done. If so it means “TWRequest *twitterRequest” should be an ivar or property, and you need to allows for some method to get called when the handler is done. Your crash may be due to ARC reallocating your object while the object is running.

    EDIT:
    Note that that the TWRequest class description says: “Use the initWithURL:parameters:requestMethod: method to initialize a newly created TWRequest object passing the required property values. ” It says PLURAL properties, meaning more than 1. Could it be that it also expects a “credentialForAccount” property? You have to read the twitter docs to find all the required properties.

    EDIT2:
    Well, we don’t even know if you get as far as your handler. Put a NSLog there but I suspect its never getting that far. If true this leaves three possibilities:

    a) it does’t like the URL (although this seems good)

    b) you are missing some parameters it expects

    c) id doesn’t like “theAccount” object – is it a valid ACAccount object? Try NSLogging it.

    It has to be one of these three things.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I am trying to render a haml file in a javascript response like so:

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.