Mansa
Mansa

Reputation: 2325

Changing parameters for Pushwoosh in iOS or Unity

I am trying to alter the PushNotificationManager.h to change some settings, like I don't want pushes to be received when app is in foreground.

Here is what I have tries:

- (void) registerForPushNotifications;
[PushNotificationsManager sharedManager].showPushnotificationAlert = NO; 

This creates this alert:

*Expected identifier or ”(“*

Then I tried this:

- (void) registerForPushNotifications(){
    [PushNotificationsManager sharedManager].showPushnotificationAlert = NO;
}

This creates this alert:

*Expected ";" after method prototype*

Then this:

- (void) registerForPushNotifications([PushNotificationsManager sharedManager].showPushnotificationAlert = NO);

Also this throws the same error. What am I doing wrong.

Hoping for help in this matter. I am novice in the XCode part. I build everything from the Unity.

Upvotes: 0

Views: 146

Answers (2)

shader
shader

Reputation: 2121

I see you are referring to this file:
https://github.com/Pushwoosh/pushwoosh-sdk-samples/blob/master/Unity/iOS/Plugins/iOS/UnityRuntime.m

This is how you should modify the file:

void registerForRemoteNotifications() {
    [PushNotificationManager pushManager].showPushnotificationAlert = NO;
    [[PushNotificationManager pushManager] registerForPushNotifications];
}

Do not change PushNotificationManager.h file! Hope this helps!

Upvotes: 2

CodeSmile
CodeSmile

Reputation: 64477

The semicolon at the end needs to go (it's the method implementation, not its @interface declaration where the semicolon would be necessary):

- (void) registerForPushNotifications;

So it becomes this:

- (void) registerForPushNotifications {
    [PushNotificationsManager sharedManager].showPushnotificationAlert = NO;
}

Needless to say, this isn't legal Objective-C either, it's a mash of Objective-C and C syntax:

- (void) registerForPushNotifications(){

Upvotes: 0

Related Questions