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 this code wont work, it doesn't seem to read the javascript.php
I have this simple ajax code, for some reason it wont load content onto
I have this code. For some reason, when I display the html, it wont
For some reason my code here (this is the entire thing) doesnt actually render
For some reason the following code doesn't work on Windows XP. new URL(file:// +
For some reason this line of code is giving me quite a problem. struct
For some reason, this line of code is returning undefined for $(this).attr(href) $(a).attr(href, javascript:page('
For some reason, this code does not actually draw my bitmap file... or show
I worked this holiday to find out my code wont work on HTTPS. My
For some reason my bind events won't work. You can see my code here:

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.