WLSplashview.m location in Xcode Project? - ios

I want to do add some animations with splash screen in IBM MobileFirst Worklight project for iOS. But I cant find "WLSplashview.m" in Xcode Project.
I checked with the IBM Worklight framework also but unable to find it.
Where can I find "WLSplashView.m" file in Xcode Project?

That is not where you manage the splash screen.
By default, iOS hybrid applications show a splash screen image during application initialization. This image is selected at run time from the launch images that are supplied in the application Xcode project.
The code that shows the splash screen is in the {AppName}.m class in the didFinishLaunchingWithOptions method. You can use the [[WL.sharedInstance] showSplashScreen] API to show the splash screen.
You must define a root view controller before you call this API. For example:
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary )launchOptions { ...
UIViewController rootViewController = ... [self.window
setRootViewController:rootViewController]; ... [[WL
sharedInstance] showSplashScreen]; ... }
That is where you then handle your custom splash. See more here:
http://www.ibm.com/support/knowledgecenter/SSHS8R_7.1.0/com.ibm.worklight.dev.doc/dev/c_splash_screen_ios.html
https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/7.1/advanced-client-side-development/common-ui-controls/#splashscreen

Related

"Application windows are expected to have a root view controller" message when adding view immediately after launch, iOS 9 only

My app sends a request at startup and displays a brief message to users when it succeeds, by means of MTStatusBarOverlay. Unfortunately, my current implementation seems to run afoul of iOS 9's view life cycle paradigms. I get the message
Application windows are expected to have a root view controller at the end of application launch
and the app crashes. The app works fine on iOS 7 & 8.
From searching around online, it seems like this might occur when trying to add the message view to the view hierarchy before the root view controller is established for the app's UIWindow, but that doesn't seem to be the case here, see below.
Here is an excerpt of the UIApplicationDelegate implementation:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[...]
self.window.rootViewController = [[MyViewController alloc] init];
[...]
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
[MyDataManager sendRequestWithCompletion:^{
// Displays a message with MTStatusBarOverlay
[self showSuccessOverlay];
}];
}
application:didFinishLaunchingWithOptions: is called before applicationDidBecomeActive: so it seems like there should never be an issue with rootViewController being established.
Why is this happening? What's different about iOS 9 that's causing the app to break?
MTStatusBarOverlay is a subclass of UIWindow, so instantiating one during app launch adds that UIWindow to the list that iOS checks for a populated rootViewController when launch completes.
I was able to work around the issue by instantiating and assigning a dummy controller before using the overlay, like so:
[MTStatusBarOverlay sharedInstance].rootViewController = [UIViewController new];
[[MTStatusBarOverlay sharedInstance] postMessage:#"Message"];

Setting time for the launchscreen.xib objective c iOS

I am trying to set time for the launchscreen.xib to make it last longer, for example 5 sec,since by default it disappears too quick i searched the web but found nothing useful, can it be done ?
Thanks
The apple documentation mentions this:
A launch file or image provides a simple placeholder image that iOS displays when your app starts up. The placeholder image gives users the impression that your app is fast and responsive because it appears instantly and is quickly replaced by the first screen of your app.
So essentially the launch screen cannot be made last longer because its only displayed when the app is starting up.
Still if you want you can
create a custom UIView with the launch image
make it the Initial View Controller by dropping the arrow in storyboard to your custom UIView
present your main View Controller on top of the launch image view after x seconds using dispatch_after
You can add this in your app delegate:
float delay =5.0;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
[NSThread sleepForTimeInterval:delay];
}
If you use a viewController, you can present it again in - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
making it the UIWindow's rootViewController, or presenting it modally from your application in the same method. This way, you can customize its dismissal. You can also add some animation to this viewController
So it may be another viewController than your launchScreen.

IOS Splash screen/popup display from closed library

We own proprietary library built for IOS, used by our customers in their application. Basically the library has no UI related functionality, but When they call our library init api, we want to add a splash screen or a popup(containing our company logo) to be displayed on top of their UI.
This splash screen might be called anytime, during or after the application launch time.
Also it is possible that proprietary library init API may not be called from main thread.
Would like to know if there is a reliable/feasible solution with some direction/examples?
Thanks,
Hari
Create UIImageView and add image and then
[self.window addSubview:uiimageview];
[self performSelector:#selector(dismissPopover) withObject:nil afterDelay:3];
and then remove the image
-(void)dismissPopover
{
[popover removeFromSuperview];
}
check this iPhone app: avoiding white screen after splash screen. Let splash screen linger, hide it after UIWebview loads? Splash screen not hiding properly

Splash screen with heavy codes in monotouch

We now that in monotouch and for iPhone / ipad application when we want to have splash screen before app lunch we should to set launch image in info.plist file and it will show this image before application launches.
But what is the best way to implement a splash screen when we want to have a splash that runs some heavy codes in background and not disappear until these operations had not completed? Some codes like downloading application config from internet and saving theme that often used in splash screen.
Possible solution:
Make a SplashViewController, which contains same image as app's splash image. Also it contains UIActivityIndicatorView;
In AppDelegate's FinishedLaunching method make new instance of SplashViewController, set it as window.RootViewController, call:
activityIndicator.StartAnimating();
Runs some heavy codes in background;
When it's done, set window.RootViewController to ViewController, which is app's starting point.
BTW, there is another solution: create main UIViewController, set it as Window.RootViewController immediately in AppDelegate's FinishedLaunching method. Then create and show modally splashViewController by this code:
...
MainViewController.PresentModalViewController(splashViewController, true);
...
Hiding modal UIViewController is possible via calling code:
DismissModalViewControllerAnimated(true);
Note that since iOS 6 PresentModalViewController becomes deprecated method. So, for many iOS versions compatibility you could code special method for showing modal UIViewController.
public void ShowModalViewController (UIViewController vc, bool animated)
{
if (UIDevice.CurrentDevice.CheckSystemVersion(6, 0)) {
MainViewController.PresentViewController(vc, animated, null);
} else {
MainViewController.PresentModalViewController(vc, animated);
}
}

Show splash screen at every launch

My app uses a splash screen as per client requirement. I need to display this splash screen at every launch when user presses the home button again. Pressing app I need to load app from beginning or else display splash at a specific time interval.
Please help me to solve this.
You can disable the Multitasking capability of the app and make it start from scratch each time you re-open the app from the home screen.
#implementation MyAppDelegate
- (void) applicationDidEnterBackground:(UIApplication *)application {
exit(0);
}
#end
OR See "Opting Out of Background Execution" in the iOS Application Programming Guide:
"...you can explicitly opt out of the
background execution model by adding
the UIApplicationExitsOnSuspend key to
your application’s Info.plist file and
setting its value to YES."

Resources