I'm working with an existing code. Here a popovercontroller has been declared in .h file and its giving me error in implementation line.
.h file
@property (nonatomic, strong) VFImagePickerController *imagePicker;
@property (nonatomic, strong) UIPopoverController *popoverController;
@property (nonatomic, strong) UINavigationController *targetVC;
.m file:
Please suggest how to fix this.
It appears that your class is a subclass of UIViewController
. UIViewController
has a private, undocumented ivar of _popoverController
. Since you are trying to create an ivar in your class with the same name, you are getting an error.
The easiest thing to do is to rename your popoverController
property to something different. Otherwise your app might get flagged for using a private API.
This problem occurs because your superclass, UIViewController, already has an instance variable named _popoverController
. As a result, neither the default synthesis nor your explicit (commented) @synthesize
directive have access to the instance variable that they want to use to provide the popoverController
property.
You can resolve this by either renaming your property, or explicitly synthesizing the property to use a different instance variable name:
// Either
@property (nonatomic, strong) UIPopoverController *localPopoverController
// Or
@synthesize popoverController = _localPopoverController;
(Also note that the "local" prefix isn't necessarily best practice for your property names or instance variables; take a second to consider your preferred naming convention and pick a property/instance variable name appropriately.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With