aptabase-swift icon indicating copy to clipboard operation
aptabase-swift copied to clipboard

Example for UIKit

Open bircni opened this issue 2 years ago • 3 comments

I suggest adding an example how to use it in UIKit - I did it like this: In the main class I initialize aptabase and it just works:

    override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
        Aptabase.shared.initialize(appKey: "")
    }
    
    required init?(coder: NSCoder) {
        super.init(coder: coder)
         Aptabase.shared.initialize(appKey: "")
    }

bircni avatar Jun 03 '23 10:06 bircni

That's a good suggestion, I'm not too familiar with UIKit, so I need to experiment a bit.

In your example you have called initialize twice. Is that really needed? Have you tried initialising it on AppDelegate?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        Aptabase.shared.initialize(appKey: "")
        return true
    }

goenning avatar Jun 03 '23 21:06 goenning

no but this should work i guess

bircni avatar Jun 03 '23 21:06 bircni

it depends on how init is called...

bircni avatar Aug 27 '23 18:08 bircni