2

I'm updating my app to support iOS 11 and I added the large titles options in the interface builder. Now I'm getting these "Attribute unavailable - prefers large titles before iOS 11.0" warnings.

I know I can set the options programmatically, but that's causing some other problems, so I was hoping I could keep it at the storyboard and just ignore the warnings. If the options aren't available that's fine, just don't use them. Is there a way to do that?

I know there are other questions asking the same thing, but they're pretty old and the answers end up working around it instead of really dealing with the warnings.

dbmrq
  • 1,451
  • 13
  • 32

2 Answers2

1

As the error states, your app is probably targeting iOS <11 so the attribute will not be used for earlier versions.

Have you tested your app in iOS 11 and 10 ?

Solutions:

  • Disable that feature
  • Set it in code using if #available (Best option if you want to maintain compatibility with earlier iOS versions and use that feature)
  • Set the target of your project to iOS 11
  • Suppress all warnings / Storyboard files only (Not recommended)
nathan
  • 9,329
  • 4
  • 37
  • 51
1

Since the OP does not state whether Swift or Objective-C is being used, I will post both versions.

  • Swift 2.0+: if #available(iOS 11, *) {}
  • Obj-C: if (@available(iOS 11, *)) {}

Courtesy of How to check iOS version?

As a side note I was able to suppress the specific warning with

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunguarded-availability"
... your code here ...
#pragma GCC diagnostic pop

Not recommending that - but as a quick fix it works.

Joe Steele
  • 563
  • 5
  • 13