3
Vote

Windows Phone 8.1 Extended Splash Screen Invalid Pointer

description

I implemented a extended splash screen, like this https://msdn.microsoft.com/en-us/library/windows/apps/dn535963.aspx, but I'm getting a NullReferenceException: Invalid pointer.

I didn't find any example specific for windows phone 8.1 nor a solution for the error.

Thanks.

file attachments

comments

Blackbox wrote Jun 24, 2015 at 3:48 PM

We are getting the error also. We can fix it by not setting the content of the rootframe.

Instead we do this:
ExtendedSplash extendedSplash = new ExtendedSplash(args.SplashScreen, loadState);
Window.Current.Content = extendedSplash;

and afterwards create the rootframe when splashscreen is done doing ist work.

This is the way it is described here:
https://msdn.microsoft.com/en-us/library/windows/apps/hh465338.aspx

I now that MSDN also gives the samplecode like it is implemented right now.... but this does not work on phone. So a solution for that without changing the prism code could be to override the

protected override async void OnLaunched(LaunchActivatedEventArgs args) method an do the init like this:

Warning... Untested Code

protected override async void OnLaunched(LaunchActivatedEventArgs args)
    {

            if (ExtendedSplashScreenFactory != null && (!_isRestoringFromTermination || (args != null && args.TileId != tileId)))
        {

            {
                Page extendedSplashScreen = this.ExtendedSplashScreenFactory.Invoke(args.SplashScreen);
               Window.Current.Content = extendedSplashScreen ; 
               Window.Current.Activate();
               ExtendedSplashScreenFactory  = null;
               await OnLaunchApplication(args);
         }
        else
        {
             base.OnLaunched(args);
        }
 }
But the you have to make sure in OnLaunchApplication to call InitializeFrameAsync befor navigating the root frame