Re: NSScanner Failing with EXC_BAD_ACCESS

2010-10-16 Thread Matt Neuburg
On Fri, 15 Oct 2010 22:45:57 -0400, Dave Keck said: >> >> NSString *theScannedString = nil; >> >> Now you can log that value successfully, even if nothing gets written >>into >> it. Then you can track down *why* nothing is getting written into it. >>:) m. > >No – initializing theScannedString does

Re: NSScanner Failing with EXC_BAD_ACCESS

2010-10-15 Thread Dave Keck
> The problem is probably that theScannedString has never been initialize > it. Always initialize when you declare, because otherwise your value could > be nonsense and can't be logged. So, minimally, you'd say this: Good advice regarding initialization, but... > NSString *theScannedString = nil;

Re: NSScanner Failing with EXC_BAD_ACCESS

2010-10-15 Thread Matt Neuburg
On Fri, 15 Oct 2010 11:44:26 -0700, Chris Tracewell said: >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; >NSSc

Re: NSScanner Failing with EXC_BAD_ACCESS

2010-10-15 Thread Chris Tracewell
Thanks all. I got it working, indeed the Scanner was failing, which as Kiel suggested, must have led to an invalid pointer by the time I tried to log/return it. Once I checked the BOOL it quit crashing and then with some reworking of my NSScanner code it processed and returned the string I wante

Re: NSScanner Failing with EXC_BAD_ACCESS

2010-10-15 Thread Bill Bumgarner
On Oct 15, 2010, at 12:00 PM, Hank Heijink (Mailinglists) wrote: >> NSString *theScannedString; > > I would set theScannedString to nil here to avoid your crash below. That would be making the assumption that the implementation of scanCharactersFromSet:intoString: does not muck with the pointe

Re: NSScanner Failing with EXC_BAD_ACCESS

2010-10-15 Thread Kiel Gillard
http://developer.apple.com/library/ios/documentation/cocoa/reference/foundation/Classes/NSScanner_Class/Reference/Reference.html#//apple_ref/occ/instm/NSScanner/scanCharactersFromSet:intoString: You pass by reference to the - [NSScanner scanCharactersFromSet:intoString:] method an uninitialised p

Re: NSScanner Failing with EXC_BAD_ACCESS

2010-10-15 Thread Hank Heijink (Mailinglists)
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

NSScanner Failing with EXC_BAD_ACCESS

2010-10-15 Thread Chris Tracewell
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; NSScanner *theScanner = [NSScanner scannerWithString:theNewHTML]; NSC