Auto property synthesize will not synthesize property - new warning iOS8.3
Asked Answered
R

4

12

After updating to iOS8.3 I started getting a bunch of new warnings that werent there on iOS8.2. One in particular that caught my eye;

@property (strong, nonatomic) IBOutlet UITableView *tableView;

which was declared in a '.m' file.

What has changed in iOS8.3 to make this a warning?

Auto property synthesis will not synthesize property 'tableView'; it will be implemented by its superclass, use @dynamic to acknowledge intention
Reisch answered 15/4, 2015 at 16:57 Comment(4)
Is your view controller you added the tableView to a UITableViewController?Maharajah
FYI, IBOutlets should be weak since the view itself holds a strong reference. Avoid retention cycles. developer.apple.com/library/mac/documentation/Cocoa/Conceptual/…Thiazole
@DCGoD the horrors of looking at code that I wrote 18months ago hahaReisch
We are ALL guilty of that, LOL. Cringe, learn, refactor, rinse and repeat. ;-) Code is never "done".Thiazole
T
16

If you're using a UITableViewController then tableView is already synthesized. (ie. self.tableView is the tableView of the UITableViewController).

Thiazole answered 15/4, 2015 at 17:3 Comment(0)
R
16

I faced similar issue too. I solved this by the following method. Inside your .m file write @dynamic tableView under the @implementation

I hope your issue will be solved.

Radon answered 16/4, 2015 at 7:11 Comment(1)
This does not necessarily address the underlying cause, which is that you are overriding a property defined in a superclass.Sooksoon
C
11

What has changed? The compiler has become more clever.

You are probably subclassing UITableViewController.

UITableViewController already has a property named tableView. It is already synthesized or implemented otherwise in UITableViewController. So the warning tells you that you are not getting your own tableView property, but that you are getting the one supplied by UITableViewController.

Obviously if you were not aware of the tableView in UITableViewController, and if you wrongly assumed that this is your property, under your control, there would be trouble. That's why you get a warning. So if that is what you were doing, then your code was always badly broken, and needs fixing.

But if you just have the @property declaration in your code, but you know that it is actually the UITableViewController property, no harm is done, but remove the @property because it is wrong.

Creaky answered 15/4, 2015 at 17:3 Comment(1)
Thanks for the details explanation. It was the last point. It was really old code I was looking at. Thankfully It was brought to my attention.Reisch
L
1

Had a similar problem with a custom UITableViewCell creating a new property called imageView. Since a property named imageView already existed, I kept getting the error message. I simply changed the name to projectImageView and it worked.

Leede answered 10/7, 2015 at 7:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.