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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:07:12+00:00 2026-05-15T17:07:12+00:00

Ok for some reason my code wont play nice and I’m too new to

  • 0

Ok for some reason my code wont play nice and I’m too new to cocoa to figure this out on my own..

when the send button is pressed it is meant to run the createEmail method. But it says
GDB: Program received signal: “EXC_BAD_ACCESS”. when the button is pressed.

#import "Controller.h"

@implementation Controller
-(IBAction)send:(id)sender{
 [self createEmail];
}

-(void)createEmail{
 NSString *number  = [numfield stringValue]; 
 NSString *carrier = [carrierfield stringValue];
 NSString *carrierTag;

 [carrier lowercaseString]; //make all lowercase 

 //set carrierTag based on what carrier it is
 if ([carrier isEqualToString:@"verizon"]) {
  carrierTag = @"@vtext.com";
 }
 if ([carrier isEqualToString:@"at&t"]) {
  carrierTag = @"@txt.att.net";
 }
 if ([carrier isEqualToString:@"nextel"]) {
  carrierTag = @"@messaging.nextel.com";
 }
 if ([carrier isEqualToString:@"sprint"]) {
  carrierTag = @"@messaging.sprintpcs.com";
 }
 if ([carrier isEqualToString:@"cingular"]) {
  carrierTag = @"@cingularme.com";
 }
 if ([carrier isEqualToString:@"cingular"]) {
  carrierTag = @"@cingularme.com";
 }
 if ([carrier isEqualToString:@"virgin"]) {
  carrierTag = @"@vmobl.com";
 }
 if ([carrier isEqualToString:@"t-mobile"]) {
  carrierTag = @"@tmomail.net";
 }

 //Concatenate number and carrierTag to create an email address
 email = [number stringByAppendingString:carrierTag];
}
@end
  • 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-15T17:07:12+00:00Added an answer on May 15, 2026 at 5:07 pm

    Well, I see two possibilities. Either carrier is not set correctly or it’s not equal to any of those strings in which case carrierTag is left uninitialised.

    In the former case, the exception is probably on the line:

    [carrier lowercaseString]
    

    In the latter, it will probably be at:

    email = [number stringByAppendingString:carrierTag];
    

    The debugger should provide you with that information, and you should provide it to us as well 🙂

    In addition, lowercaseString returns another string, it doesn’t operate in-place, so you need:

    carrier = [carrier lowercaseString];
    

    What you may want to do is set carrierTag to an initially empty string so that nothing is appended if there is no match:

    carrierTag = @"";
    if ([carrier isEqualToString:@"verizon"]) {
        carrierTag = @"@vtext.com";
    }
    :
    :
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, the syntax highlighting below is working how I'd like it to,
I'm writing some logging code that is based on SessionID... However, when I log
I have a function that creates and insert some numbers in a vector. if(Enemy2.dEnemy==true)
Can someone recommend a reliable HTML tree control that also supports tree manipulation? I
On my website i want to open a div in jQuery and show the
I've created a simple submit form, where the user inputs their e-mail address and
I was starting to get a LOT of routes in my bootstrap so I
I'll get straight to the point, I am using jQuery to clone a div
I set the cookies regularly in a callback page in my Twitter application. Everything
I'll try and explain what I'm trying to achieve quickly, since I have no

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.