Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

troop231

macrumors 603
Original poster
Jan 20, 2010
5,826
561
I downloaded the GM iOS 5 SDK with Xcode 4.2 and I'm getting this warning. When I run the app on the simulator it works fine, but I'm wondering how would I solve this? Thanks in advance! Screenshot:

screenshot20111004at111.png
 
Last edited:
The initWithFrame:reuseIdentifier: method has been deprecated since 3.0 two years ago. Are you just now receiving this warning?

Yes, which doesn't make sense, as I've been using Xcode 4 for awhile now with the latest 4 SDK.
 
Yes, which doesn't make sense, as I've been using Xcode 4 for awhile now with the latest 4 SDK.

You could have turned off the warnings for deprecated methods a while back and then it somehow got turned back on when you upgraded Xcode. Just a possibility.
 
You could have turned off the warnings for deprecated methods a while back and then it somehow got turned back on when you upgraded Xcode. Just a possibility.

Oh, I see, so how would I fix this warning? My apps have been working fine on iPads running the iOS 5 beta, but the deprecation scares me. Thanks in advance :)
 
Oh, I see, so how would I fix this warning? My apps have been working fine on iPads running the iOS 5 beta, but the deprecation scares me. Thanks in advance :)

I would use something like this:
Code:
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Standard"];
if (cell == nil) cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Standard"] autorelease]

(You can still use cell identifiers and such, I just prefer using strings.)

I'm still only using Xcode 4.1 and the newest version of iOS 4 (4.3.5? Something like that...) though, so maybe this has been deprecated since and I just haven't heard yet.
 
I would use something like this:
Code:
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Standard"];
if (cell == nil) cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Standard"] autorelease]

(You can still use cell identifiers and such, I just prefer using strings.)

I'm still only using Xcode 4.1 and the newest version of iOS 4 (4.3.5? Something like that...) though, so maybe this has been deprecated since and I just haven't heard yet.

Thanks for the info, do you know if this code is iOS 3 compatible? I'm still maintaining down to iOS 3 to support people who don't upgrade their hardware unfortunately.
 
There was a bug with deprecation warnings not showing for methods that return id, like init methods. I know the method under discussion didn't generate warnings for a long time.

OP, if you look at the header file that contains the method that has been deprecated you should be able to find out how you fix the problem. Also if you look at the reference docs for the relevant class you should find the method marked as deprecated and instructions on how to fix the issue.
 
There was a bug with deprecation warnings not showing for methods that return id, like init methods. I know the method under discussion didn't generate warnings for a long time.

OP, if you look at the header file that contains the method that has been deprecated you should be able to find out how you fix the problem. Also if you look at the reference docs for the relevant class you should find the method marked as deprecated and instructions on how to fix the issue.

I looked at the documentation here: http://developer.apple.com/library/...ITableViewCell/initWithStyle:reuseIdentifier:

Which is what I'm supposed to use now, but I can't figure out how to make it work with my existing code. :confused:
 
Did the code I provided a few posts ago not work?

I checked and the code I gave works on iOS versions as old as iOS 3, which if I'm not mistaken, will run on every iOS device ever made.

I'm still trying to figure out how to implement it with what I currently have, I'm having trouble :(

Edit: This code seems to work: Does it look right? It works fine on the simulator.

screenshot20111005at112h.png
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.