Send tag to OneSignal after log in

You need to use the same oneSignal instance from AppDelegate in your LogInViewController. You can make oneSignal static at the class level so it can be shared between both classes.

To delete a tag you can call oneSignal.deleteTag("username")

Update: As of the iOS 2.0 SDK all methods on the OneSignal class are now static.


Objective-C:

// Send tag: After login 
[OneSignal sendTag:@"key" value:@"value"];      

// Delete tag: After logout
[OneSignal deleteTag:@"key"];

Swift:

// Send tag: After login
OneSignal.sendTag("key", value: "value") // for sending that is inserting tag in OneSignal

// Delete tag: After logout
OneSignal.deleteTag("key")  // delete that specific tag from OneSignal db