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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:29:08+00:00 2026-05-30T23:29:08+00:00

I synthesized an NSMutableArray called email, which is part of an object Person. The

  • 0

I synthesized an NSMutableArray called email, which is part of an object Person. The email array contains pointers to several NSMutableString objects.

@property (strong) NSMutableArray *email;
@synthesize email = _email;

The string was declared (in the init method of the email object) as follows:

NSMutableString *s = [NSMutableString stringWithFormat:@"Blah"];

With this, I get a bad access error when I later executed an [email count] command in a different method. I use automatic retain counting ARC. Why does this happen?

EDIT: It turned out to be important that the output of [email count] was printed using %@, which won’t work most of the time, see below.

  • 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-30T23:29:10+00:00Added an answer on May 30, 2026 at 11:29 pm

    Figured it out, I think.

    Makes it glaringly obvious how green I am with Cocoa / Objective C. I was printing a test message as follows:

    NSLog (@"%@",[[p email] count]);

    But the count method returns an unsigned long (or NSInteger), and as soon as I changed it into

    NSLog (@"%ul",....

    it worked. Things can be so easy and hard at the same time 🙁

    so, memo to me:

    if a number is returned, make sure you want to print the object it points to (%@), it may be invalid!!

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

Sidebar

Related Questions

A class has a property (and instance var) of type NSMutableArray with synthesized accessors
I have an NSMutableArray defined as a property, synthesized and I have assigned a
So I'm creating an array called fruits which I would like to share between
I have this code: tableList = [[NSMutableArray alloc] initWithObjects:@First View,@Second View,nil]; I have synthesized
Lets assume myProp is @property (retain) NSString * myProp and synthesized for us.... self.myProp
I have a subclass of UIViewController with an NSMutableArray as a property to use
For some reason the custom setter of a property never gets called. So it
I have a synthesized NSMutableArray - theResultArray . I want to insert NSNumber or
I'm trying to use addObject: on an NSMutableArray with a class I've created, called
I've got a class called BackendConnector which uses a NSURLConnection to call a SoapWebservice

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.