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
Lightweight generics were introduced in Xcode 7. Install Xcode 7 or change
- (NSArray<H24CommercialSlide * >*)allSlides;
to
- (NSArray*)allSlides;
Related
In one of my projects, one of the external modules (SDK) fails to compile with the following error :
Semantic issue
Typedef `MyEnumType` cannot be referenced with a enum specifier
But it works fine with my other projects.
Here`s the header file where the error comes from :
typedef NS_ENUM(NSUInteger, MyEnumType) {
value1,
value2,
value3,
};
#protocol MyProtocol <NSObject>
- (void)myFunction:(enum MyEnumType)type; // Compilation error shows here
#end
Since it works in other projects, I guess something is wrong in my project build settings ?
Any help would be appreciated, thanks
I have a linting error on my objC but I don't know how to resolve it, if I'm using the reinterpret_cast syntax, the app does not build anymore... Someone has an idea please?
error: NSString+EXT.h:9: Using C-style cast. Use reinterpret_cast(...) instead [readability/casting]
NSString+EXT.h
#ifndef ATOM_BROWSER_UI_COCOA_NSSTRING_ANSI_H_
#define ATOM_BROWSER_UI_COCOA_NSSTRING_ANSI_H_
#import <Foundation/Foundation.h>
#interface NSString(ANSI)
- (BOOL)containsANSICodes;
- (NSMutableAttributedString*)attributedStringParsingANSICodes;
#end
#endif // ATOM_BROWSER_UI_COCOA_NSSTRING_ANSI_H_
After multiple research and test, I fix the issue by following this thread
A macro like
#define REINTERPRET(type, expr) (*(type *)&(expr))
help me to refactorize and resolve the issue
Im having an issue with the auto-generated Project-Swift.h file when I try to import it.
In the -Swift.h file:
SWIFT_CLASS("_TtC7ProjectName20InviteToComposer")
#interface InviteToComposer : NSObject <MFMessageComposeViewControllerDelegate *>
- (nonnull instancetype)initWithRecipient:(NSArray<NSString *> * _Nonnull)recipient name:(NSString * _Nonnull)name OBJC_DESIGNATED_INITIALIZER;
- (void)messageComposeViewController:(MFMessageComposeViewController * _Nonnull)controller didFinishWithResult:(MessageComposeResult)result;
#end
when attempting to compile, i get two errors from this class:
"unknown type name 'MFMessageComposeViewControllerDelegate'; did you mean 'MFMessageComposeViewController'?
and "expected a type" in regards to "(MessageComposeResult)"
I tried including #nonobjc in front of the class and function names so that it wouldn't include them in the -Swift.h file, but apparently you can't do that to a class and the function itself that has the error gives me
"Type 'InviteToComposer' does not conform to protocol 'MFMessageComposeViewControllerDelegate'" then states "protocol is not #objc but requires it."
In your -swift add #protocol MFMessageComposeViewControllerDelegate before your class declaration.
It's an apple "you probably should be using swift/we don't care enough about you to fix it" thing.
Also thing with my fix is that every time you clean the project or switch a build device, it will clear up the code and you have to add it again.
A permeant workaround is create a sub protocol of the MFMessageComposeViewControllerDelegate in objective-c and reference it from there.
I'm stumped by this error.
XCTAssertNotNil autocompleted alright and the code seems trivial.
"Parse issue" seems so strange, and there are 3 of them.
I've tried showing invisibles to find any weird spaces and stuff, but could find nothing.
I'm using Specta/Xpecta/OCMock on my other tests. Using Cocoapods
#import <XCTest/XCTest.h>
#interface SPRecipientDataViewModelTests : XCTestCase
#end
#implementation SPRecipientDataViewModelTests
- (void)testHelloNotNil {
XCTAssertNotNil(#"hello", #"hello is nil");
}
Looks like the problem here was Specta. It looks like I was using an old version of it. Updating to the latest Specta fixed this problem. Looks like there was some conflict with XCTest
I'm using Cocos2D for the first time and trying to set up my initial scene. I just followed this tutorial http://www.raywenderlich.com/15267/how-to-make-a-platform-game-like-super-mario-brothers-part-2 and got it working perfectly. I even copied the code for the GameLayer over to use as a template for my Level0, changing the appropriate value to fit.
I'm getting an error in my private interface `Expected identifier of '(' before '{' token
#import "Level0.h"
#import "Player.h"
#interface Level0 ()
{ /// this is where I'm getting the error
CCTMXTiledMap* map;
Player* player;
CCTMXLayer* walls;
CCTMXLayer* portalWalls;
BOOL gameOver;
}
#end
#implementation Level0
....
I've coded private interfaces a million times and it even looks identical to the tutorial project. Does anyone know of reasons why this would flag an error?
The bad syntax is actually in one of those header files. You may be able to track it down by compiling the troublesome header itself rather than just including it. Comment out the #includes, then in Xcode's file inspector change the "File Type" from "Default - C header" to "Objective-C" source:
and add it to your target as a member:
Then compile. You might get some linker errors too, but you should also get this same "Expected identifier" error, now pointing somewhere near the actual site of the problem.
Don't forget to switch those settings back afterwards.