Templates Plugins Courses

New ios container version


#1

Hello. I ve downloaded the new version of zeroqode. On the last version i used some custom code to get the player id from onesignal. The code was in appdelegate and viewcontroller, On this version where i can add some custom code cause you dont have viewcontroller. Thanks


#2

Hi,

You can still use the ViewController. Create a new one like this:

class ViewController: SuperWebViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        guard let userID = OneSignal.getPermissionSubscriptionState()?.subscriptionStatus.userId else {
            print("No OneSignal User ID")
            return
        }
        print("OneSignal UserID: \(userID)")
    }
}

And in AppDelegate.swift file, didFinishLaunchingWithOptions method, bellow SuperView.configure call add this:

self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = ViewController()
self.window?.makeKeyAndVisible()