Search code examples
objective-cxcodexcode6nsarraynsarraycontroller

Getting a fail build because of an NSArray line error


When trying to build my xcode project, I get an error at this line:

- (NSArray<H24CommercialSlide * >*)allSlides;

Giving me a Parse issue: Expected '>' & Expected ')'

Not sure how to resolve this issue and what has changed in xcode that makes this previously working code fail.

Any ideas?

Full code snippet:

#import <Foundation/Foundation.h>

@class H24CommercialSlide;

@protocol H24SlidesProviderProtocol <NSObject>
- (NSArray<H24CommercialSlide * >*)allSlides;
@end

@interface H24SlidesProvider : NSObject<H24SlidesProviderProtocol>

@end

Solution

  • Lightweight generics were introduced in Xcode 7. Install Xcode 7 or change

    - (NSArray<H24CommercialSlide * >*)allSlides;
    

    to

    - (NSArray*)allSlides;