メソッド alertViewShouldEnableFirstOtherButton で、ユーザー入力の最初の文字を大文字に変更しようとしています。iOS 6 ではすべてが期待どおりに動作しますが、iOS 5 では無限ループが発生するようです (アラート ビューのテキスト フィールドをプログラムで設定すると、メソッド alertViewShouldEnableFirstOtherButton が再帰的に呼び出されます)。コードは次のとおりです。
- (BOOL)alertViewShouldEnableFirstOtherButton:(UIAlertView *)alertView{
NSString *inputText = [[alertView textFieldAtIndex:0] text];
if(inputText.length==0)return NO;
unichar firstChar=[[inputText capitalizedString] characterAtIndex:0];
NSString *capitalizedLetter= [NSString stringWithCharacters:&firstChar length:1];
NSString *str=[inputText stringByReplacingCharactersInRange:NSMakeRange(0, 1) withString:capitalizedLetter];
[[alertView textFieldAtIndex:0] setText:str];// setText calls again alertViewShouldEnableFirstOtherButton
return YES;
}