如何在没有xcode的情况下在iPhone本身上进行调试? UISearchBar/DisplayController 崩溃

发布于 2024-12-09 00:14:54 字数 1372 浏览 1 评论 0原文

我有一个问题:我正在编写一个使用 searchBar 和 tableView 的应用程序。

当我单击搜索栏,输入一些要搜索的字符串时,一旦我点击取消按钮,或者删除所有搜索词并再次单击 tableView,我的应用程序就会崩溃。

当我在 iOS 模拟器中运行该应用程序时,它不会崩溃。

当我通过 xcode 在 iPhone 上运行该应用程序时,执行此操作时它不会崩溃。

我不太了解设备日志,我想问是否有任何方法可以找出发生了严重错误以及为什么在通过 xcode 执行此操作时没有发生这种情况。请帮我!

PS:设备日志之一:(也许你们都明白这一点)

出了点问题

编辑:这是 searchDisplayControllerDidEndSearch 方法的代码:

- (void)searchDisplayControllerDidEndSearch:(UISearchDisplayController *)controller 
{    
    [self.navigationController setNavigationBarHidden:NO animated:YES];
    [UIView beginAnimations:@"DeactivateSearch" context:nil];
    [UIView setAnimationDuration:0.4];
    [self.attractionsTableView setFrame:CGRectMake(0, 43, 320, 362)];
    [UIView commitAnimations];


    NSFetchRequest *fetchRequest = [[self fetchedResultsController] fetchRequest];

    [fetchRequest setPredicate:nil];

    NSError *error = nil;
    if (![[self fetchedResultsController] performFetch:&error]) {
        // Handle error
        NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
        abort();
    }  

    [self setSearchIsActive:NO];

    return;
}

更新:如果没有键入文本,搜索栏不会崩溃。因此,只需激活搜索栏并停用它,无需输入内容。但是,一旦我输入一个字符,停用过程就会使应用程序崩溃。

I have a problem: I am programming an app that is using a searchBar and a tableView.

When I click the search bar, type some string to search for, as soon as I hit the cancel button, or delete all the search terms and click the tableView again my app crashes.

When I run the app in the iOS Simulator, it doesn't crash when doing this.

When I run the app on my iPhone via xcode, it doesn't crash when doing this.

I don't really understand the device log and I wanted to ask if there is any way to find out what's going terribly wrong and why this is not happening when doing it via xcode. Please help me!

PS: One of the device logs: (Maybe you guys understand this)

something went wrong

EDIT: Here's the code of the searchDisplayControllerDidEndSearch method:

- (void)searchDisplayControllerDidEndSearch:(UISearchDisplayController *)controller 
{    
    [self.navigationController setNavigationBarHidden:NO animated:YES];
    [UIView beginAnimations:@"DeactivateSearch" context:nil];
    [UIView setAnimationDuration:0.4];
    [self.attractionsTableView setFrame:CGRectMake(0, 43, 320, 362)];
    [UIView commitAnimations];


    NSFetchRequest *fetchRequest = [[self fetchedResultsController] fetchRequest];

    [fetchRequest setPredicate:nil];

    NSError *error = nil;
    if (![[self fetchedResultsController] performFetch:&error]) {
        // Handle error
        NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
        abort();
    }  

    [self setSearchIsActive:NO];

    return;
}

UPDATE: The search bar does NOT crash if no text was typed. So simply activating the searchBar and deactivating it without typing works. But as soon as I have typed a single character the deactivating process crashes the app.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不再见 2024-12-16 00:14:54

查找动画回调问题。还有一个控制台日志,你看一下。

Look for an animation callback issue. Also there is a console log, look at it.

乖乖 2024-12-16 00:14:54

我自己找到了答案。

在我的一个自定义单元格中,我过于频繁地发布某些内容,因此当 UISearchDisplayController 为搜索结果释放 UITableView 时,应用程序崩溃了。

I found the answer myself..

In one of my custom cells I released something too often and thus the app crashed when the UISearchDisplayController was releasing the UITableView for the search results.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文