Question

Je suis normalement en mesure de comprendre pourquoi sigabrts arriver, mais je suis tout à fait bloqué sur celui-ci .. Je lance l'application à partir d'une notification à distance, toutes fonctionne très bien jusqu'à ce qu'il arrive à ce morceau de code:

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];

dans le débogueur, issueNK et demande semblent tous deux être bien, pas nul ou quoi que ce soit.

toutes les idées? merci.

Était-ce utile?

La solution

I would guess that the only reason you would see an exception on that line, is if the issue has already been downloaded or is being downloaded. So you need to check the status of your issue first:

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];
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top