iosxcodenewsstand-kit

Not able to get addIssueWithName: work in NKLibrary


I am trying to work with NKLibrary but I having trouble getting addIssueWithName to work properly.

Here I am adding my issues:

 NSString *name = tmpIssue.name;

    NKLibrary *nkLib = [NKLibrary sharedLibrary];

    NKIssue *nkIssue = [nkLib issueWithName:name];

    NSLog(@"issue name %@",nkIssue.name);

    if(!nkIssue) {
        NSLog(@"Added issue with name: %@ and date: %@",[tmpIssue.name copy],[jsonDict2 objectForKey:@"Date"]);

        nkIssue = [nkLib addIssueWithName:[tmpIssue.name copy] date:[jsonDict2 objectForKey:@"Date"]];

    }
    else{

        NSLog(@"No need to add issue with name %@. It's already exists.",tmpIssue.name);

    }

and then I am trying to check if the issue is added using this code:

 NKLibrary *nkLib = [NKLibrary sharedLibrary];
NKIssue *nkIssue = [nkLib issueWithName:issue.name];

if(nkIssue==nil){

    NSLog(@"issue is nil");

}

The problem is that the issues are not added and I am always getting "nil". Even without closing the app. Any ideas what is the problem?


Solution

  • Make sure you've got a YES for your app's UINewsstandApp info plist key.

    From what I understand, NewsstandKit is deeply tied to other system-exclusive resources, so it makes sense to me that, if your setup isn't 100% complete compared to Apple's documentation, that you won't see the functionality you're trying to build.