• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using new stuff
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using new stuff


  • Subject: Re: Using new stuff
  • From: Aaron Tuller <email@hidden>
  • Date: Tue, 27 Jun 2017 13:32:38 -0700

Just a fun follow up to this, in Xcode 9, we finally (check the radar number!)
get proper support for this, in Objective-C! Cribbed from the release notes:

--
The new compiler flag -Wunguarded-availability warns for unguarded uses of
Objective-C APIs that were introduced in a system whose version is newer than
the deployment target version. A new Objective-C expression @available has been
introduced to perform system version checking at runtime. An if statement with
an @available condition can be used to guard uses of newer APIs:

       if (@available(macOS 10.13, iOS 11, *)) {
           // The compiler will not warn about uses of APIs from macOS 10.13
           // or iOS 11 here

}
C or C++ code can use the new __builtin_available builtin whose semantics are
equivalent

to @available.

The -Wunguarded-availability flag is off by default to prevent unexpected
warnings in existing projects. Its less strict sibling
-Wunguarded-availability-new is on by default, and warns about unguarded uses
of APIs only when they were introduced in or after macOS 10.13, iOS 11, tvOS 11
or watchOS 4. (7184689)
--

-aaron



> On Nov 21, 2016, at 10:02 AM, Jens Alfke <email@hidden> wrote:
>
>
>> On Nov 18, 2016, at 10:34 PM, Chris Hanson <email@hidden <mailto:email@hidden>>
>> wrote:
>>
>> You would only want a warning if you weren’t checking the system version
>> before calling the API. However, determining whether that check has indeed
>> occurred is actually quite difficult.
>
> DeployMate does this, using heuristics to check whether it looks like you’re
> attempting to conditionalize the use of the API. In my experience (about a
> year ago) it wasn’t perfect but worked most of the time.
>
> —Jens
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: How to Refactor/Rename a View Controller
  • Next by Date: Re: Documentation Viewer is Buggy (Game Kit)
  • Previous by thread: How to Add Game Centre to my App
  • Next by thread: How to silence documentation warnings?
  • Index(es):
    • Date
    • Thread