Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Chris Stahl
235 PointsUIRefreshControl Error - @dynamic?
I have the UIRefreshControl coded as outlined in the video, but I am receiving a warning:
Auto property synthesis will not synthesize property 'refreshControl'; it will be implemented by its superclass, use @dynamic to acknowledge intention
under the warning are three exclamation marks inside gray
1) In file included from /Users/XXX/Dropbox/XXX/InboxViewController.m:9: -this shows a reference to
#import "InboxViewController.h"
inside inboxViewController.m
2)Proper declared here -this shows a reference to
@property (nonatomic, strong, nullable) UIRefreshControl *refreshControl NS_AVAILABLE_IOS(6_0) __TVOS_PROHIBITED;
inside UITableViewController.h
3) Detached while default synthesizing properties in class implementation -this shows a reference to
@implementation InboxViewController
inside InboxViewController.m
The warning is not crashing the app, but I would really like to clean it up.
I have been searching for the cause of this warning, but I can't really find any clear answers, and I am new to coding so I don't want to try and install new code from GitHub because the installation methods for some of the open source code is not clear cut.
Can anyone help?
2 Answers
Michael Hulet
47,913 PointsMy guess is that the class that your InboxViewController is subclassing is a class that already has a property of type UIRefreshControl with the name refreshControl implemented. Is InboxViewController a subclass of UITableViewController? If either of those statements are true, all you have to do is delete your @property declaration of refreshControl.
Otherwise, in InboxViewController.m, you'll need to @synthesize the property. This has been automatic since Objective-C 2.0 (which came out in 2006), but you'll have to manually do it if you implement your own getter and setter method for a property. Manually doing it would look like this:
@implementation InboxViewController
@synthesize refreshControl = _refreshControl;
//The rest of your code goes here
@end
Chris Stahl
235 PointsWorked like a charm! Thank you!