Present view controller using Storyboards

Viewed 9820

I have followed a tutorial to add In App Purchases to my app. There are 2 views:

  1. Button to 'Buy item'
  2. Screen comes up that allows user to select product

I have added the code completely fine but in the tutorial they were using XIB files but I am using Storyboard. My code for the 'Buy item' button looks something like this:

- (IBAction)PurchaseItem:(id)sender {

    _purchaseController = [[PurchasedViewController alloc] initWithNibName:Nil bundle:nil];

    _purchaseController.productID = @"com.myapp";

    [self presentViewController:_purchaseController animated:YES completion:NULL];

    [_purchaseController getProductID:self];

}

The issue I have is that when the button is clicked, a black screen appears, but I want PurchasedViewController to show

Do I need to change something?

EDIT:

Using edited code but getting error as attached:

- (IBAction)PurchaseItem:(id)sender {

        PurchasedViewController *purchaseContr = (PurchasedViewController *)[self.storyboard instantiateViewControllerWithIdentifier:@"menu"];
        //menu is only an example
        purchaseContr.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
        [self presentViewController:purchaseContr animated:YES completion:nil];

    }

enter image description here

2 Answers
Related