Updating auto-added @available(iOS 13.0, *)

Upon updating to Xcode 11 one of my VC files had @available(iOS 13.0, *) add to it, which stops my app from building. It hasn't been added to any other file. Are there some likely reasons for this to be added?

Accepted Reply

Take care however. Setting the target to iOS 13 will prevent users to download on iOS12 devices or below. iOS 13 is not yet enough spread to afford this.


For the other issue:

My viewcontrollers are not going all the way to the top of the screen anymore. A constraints issue maybe. I'll experiment and see what I find.


No, it is not a constraint, it is a new default setting for VC.


- Go to IB

- Select your VC (select VC itself)

- Open attributes inspector

- You should see a field named Presentation

- Its content is likely Automatic

- Change to full screen


You will see that the VC displays changes and now covers the full screen.


If everything OK now, don't forget to close this thread, and open new ones as needed later.

Replies

WHere exactly has it been added ? For which API call ?


Probably added because the API is no more available on IOS 13.


Did you try : option - clean build folder ?

It's below the imports and before the class. I haven't tried a clean build. I'll do that now. It runs when I comment it out, not without issues, but it does run.



import UIKit

import MessageUI


@available(iOS 13.0, *)


class DetailsViewController: UIViewController, MFMailComposeViewControllerDelegate, UIPopoverPresentationControllerDelegate, UITextFieldDelegate{

Clean building the folder produced an issue (undeclard type - a coredata object) that seems to resolve itself after a normal build, but it doesn't solve the mystery of the added piece of code.

Have you checked all the delegate methods you call there ? To see if some is specific to iOS 13 ?


Did you see any changed API in your class ?


That could explain why @available is added.


Few other checks:

- what is your iOS target ? I suspect it is 12 or below.

- Have you set other targets as well ?

- Do you see any reference to Mac Catalyst 13.0+ ?

- what happens if you remove @available ?

- what happens is you comment ou the whole class (I guess projct would not build).

Thanks for those pointers, Claude. Although I have come a fair way in my learning, I still have a long way to go. I'm not exactly sure how to use target, it's just something that's been there and I've taken little notice of it until now, but you are right, it was set at 12.2. I changed it to 13 and it now builds and runs with or without the added piece of code.


I have one other issue. My viewcontrollers are not going all the way to the top of the screen anymore. A constraints issue maybe. I'll experiment and see what I find.


Cheers

Take care however. Setting the target to iOS 13 will prevent users to download on iOS12 devices or below. iOS 13 is not yet enough spread to afford this.


For the other issue:

My viewcontrollers are not going all the way to the top of the screen anymore. A constraints issue maybe. I'll experiment and see what I find.


No, it is not a constraint, it is a new default setting for VC.


- Go to IB

- Select your VC (select VC itself)

- Open attributes inspector

- You should see a field named Presentation

- Its content is likely Automatic

- Change to full screen


You will see that the VC displays changes and now covers the full screen.


If everything OK now, don't forget to close this thread, and open new ones as needed later.

Thanks, that's saved me from a lot of frustration in trying to track down the fullscreen problem. In regards to setting the target, my app is some way off being presented to the Apple Store for inspection, so it's not an issue at the moment, but I clearly need to have a closer look at setting the target so that I get a proper understanding.
Cheers

Richard