[2009-10-26]
1. tableview cell's content could not be filled
-->cellForRowAtIndexPathdelegate has never been called
-->reason: UITableViewDataSource delegate must be declared in the viewcontroller to handle these messages
2. NSMutableArray could not add new objects
-->be careful of the type conversion when usingcomponentsSeparatedByString method, it returns a NSArray object, you should never assign that object to a NSMutableArray, instead we should use setArray(NSArray*) method.
3. crashes when release views...
1) if you declared a subview as retained and then the superview was closed, you don't need to release it again in dealloc override method, or else it will cause a crash
2) refer to the following link for more ideas: http://www.cocoabuilder.com/archive/message/cocoa/2004/11/7/120999
3) in my case, i removed one subview, when i press one button of this subview, it will present a modal view to user bypresentModalViewController, then when i calldismissModalViewControllerAnimated, my app hang up. the solution is not to remove the subview before the dismissModalViewControllerAnimated, because i guess it was somewhere been used by the modal view. we must respect the view stack. take actions in order.
4. wrong checkmarks in my own multi-selection people picker view(table view)
the reason is that cell identifier is wrongly reused by another cell displayed by scrolling to another page.
solution is to set the proper reuse ID, as following:
UITableViewCellStyle style = UITableViewCellStyleDefault;
NSString *reuseID = [NSString stringWithFormat:@"%@", [[ALPHA substringFromIndex:indexPath.section] substringToIndex:1]];
UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:reuseID];
if (!cell) cell = [[[UITableViewCell alloc] initWithStyle:style reuseIdentifier:reuseID] autorelease];
then it will display the accessory type of all table cells in different sections properly.
5. if we want to reuse a subview, keep in mind to retain it before remove it from superview and release it after everything is done. or else it may lead to a crash.
[2009-11-07]
1. use setArray/setString for convert a NSArray to NSMutableArray and NSString to NSMutableString
2. do not release a autorelease object
3. be careful of using int/NSInteger to represent a phone No. as it may exceed it's range. for safe, use float value instead.
4. use the following codes to get a XML element value(say 5566778899):
<response>
<sender:errorCode=0>5566778899</sender>
...
</response>
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
[self.yaroundSMSParsedCharacterData appendString:string];
}
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
// We reset the current property, for the next nodes
[self.yaroundSMSParsedCharacterData setString:@""];
}
5. use following codes to get XML element key value (say errorCode value 0)
if( [elementName isEqualToString:@"sender"] ) {
errCode = [attributeDict valueForKey:@"errorcode"];
}