Hello, when trying to compile my XCode project, I receive an error stating "Expected identifier or ‘(’ ".
This error occurs in the AppDelegateListener.h file, which is a Unity supplied file. This error occurs for each of the following lines…
extern "C" __attribute__((visibility ("default"))) NSString* const kUnityDidRegisterForRemoteNotificationsWithDeviceToken;
extern "C" __attribute__((visibility ("default"))) NSString* const kUnityDidFailToRegisterForRemoteNotificationsWithError;
extern "C" __attribute__((visibility ("default"))) NSString* const kUnityDidReceiveRemoteNotification;
extern "C" __attribute__((visibility ("default"))) NSString* const kUnityDidReceiveLocalNotification;
extern "C" __attribute__((visibility ("default"))) NSString* const kUnityOnOpenURL;
What’s stranger is that an empty Unity project with an identical AppDelegateListener.h file compiles without issue.
Possibly worth noting, I’m using CocoaPods, specifically the Google-Mobile-Ads-SDK pod. This means that instead of opening the actual XCode project, I open a workspace created by CocoaPods.
As far as I can tell, my real project and the empty project that compiles are configured the same in XCode. Therefore, I’m at a loss why the error is occurring.
I’m using Unity 5.3.6f1 and XCode 8.0
Thanks in advance for any help you can provide.
Edit: Here’s the entire contents of AppDelegateListener.h as the specific error often relates to earlier code (tho I don’t think that’s the issue in this case)…
#pragma once
#include "LifeCycleListener.h"
@protocol AppDelegateListener<LifeCycleListener>
@optional
// these do not have apple defined notifications, so we use our own notifications
// notification will be posted from
// - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
// notification user data is deviceToken
- (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSNotification*)notification;
// notification will be posted from
// - (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
// notification user data is error
- (void)didFailToRegisterForRemoteNotificationsWithError:(NSNotification*)notification;
// notification will be posted from
// - (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary*)userInfo
// notification user data is userInfo
- (void)didReceiveRemoteNotification:(NSNotification*)notification;
// notification will be posted from
// - (void)application:(UIApplication*)application didReceiveLocalNotification:(UILocalNotification*)notification
// notification user data is notification
- (void)didReceiveLocalNotification:(NSNotification*)notification;
// notification will be posted from
// - (BOOL)application:(UIApplication*)application openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation
// notification user data is the NSDictionary containing all the params
- (void)onOpenURL:(NSNotification*)notification;
// these are just hooks to existing notifications
- (void)applicationDidReceiveMemoryWarning:(NSNotification*)notification;
- (void)applicationSignificantTimeChange:(NSNotification*)notification;
- (void)applicationWillChangeStatusBarFrame:(NSNotification*)notification;
- (void)applicationWillChangeStatusBarOrientation:(NSNotification*)notification;
@end
void UnityRegisterAppDelegateListener(id<AppDelegateListener> obj);
void UnityUnregisterAppDelegateListener(id<AppDelegateListener> obj);
extern "C" __attribute__((visibility ("default"))) NSString* const kUnityDidRegisterForRemoteNotificationsWithDeviceToken;
extern "C" __attribute__((visibility ("default"))) NSString* const kUnityDidFailToRegisterForRemoteNotificationsWithError;
extern "C" __attribute__((visibility ("default"))) NSString* const kUnityDidReceiveRemoteNotification;
extern "C" __attribute__((visibility ("default"))) NSString* const kUnityDidReceiveLocalNotification;
extern "C" __attribute__((visibility ("default"))) NSString* const kUnityOnOpenURL;