when I share something with my app, it get called by
-(BOOL) application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{
to get the content shared with it. After that, i need to present Modally a content in the first controller of the app, but if call from the appDelegate
the function [self.library showContent:item];
where's library is the main controller on the app, it doesn't called the class method like viewDidLoad
or viewDidAppear
of the main controller but only the applicationDidBecomeActive
from appDelegate
, and i can't run apresentModalViewController
from the showContent
method, because it's view isn't on screen yet.
short version: why when app comes from applicationDidBecomeActive
it doesn't call first controller's class method like viewDidAppear
? How con i call in the main controller a presentModalViewController
if I didn't know when the main controller is on screen?
I think that U r mixing up the UIViewController
Lifecycle and application lifecycle, this two are different.
Brief tip: take your code from ViewDidAppear
out to external method and try to invoke this method somewhere from applicationDidBecomeActive
.
For application lifecycle, see this link.
For UIViewController
lifecycle see this link.
Hope that could help.