1

を作成したいのですがUIActionSheet、「センチネルがありません」という警告が常に表示されます。

/Users/....mm:136:173: 警告: メソッドディスパッチにセンチネルがありません [-Wsentinel]

UIActionSheet* adsl_action_sheet = [[[UIActionSheet alloc] initWithTitle:nil 
                                                                delegate:(id<UIActionSheetDelegate>)self 
                                                       cancelButtonTitle:[dsd_string_localizer ms_get_localized_system_string:@"Cancel"] 
                                                  destructiveButtonTitle:nil 
                                                       otherButtonTitles:[dsd_string_localizer ms_get_localized_system_string:@"Logoff"], [dsd_string_localizer ms_get_localized_system_string:@"Disconnect"], nil] autorelease];

私は本当に何も悪いところが見えません...多分私は盲目です.

このコードを含むファイルは、Objective-C++ ファイルです。

また、そのようなセンチネルが必要なすべての場所でこれらの「センチネル警告」が表示されていることにも気付きました。

4

2 に答える 2

1

nil次を使用して、その最終的な「センチネル」を正しいタイプにキャストする必要があります。

... , (NSString *)nil] autorelease];
//    ^^^^^^^^^^^^

ただし、コンパイラがこのキャストを必要とする理由はわかりません。

これはコンパイル時に必要だと思います-Wstrict-null-sentinel(OPからの確認待ち)。

于 2014-05-07T13:51:56.520 に答える