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

  • Home
  • SEARCH
  • 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 552811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:32:22+00:00 2026-05-13T11:32:22+00:00

I have this code -(IBAction) generateFlashNow:(id)sender{ [textField resignFirstResponder]; NSString *string1 = textField.text; //NSString *string2

  • 0

I have this code

-(IBAction) generateFlashNow:(id)sender{

[textField resignFirstResponder];
NSString *string1 = textField.text;
//NSString *string2 = [string1 stringByReplacingOccurrencesOfString:@"" withString:@","];
NSArray *arrayOfLetters = [string1 componentsSeparatedByString:@","];

NSLog(@"Log Array :%@", arrayOfLetters);

//NSArray *imageArray = [[NSArray alloc] init];

NSLog(@"Log First Letter of array: %@",[arrayOfLetters objectAtIndex:0]);

runLoopTimes = [arrayOfLetters count];
runLoopTimes = (runLoopTimes -1);
NSLog(@"Letters:%d", runLoopTimes);

int timesThroughLoop;

while (runLoopTimes > 0) {
    NSLog(@"loopedy Loop");

    NSString *LetterString = [NSString stringWithFormat:@"%@", [arrayOfLetters objectAtIndex:indexTimes]];
    timesThroughLoop --;
    NSLog(@"letter String : %@", LetterString);
    indexTimes ++;

    if (runLoopTimes == 0) {
        return; 
    }
}

NSLog(@"done");


}

and i get this log report, when I type into the text field ‘s,a,m’

[Session started at 2010-01-15 15:50:30 +1300.]
2010-01-15 15:50:35.398 Flash![39290:207] Log Array :(
s,
a,
m

)
2010-01-15 15:50:35.399 Flash![39290:207] Log First Letter of array: s
2010-01-15 15:50:35.399 Flash![39290:207] Letters:2
2010-01-15 15:50:35.400 Flash![39290:207] loopedy Loop
2010-01-15 15:50:35.400 Flash![39290:207] letter String : s
2010-01-15 15:50:35.401 Flash![39290:207] loopedy Loop
2010-01-15 15:50:35.401 Flash![39290:207] letter String : a
2010-01-15 15:50:35.402 Flash![39290:207] loopedy Loop
2010-01-15 15:50:35.402 Flash![39290:207] letter String : m
2010-01-15 15:50:35.404 Flash![39290:207] loopedy Loop
2010-01-15 15:50:35.405 Flash![39290:207] * Terminating app due to uncaught exception ‘NSRangeException’, reason: ‘* -[NSCFArray objectAtIndex:]: index (3) beyond bounds (3)’
2010-01-15 15:50:35.406 Flash![39290:207] Stack: (
29287515,
2538743049,
29371451,
29371290,
478409,
74279,
9945,
2716761,
3124130,
3132867,
3128079,
2821683,
2730012,
2756789,
37383889,
29072256,
29068360,
37377933,
37378130,
2760707,
9228,
9082
)

and I have no idea what I am doing wrong, so any help is appreciated.

Cheers, Sam

  • 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-13T11:32:22+00:00Added an answer on May 13, 2026 at 11:32 am

    You never decrement runLoopTimes inside the loop. So it will loop indefinitely. And eventually indexTimes is off the end of the array.

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

Sidebar

Ask A Question

Stats

  • Questions 304k
  • Answers 304k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It's not the regular expression that it's complaining about. You… May 13, 2026 at 8:51 pm
  • Editorial Team
    Editorial Team added an answer You've essentially answered your own question is as much detail… May 13, 2026 at 8:51 pm
  • Editorial Team
    Editorial Team added an answer Short version: No, you cannot. The IIS version has always… May 13, 2026 at 8:51 pm

Related Questions

This is an Objective-C/iphone SDK question. I have a dashboard view that is used
As shown in the screenshot below, i have a UITableView with some info and
I'm really hesitant to ask this question, since it's sure to have such a
I have seen the post for How to switch views by buttons on iPhone?
Hi I have the following code: - (IBAction)runTask:(id)sender { NSTask *proc; NSPipe *output; NSData

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.