簡體   English   中英

在iPad上使用IOS6呈現UIActionSheet時崩潰

[英]crash when presenting a UIActionSheet on iPad with IOS6

我在沒有iOS 5的iPad上展示UIActionSheet。 現在,在iPad上安裝了iOS 6后,執行相同操作時該應用程序將崩潰。 我不知道如何解決該問題,因為我的代碼沒有更改,並且堆棧跟蹤很難理解。 有人遇到過同樣的問題嗎?

我的UIActionSheet初始化代碼:

UIActionSheet *menu = [[[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"ExportMethod", @"") delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", @"") destructiveButtonTitle:nil otherButtonTitles:NSLocalizedString(@"ExportMethodMail", @""), NSLocalizedString(@"ExportMethodiTunes", @""), nil] autorelease];
self.actionSheet = menu;

要呈現UIActionSheet

[self.actionSheet showFromBarButtonItem:self.navigationItem.rightBarButtonItem animated:YES];

我還嘗試了其他可能的電話:

[self.actionSheet showInView:self.view];
[self.actionSheet showFromTabBar:self.tabBarController.tabBar];
[self.actionSheet showFromRect:self.view.bounds inView:self.view animated:YES];

但是,應用程序總是在此行崩潰,並顯示以下消息:

Thread 6: EXC_BAD_ACCESS (code = 1, adress = 0xcc)

如果我在沒有調試器的情況下運行該應用程序,則將具有以下堆棧跟蹤:

 Thread 5 Crashed:
 0   libicucore.A.dylib             0x39620570 ucol_getVersion + 0
 1   TextInput                      0x36aed21a   KB::WordTrie::dictionary_versions_ok(KB::ReadOnlyDataFile const*) const + 62
 2   TextInput                      0x36aecfa4 KB::WordTrie::load(KB::String const&) + 276
 3   TextInput                      0x36ae6490 <redacted> + 12
 4   TextInput                      0x36e50cae <redacted> + 54
 5   TextInput                      0x36e50c4c <redacted> + 40
 6   TextInput                      0x36addf68 TIInputManager::load_dictionaries(KB::String const&, KB::String const&, bool) + 20
 7   TextInput                      0x36aeefbc <redacted> + 216
 8   TextInput                      0x36aeec02 <redacted> + 498
 9   UIKit                          0x356ccf7a <redacted> + 158
 10  UIKit                          0x356cbfce <redacted> + 398
 11  UIKit                          0x356cbbe2 <redacted> + 374
 12  UIKit                          0x356ca4b4 <redacted> + 460
 13  UIKit                          0x356ca1a6 <redacted> + 146
 14  UIKit                          0x3593001c <redacted> + 264
 15  UIKit                          0x3593045c <redacted> + 568
 16  UIKit                          0x3593468c <redacted> + 564
 17  UIKit                          0x35934a94 <redacted> + 136
 18  UIKit                          0x35934e5e <redacted> + 250
 19  EasyTag                        0x0002365e -[GameDetailController exportGameAsCSV] (GameDetailController.m:598)

出現UIActionSheetexportGameAsCSV方法。

感謝您的回答。 問題是我不在UI線程中。 根據Apple的文檔:

Important The UIKit classes are generally not thread safe. All drawing-related operations should be performed on your application’s main thread.

以下代碼解決了該問題:

dispatch_async(dispatch_get_main_queue(), ^{

    [self.actionSheet showFromBarButtonItem:self.navigationItem.rightBarButtonItem animated:YES];

 });

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM