這一個適用於ios模擬器,但不適用於我的iphone設備。爲什麼?deleteCharactersInRange:範圍或索引超出範圍'
NSMutableString *categoryList = [NSMutableString string];
for (NSArray *category in self.storedCategories) {
[categoryList appendString:[category valueForKey:@"value"]];
[categoryList appendString:@","];
}
[categoryList deleteCharactersInRange:NSMakeRange([categoryList length]-1, 1)]
2014-01-17 19:41:58.572 someapp[14586:60b] *** Terminating app due to uncaught exception 'NSRangeException', reason: '-[__NSCFString deleteCharactersInRange:]: Range or index out of bounds'
*** First throw call stack:
(0x2de38f4b 0x382796af 0x2de38e8d 0x2ddfd88f 0x98419 0x305e0713 0x305e06b3 0x305e0691 0x305cc11f 0x305e0107 0x305dfdd9 0x305dae65 0x305b079d 0x305aefa3 0x2de04183 0x2de03653 0x2de01e47 0x2dd6cc27 0x2dd6ca0b 0x32a93283 0x30610049 0x995ed 0x38781ab7)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)