0

Having just upgraded to Xcode 12/iOS 14, the Intents framework is trying to compile code like this in various headers:

@interface INObjectSection<ObjectType> : NSObject <NSCopying, NSSecureCoding>

But the compiler seems to have no idea that ObjectType is the generic placeholder:

No type or protocol named 'ObjectType'

Nobody else is complaining about this, so I'm guessing I have some setting in this very old project that is preventing Objective-C generics from compiling, but I can't find anything.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Nestor
  • 2,753
  • 2
  • 29
  • 34
  • No idea and not using 12 yet, but try inserting ```@class ObjectType;``` before the interface maybe and see what happens. – skaak Jul 01 '20 at 16:27
  • FWIW not able to generate this on 11.5 even when toying with the few generics settings available. On 11.5 it just works. – skaak Jul 01 '20 at 16:44

1 Answers1

1

For some reason the #import syntax no longer works. I replaced

#import <Intents/Intents.h>

with

@import Intents;

and now it compiles.

Nestor
  • 2,753
  • 2
  • 29
  • 34
  • How does this relate to the question? – matt Jul 02 '20 at 12:33
  • The code that won't compile is imported from the Intents framework (it does say in the question I think). – Nestor Jul 02 '20 at 12:56
  • But why would using a different import syntax change the compiler’s understanding of the meaning of the imported header code? My point is, this is interesting but so far it’s just replacing one mystery with another. – matt Jul 02 '20 at 13:00
  • Ha, well that depends on whether you're just trying to get something to compile on a deadline :) Perhaps the @import syntax is accessing a compiled (by Swift?) version of the Intents framework and thus not hitting whatever the problem is with the sticking plaster that is Obj C lightweight generics. But haven't looked into it. – Nestor Jul 02 '20 at 13:07
  • Ok but this is not a blog about our personal adventures. It’s an encyclopedia of explanations. The answer needs to be an answer. That’s my whole point. – matt Jul 02 '20 at 13:12
  • That's ridiculous. The question is "how do I get this to compile on iOS 14?". For the benefit of other people who are going to hit the same problem. You do realise the Intents framework is part of iOS? – Nestor Jul 02 '20 at 13:17
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/217088/discussion-between-nestor-and-matt). – Nestor Jul 02 '20 at 13:38
  • 1
    Ah ok - so maybe ```-fmodules``` or related caused the trouble, uhhh, the trouble with not compiling (and generics per se is not the trouble ... I think) – skaak Jul 02 '20 at 15:29