Z
Z
Zaur Abdulgalimov2015-03-18 13:37:32
Objective-C
Zaur Abdulgalimov, 2015-03-18 13:37:32

Why does code in iOS only work in the didFinishLaunchingWithOptions method?

I'm using the StartApp SDK in an iOS app to display ads. Downloaded the official sample iOS app here https://github.com/StartApp-SDK/StartApp-InApp-iOS... . In the example, in the STAAppDelegate class, in the didFinishLaunchingWithOptions method, there is code for displaying ads:

STAStartAppSDK* sdk = [STAStartAppSDK sharedInstance];
[sdk SDKInitialize:@"103738633" andAppID:@"203184123"];
[sdk showSplashAd];

Everything works, but if this code is inserted in another place, for example, a button click handler, then the ad is not displayed.
Question: what are the special properties of the didFinishLaunchingWithOptions method that the above code only works in it? And what can be done to make this code work in the button click handler?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
feniksqip, 2015-03-28
@feniksqip

Because the iOS application has all the delegates here! And the late finish is the beginning of the life cycle of the application, it is launched by the main!

A
Alibek Issakul, 2018-01-25
@rusgayfer

Try
preg_match("#{$d['keywords']}#i", $text)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question