2

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?

BlackM
  • 3,927
  • 8
  • 39
  • 69
  • What's your info plist setup like? Have you added the `UINewsstandApp` key? – Hyperbole Jan 14 '14 at 20:30
  • Please post it as answer. It solved my problem. I didn't want the app in the newsstand so that's why I didn't change the plist. – BlackM Jan 14 '14 at 20:36

1 Answers1

2

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.

Hyperbole
  • 3,917
  • 4
  • 35
  • 54