gpt4 book ai didi

ios - 窥视 iOS 9 应用程序崩溃

转载 作者:行者123 更新时间:2023-11-29 10:25:00 24 4
gpt4 key购买 nike

我正在尝试在支持 iOS 9 的应用程序中执行 Peek 和 Pop。有问题的 View 有一个 UITableView,所以我的代码中有:

- (UIViewController *)previewingContext:(id<UIViewControllerPreviewing>)previewingContext viewControllerForLocation:(CGPoint)location {

// check if we're not already displaying a preview controller
if ([self.presentedViewController isKindOfClass:[WebViewController class]]) {
return nil;
}

// shallow press: return the preview controller here (peek)
self.webViewController = [[[WebViewController alloc] initWithNibName:@"WebViewController" bundle:[NSBundle mainBundle]] autorelease];




return self.webViewController;
}
- (void)previewingContext:(id<UIViewControllerPreviewing>)previewingContext commitViewController:(UIViewController *)viewControllerToCommit {

// deep press: bring up the commit view controller (pop)
self.webViewController = [[[WebViewController alloc] initWithNibName:@"WebViewController" bundle:[NSBundle mainBundle]] autorelease];


[self showViewController:self.webViewController sender:self];
}

WebViewController 是我已经设置好的ViewController,当tableview的行被选中时显示内容。我得到的错误是:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSCFConstantString stringByAppendingString:]: nil argument'
*** First throw call stack:
(0x182160f5c 0x19764bf80 0x182160ea4 0x182fb8868 0x1001307a4 0x1876cf9ac 0x1876cf720 0x187a025f8 0x187960844 0x18796cde4 0x1876a91e4 0x182117c30 0x1821159d4 0x182115e04 0x182044dc0 0x18d4e0088 0x18771ef60 0x10014ca68 0x197e6a8b8)
libc++abi.dylib: terminating with uncaught exception of type NSException

最佳答案

您的日志准确说明了您的代码有什么问题:

-[__NSCFConstantString stringByAppendingString:]: nil argument'

您正在执行 stringByAppendingString 并传递一个 nil

的值

此外,如果您使用的是 ARC,则不再使用 autorelease(现在是默认设置)

关于ios - 窥视 iOS 9 应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32847969/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com