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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:19:36+00:00 2026-05-26T00:19:36+00:00

I’m not entirely sure if I wrote this array correct in the first place.

  • 0

I’m not entirely sure if I wrote this array correct in the first place. Here is the .h in my app delegate.

NSString *text0;
...
NSString *text123;

NSMutableArray *fortunesArray;
}

@property(nonatomic,retain) NSMutableArray *fortunesArray;

@property (nonatomic, retain) IBOutlet UIWindow *window;

@property (nonatomic, retain) IBOutlet AppViewController *viewController;

@end

Then in the app delegate.m I’m assigning all of them like such.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.

text0 = @"Text here";
...
text123 = @"Text here";

self.fortunesArray = [NSMutableArray arrayWithObjects:text0,text1,text2,text3,text4,text5,text6,text7,text8,text9,text10,text11,text12,text13,text14,text15,text16,text17,text18,text19,text20,text21,text22,text23,text24,text25,text26,text27,text28,text29,text30,text31,text32,text33,text34,text35,text36,text37,text38,text39,text40,text41,text42,text43,text44,text45,text46,text47,text48,text49,text50,text51,text52,text53,text54,text55,text56,text57,text58,text59,text60,text61,text62,text63,text64,text65,text66,text67,text68,text69,text70,text71,text72,text73,text74,text75,text76,text77,text78,text79,text80,text81,text82,text83,text84,text85,text86,text87,text88,text89,text90,text91,text92,text93,text94,text95,text96,text97,text98,text99,text100,text101,text102,text103,text104,text105,text106,text107,text108,text109,text110,text111,text112,text113,text114,text115,text116,text117,text118,text119,text120,text121,text122,text123,nil];


 self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    return YES;
}

I have tried this with NSArray and Mutable. The EXC_BAD_ACCESS is showing up pointing at text3 and before it was pointing at text5. If I cut out everything after about 50 the screen will open but when I finally try to have it work by clicking the button it resorts back to that bad access. (So can’t tell if there is an issue with the views button yet because this issue is happening at this array repeatedly.) I’ll post the code that calls it, but I’m pretty sure the main issue has something to do with this array.

In my view controller.m

-(IBAction)ganjaButton:(id)sender{
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];

int pressCount;
NSString *display;
if(pressCount%2==0){
    [sender setBackgroundImage:[UIImage imageNamed:@"nug2.png"] forState:UIControlStateNormal];
    display = [[NSString alloc] initWithFormat:@"%@",[appDelegate.fortunesArray objectAtIndex:40]];
}
else{
    [sender setBackgroundImage:[UIImage imageNamed:@"nug1.png"] forState:UIControlStateNormal];
    display = [[NSString alloc] initWithFormat:@"%@",[appDelegate.fortunesArray objectAtIndex:44]];
}
pressCount++;

label.text = display;
[display release];

}

Also yes in the above code the part that says AppDelegate is actually my AppDelagtes name.

Any help would be appreciated. Thanks.

  • 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-26T00:19:37+00:00Added an answer on May 26, 2026 at 12:19 am

    Have you thought about storing all those text values in a plist and loading them into an array with [NSArray arrayWithContentsOfFile:filePath];?

    That would be a MUCH cleaner solution in the first place.

    Edit: To get the filePath, assuming your plist is named “textStrings.plist” you would use the following:

    NSString *filePath = [bundle pathForResource:@"textStrings" ofType:@"plist"];
    
    • 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
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I need a function that will clean a strings' special characters. I do NOT
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

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.