Tuesday 15 September 2015

objective c - problem with NSString stringWithString, in iPhone app -


This is a snippet of code that I am having problems with. I have an iPhone App that is 99% of our users. Works fine for, but maybe for 1%, I have this bug that I can not solve or reproduce at my end. The app just deposits for them, and does not actually crash (hence no crash report). Some ad hoc distribution has disclosed the problem of having this part of the code. If anyone has any ideas which is a problem then please tell me thank you.

NSString * addChar = Zero; NSString * fullname = (NSString *) ABRecordCopyCompositeName (record); AddChar = [[NSString stringWithString: [[Full name substringToIndex: 1] capitalized string]]; [FNN release]; NSMutableArray * array = [app_contacts objectForKey: addChar]; // lookup if the key exists (array == blue) // If there is nothing in the key, then create new array {nslog ("array empty"); NSMutableArray * newarray = [[NSMutableArray alloc] init]; [Navirea Dot Object: Index on One-Viewer: 0]; [App_contacts set value: newareray for: addchar]; [Newara release]; } And {nslog (@ "array is not empty"); [Array addObject: one_person]; [App_contacts setValue: array for: addChar]; } [Adcar release];

In this code:

  NSString * fullname = (NSString *) ABRecordCopyCompositeName (record); AddChar = [[NSString stringWithString: [[Full name substringToIndex: 1] capitalized string]];  

If the full name is equal to @ @, you will increase an exception when inviting [fullname substringToIndex: 1].


No comments:

Post a Comment