Question

I am using the ZBar SDK in my application, which I am able to run just fine. However, I am getting the following warning that I can't figure out:

"presentModalViewController:animated" is deprecated.  First deprecated in iOS 6.

My full method where I use this line is as follows:

- (IBAction) scanButtonTapped
{

// ADD: present a barcode reader that scans from the camera feed
ZBarReaderViewController *reader = [ZBarReaderViewController new];
reader.readerDelegate = self;
reader.supportedOrientationsMask = ZBarOrientationMaskAll;

ZBarImageScanner *scanner = reader.scanner;
// TODO: (optional) additional reader configuration here

// EXAMPLE: disable rarely used I2/5 to improve performance
[scanner setSymbology: ZBAR_I25
               config: ZBAR_CFG_ENABLE
                   to: 0];

// present and release the controller
//line below is deprecated
[self presentModalViewController:reader animated:YES];
//line below when I uncomment causes an error
//[self presentModalViewController: reader animated: YES completion: nil];
NSLog(@"TBD: scan barcode here...");
}

Now, I did some research and I found out that the updated method to use in iOS 6 is:

[self presentModalViewController: reader animated: YES completion: nil];

However, when I use this line in my code instead of the deprecated one, I am now getting the following error instead of a warning:

"no visible @interface for "ViewController" declares the selector 'presentModalViewController: animated: completion: '.

I honestly don't know how to correct this error, and would like to know how. Is my problem the way I am trying to correct the warning? I honestly don't know and would appreciate any insight.

FYI, I downloaded the ZBar SDK from here: http://zbar.sourceforge.net/iphone/sdkdoc/
and the actual folder for the ZBar SDK contains only header files.

Thanks in advance to all who reply.

Was it helpful?

Solution

That's not the updated method. This is

[self presentViewController:reader animated:YES completion:nil]; 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top