gpt4 book ai didi

objective-c - NKAssetDownload addAssetWithRequest apns sigabrt

转载 作者:行者123 更新时间:2023-11-29 13:40:29 26 4
gpt4 key购买 nike

我通常能够弄清楚为什么 sigabrts 会发生,但我完全被困在这个问题上。我从远程通知启动应用程序,一切正常,直到它到达这段代码:

NKIssue *issueNK = [[NKLibrary sharedLibrary] issueWithName:[issueId stringValue]]; 
if (issueNK == nil) {
issueNK = [[NKLibrary sharedLibrary] addIssueWithName:[issueId stringValue] date:[NSDate date]];
}

NSMutableDictionary* settings = [[[NSMutableDictionary alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Settings" ofType:@"plist"]] autorelease];
NSURL *downloadURL = [NSURL URLWithString:
[NSString stringWithFormat:[settings objectForKey:@"IssueBundleUrl"], [issue.issueId intValue]]];
NSURLRequest *request = [NSURLRequest requestWithURL:downloadURL];
NKAssetDownload *assetDownload = [issueNK addAssetWithRequest:request]; //sigabrt on this line
[assetDownload downloadWithDelegate:issueListViewController];

在调试器中,issueNK 和 request 似乎都没有问题,不是 nil 或任何东西。

有什么想法吗?谢谢。

最佳答案

我猜你会在该行看到异常的唯一原因是问题是否已经下载或正在下载。所以你需要先检查你的问题的状态:

NKIssue *issueNK = [[NKLibrary sharedLibrary] issueWithName:[issueId stringValue]]; 
if (issueNK == nil) {
issueNK = [[NKLibrary sharedLibrary] addIssueWithName:[issueId stringValue] date:[NSDate date]];
}

if ([issueNK status] != NKIssueContentStatusNone)
return;

NSMutableDictionary* settings = [[[NSMutableDictionary alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Settings" ofType:@"plist"]] autorelease];
NSURL *downloadURL = [NSURL URLWithString:
[NSString stringWithFormat:[settings objectForKey:@"IssueBundleUrl"], [issue.issueId intValue]]];
NSURLRequest *request = [NSURLRequest requestWithURL:downloadURL];
NKAssetDownload *assetDownload = [issueNK addAssetWithRequest:request];
[assetDownload downloadWithDelegate:issueListViewController];

关于objective-c - NKAssetDownload addAssetWithRequest apns sigabrt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9326303/

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