• 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: Ben Kennedy <email@hidden>
  • Date: Sun, 14 Aug 2016 20:08:41 -0700

On 13 Aug 2016, at 2:52 pm, Quincey Morris <email@hidden> wrote:

> Historically, as in 20 years ago, many things were typed ‘id’ that would now have a specific type. Not sure why, but global variable NSApp is one of them.

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'


However, both are resolved by declaring the app delegate to conform to NSApplicationDelegate (as is does in the default project template).

Thus a question for Dale: does your delegate declare conformance to the protocol?

b


 _______________________________________________
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


  • Follow-Ups:
    • Re: Warning from Xcode build
      • From: Quincey Morris <email@hidden>
References: 
 >Warning from Xcode build (From: Dale Miller <email@hidden>)
 >Re: Warning from Xcode build (From: Quincey Morris <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