Reputation: 45
I used some code from a project that used xib. I use storyboards. I'm new to coding. The code ran fine, but I have 17 Deprecations warnings for UITextAlignment (Center and Left), UILineBreakModeWordWrap, presentModalViewController:animated, dismissModalViewControllerAnimated, and minimumFontSize. That they are deprecated in iOS 6.0. I thought I had added the right files to avoid these (e.g., ReaderViewController, ThumbsViewController, ReaderMain, ReaderMainPagebar, etc) from the xib-based example, and compiled them. Any clues on how I can fix these? Is this serious?
self.imageRoll = [UIImage imageWithContentsOfFile:fPath];
UIImage *anImage = [UIImage imageNamed:self.imageRoll];
Also, in the code above, I keep getting a message 'incompatible pointer types sending "UIImage *" to parameter of type "NSString *"' for this variable "imageRoll". Suggestions to deal with this? The lines are in different methods.
Upvotes: 0
Views: 359
Reputation: 318944
You fix deprecated warnings by replacing your use of the deprecated symbol with its proper replacement. But make sure that the new symbol will work with all versions of iOS you need to support.
Example - UILineBreakModeWordWrap
was deprecated and replaced with NSLineBreakByWordWrapping
. The good news in this case is that you can safely replace UILineBreakModeWordWrap
with NSLineBreakByWordWrapping
. Both have the same enum value so the change will work with all versions of iOS.
presentModalViewController:animated
was deprecated and replaced with presentViewController:animated:completion:
in iOS 5.0. As long as you are not trying to support iOS 4.3, replace your use of presentModalViewController:animated
with presentViewController:animated:completion:
.
Look in the reference docs for each deprecated symbol. The documentation almost always tells you the replacement. Again, make sure the replacement method is available all the way back to whatever Deployment Target you are using.
Your issue with the two lines of code you posted is simple. self.imageRoll
is a property defined as a UIImage
pointer. The UIImage imageNamed:
method expects an NSString
specifying a filename. Since you already have an image from the 1st line, the 2nd line should simply be:
UIImage *anImage = self.imageRoll;
Upvotes: 1