我在我的應用程序中使用了ZBar SDK,我可以正常運行。不過,我得到以下警告,我想不通:無法刪除有關iOS 6中棄用方法的警告
"presentModalViewController:animated" is deprecated. First deprecated in iOS 6.
我,我用這條線完整的方法如下:
- (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...");
}
現在,我做了一些研究,我發現,在iOS 6中使用更新的方法是:
[self presentModalViewController: reader animated: YES completion: nil];
然而,當我在我的代碼中使用此行,而不是過時的一個,現在我收到以下錯誤,而不是警告:
"no visible @interface for "ViewController" declares the selector 'presentModalViewController: animated: completion: '.
我真的不知道如何糾正這個錯誤,並想知道如何。我的問題是我試圖糾正警告的方式嗎?我真的不知道,並會感謝任何見解。我從這裏下載了ZBar SDK:http://zbar.sourceforge.net/iphone/sdkdoc/
並且ZBar SDK的實際文件夾只包含頭文件。
在此先感謝所有回覆的人。
請確保您正在釋放對象。這不是一個ARC圖書館。 – Michael 2013-06-10 23:45:55