Ravi Kiran Ravi Kiran - 5 months ago 15
iOS Question

how to get app launch event in my custom framework

I am constructing a framework in objective c and I have to get notified when the application launches, Can I add observer to get track of app launch with in the framework? , I dont want application didBecome active notification since it will be called even after returning from background,

I want the fresh launch notification, please help me how do I acheive this

Answer

This will perform the block whenever your app is first launches.

[[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidFinishLaunchingNotification
                                                  object:nil
                                                   queue:nil
                                              usingBlock:^(NSNotification * _Nonnull note) {
                                                      // your code here
                                                  }];
Comments