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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:37:45+00:00 2026-05-24T01:37:45+00:00

I am trying to use the following code to load a UIButton and UITextField

  • 0

I am trying to use the following code to load a UIButton and UITextField with information based upon a UISegmentedControl’s current segment that is clicked but it is causing a SIGABRT crash.
Here is the code:

- (void)updateInfo {

NSLog(@"count1:%d", [self.accounts count]);

[self saveInfo];

NSLog(@"count2:%d", [self.accounts count]);

NSDictionary *dict = [self.accounts objectAtIndex:0];
NSData *imageData = [dict objectForKey:@"ProfileImage"];
UIImage *imageProfile = [UIImage imageWithData:imageData];
[image1 setImage:imageProfile];

NSDictionary *dict2 = [self.accounts objectAtIndex:1];
NSData *imageData2 = [dict2 objectForKey:@"ProfileImage"];
UIImage *imageProfile2 = [UIImage imageWithData:imageData2];
[image2 setImage:imageProfile2];

if ([self.accounts objectAtIndex:accountSC.selectedSegmentIndex] != nil) {
    NSDictionary *dict = [self.accounts objectAtIndex:accountSC.selectedSegmentIndex];
    //NSString *name = [dict objectForKey:@"Name"];
    NSString *name = [accountSC titleForSegmentAtIndex:accountSC.selectedSegmentIndex];
    [Name setText:name];
    NSData *imageData = [dict objectForKey:@"ProfileImage"];
    UIImage *imageProfile = [UIImage imageWithData:imageData];
    [pictureButton setImage:imageProfile forState:UIControlStateNormal];
}
else {
    Name.text = nil;
    [pictureButton setImage:nil forState:UIControlStateNormal];
}

}

The first & second big block of code is temporary because I wanted to see the UIImage’s based upon different objectAtIndex numbers.

Here is the console crash log:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString objectForKey:]: unrecognized selector sent to instance 0x2cc08'

Any reason why this can be happening? Do I need to post any other code I am using?

I really need help on this, I have been pulling my hair out!!!

Edit1:
I am using this code, also you were talking about isKindOfClass right?
Anyway this is the code:

NSDictionary *dict = [self.accounts objectAtIndex:1];
if ([dict isKindOfClass:[NSDictionary class]]) {
    NSLog(@"YES");
}
else {
    NSLog(@"NO");
}

Im testing now…

  • 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-05-24T01:37:46+00:00Added an answer on May 24, 2026 at 1:37 am

    You’re sending objectForKey: to an NSString object, specifically one that you’ve typed directly into your code somewhere in @"..." form rather than one you’ve created programmatically (or had created programmatically for you). Someone is putting something other than a dictionary into self.accounts.

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

Sidebar

Related Questions

I'm trying to use the following code # LOAD XML FILE $XML = new
Trying to use this following script to load a page so that I can
I'm trying to use the following code to load an external page into a
I'm trying to use the following code but it's returning the wrong day of
I am trying to use the following code to write data into an excel
I am trying to use the following code, which I have not been able
I am trying to use the following code to export tables from access to
I am trying to use the following code, to display $formcode, which is the
I'm trying to use the following code to make an image fadeOut and, only
I'm trying to use the following code and it still strips out all the

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.