• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSScanner Failing with EXC_BAD_ACCESS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSScanner Failing with EXC_BAD_ACCESS


  • Subject: Re: NSScanner Failing with EXC_BAD_ACCESS
  • From: "Hank Heijink (Mailinglists)" <email@hidden>
  • Date: Fri, 15 Oct 2010 15:00:22 -0400

On Oct 15, 2010, at 2:44 PM, Chris Tracewell wrote:

> NOTE :: GC Enabled
>
> I am using an NSScanner in an NSString category but am crashing whenever I try to log the string I scanned into or to return it. If I comment out the NSLog there are no problems.
>
> NSString *theScannedString;

I would set theScannedString to nil here to avoid your crash below.

> NSScanner *theScanner = [NSScanner scannerWithString:theNewHTML];
> NSCharacterSet *theCharacterSet = [NSCharacterSet characterSetWithCharactersInString:@"1234567890abcdefghijklmnopqrstuvwxyz`~!@#$%^&*()-_=+<>?,./:\";'[]\{}| "];
> [theScanner scanCharactersFromSet:theCharacterSet intoString:&theScannedString];

Have you checked if this method returns NO? If so, theScannedString might never be allocated, since you don't. If you set it to nil upon declaration, at least you won't pass a garbage pointer to NSLog.

> NSLog(@"%@",theScannedString);
>
> Does anyone have a hint as to what may be the issue?
>
> Thanks
>
> --chris_______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSScanner Failing with EXC_BAD_ACCESS
      • From: Bill Bumgarner <email@hidden>
References: 
 >NSScanner Failing with EXC_BAD_ACCESS (From: Chris Tracewell <email@hidden>)

  • Prev by Date: NSScanner Failing with EXC_BAD_ACCESS
  • Next by Date: Re: NSScanner Failing with EXC_BAD_ACCESS
  • Previous by thread: NSScanner Failing with EXC_BAD_ACCESS
  • Next by thread: Re: NSScanner Failing with EXC_BAD_ACCESS
  • Index(es):
    • Date
    • Thread