• 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: Warning from Xcode build
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Warning from Xcode build


  • Subject: Re: Warning from Xcode build
  • From: Quincey Morris <email@hidden>
  • Date: Sun, 14 Aug 2016 21:31:17 -0700
  • Feedback-id: 167118m:167118agrif8a:167118s4Y5oYa_0x:SMTPCORP

On Aug 14, 2016, at 20:08 , Ben Kennedy <email@hidden> wrote:

Are you sure that's still the case? While I'm admittedly running 10.12 beta on this machine as I type, I've nonetheless launched Xcode 7.3.1 and created a test project using the 10.11 SDK.

In NSApplication.h, NSApp and the delegate property are declared as follows:

APPKIT_EXTERN __kindof NSApplication * __null_unspecified NSApp;
…
@property (nullable, assign) id<NSApplicationDelegate> delegate;

When I attempt to assign a delegate after deleting the implementing class's conformance to NSApplicationDelegate (such that it simply descends from NSObject), these two semantically-equivalent calls yield different errors messages:

NSApp.delegate = self;
// Assigning to 'id<NSApplicationDelegate> _Nullable' from incompatible tyoe 'AppDelegate *const __strong

[NSApp setDelegate:self];
// Sending 'AppDelegate *const __strong' to parameter of incompatible type 'id<NSFileManagerDelegate> _Nullable'

You’re correct, the SDK had been changed in 10.11, which I hadn’t noticed. However, in the second form, the receiver is (I would say) *clearly* exhibiting the old behavior**. This may or may not be by intention. In several places I found by searching the __kindof is described as being somewhat “like" ‘id’. For example, in the Xcode 7 release notes:

"Objects declared as __kindof types behave like a mix of id and a specific object type: They specify an upper bound (for example, must be UIView or a subclass thereof) but allow implicit downcasting to any subtype of that upper bound.”

I guess this should at least be reported as a bug.


** Indeed, it might be exhibiting the old behavior in the first case, too, with the fact that it chose a NSApplication method being a random accident.

 _______________________________________________
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

References: 
 >Warning from Xcode build (From: Dale Miller <email@hidden>)
 >Re: Warning from Xcode build (From: Quincey Morris <email@hidden>)
 >Re: Warning from Xcode build (From: Ben Kennedy <email@hidden>)

  • Prev by Date: Re: Warning from Xcode build
  • Next by Date: Re: Warning from Xcode Build
  • Previous by thread: Re: Warning from Xcode build
  • Next by thread: Re: Warning from Xcode build
  • Index(es):
    • Date
    • Thread