 |
 |
Signal 10 error all the sudden
|
 |
|
 |
|
Professional Poster
Join Date: Sep 2000
Location: San Francisco
Status:
Offline
|
|
I have a project that used to run fine, but all the sudden I am getting these annoying signal 10 errors since I upgraded to the Dec dev tools. Is this some sort of a memory error?
thanks,
kman
|
|
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Jan 2002
Location: New York
Status:
Offline
|
|
Yes, that means you're trying to access a memory location that doesn't exist anymore. Most likely you're autoreleasing or releasing where you shouldn't be doing so.
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Sep 2000
Location: San Francisco
Status:
Offline
|
|
Well. I've made a bit of progress, but I could still use some help. I'm using accessor methods, such as:
Code:
-(void)setArticleVolume:(NSString *)aVolume {
[aVolume retain];
[articleVolume release];
articleVolume=aVolume;
}
Basically, I'm parsing an XML document using NSScanner to find the beginning/ending tag and then putting the result into the NSString using an accessor method as above.
I've figured out that if I comment out the portions of the code that parse out numbers, then the app runs fine. This doesn't make a lot of sense to me as I think the numbers should be getting treated as just strings. Here's the XML parsing code:
Code:
@implementation XMLParser
+(NSString *)parse: (NSString *)stringToBeParsed withBeginningTag:(NSString *)beginningTag withEndingTag: (NSString *)endingTag
{
NSScanner *theScanner;
NSString *parseResults;
theScanner = [NSScanner scannerWithString:stringToBeParsed];
[theScanner scanUpToString:beginningTag intoString:NULL];
[theScanner scanString:beginningTag intoString:NULL];
[theScanner scanUpToString:endingTag intoString:&parseResults];
return parseResults;
}
@end
And here is the code that calls the XML parser:
Code:
[self setArticleAuthors:[XMLParser parse:referenceXML withBeginningTag:@"<LastName>" withEndingTag:@"</LastName>"]];
NSLog(@"here2");
[self setArticleAbstract:[XMLParser parse:referenceXML withBeginningTag:@"<AbstractText>" withEndingTag:@"</AbstractText>"]];
NSLog(@"here3");
// [self setArticleVolume:[XMLParser parse:referenceXML withBeginningTag:@"<Volume>" withEndingTag:@"</Volume>"]];
NSLog(@"here4");
// [self setArticleIssue:[XMLParser parse:referenceXML withBeginningTag:@"<Issue>" withEndingTag:@"</Issue>"]];
You can see where I have commented out the portions dealing with numbers (i.e. journal issues, page numbers, etc).
Any further help would be most appreciated. I think I am just missing something fairly fundamental here.
thanks,
kman
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Nov 2000
Status:
Offline
|
|
Hmm....
- (BOOL)scanString  NSString *)string intoString  NSString **)stringValue
Scans for string, and, if a match is found, returns an equivalent string object by reference in stringValue. Returns YES if stringValue matches the characters at the scan location; otherwise returns NO.
Invoke this method with nil as stringValue to simply scan past a given string.
Code:
@implementation XMLParser
+(NSString *)parse: (NSString *)stringToBeParsed withBeginningTagNSString *)beginningTag withEndingTag: (NSString *)endingTag
{
NSScanner *theScanner;
NSString *parseResults; // nil!
//fix?: NSString *parseResults = [NSString string];
theScanner = [NSScanner scannerWithString:stringToBeParsed];
[theScanner scanUpToString:beginningTag intoString:NULL];
[theScanner scanString:beginningTag intoString:NULL];
[theScanner scanUpToString:endingTag intoString:&parseResults];
// NSLog(@"(%@) returning parseResults: %@", self, parseResults);
return parseResults;
}
@end
My guess is you're trying to use the parseResults object even though it's nil...
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Nov 2000
Status:
Offline
|
|
My last post received a beat-down from the parser but I think it's ok. I should've remembered to turn off the smileys! 
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Sep 2000
Location: San Francisco
Status:
Offline
|
|
You are correct, sir!!!
After checking, one of the returned XML files contained nothing for some of the fields. I'll pop in some code to correct for the nil return and see if that helps.
Can anyone say, "Error trapping is good coding practice."? Obviously, I can't.
kman
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|