You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Krishna Mohan (JIRA)" <ji...@apache.org> on 2017/11/09 13:19:00 UTC

[jira] [Created] (CB-13557) Not able to set splashscreen image

Krishna Mohan created CB-13557:
----------------------------------

             Summary: Not able to set splashscreen image
                 Key: CB-13557
                 URL: https://issues.apache.org/jira/browse/CB-13557
             Project: Apache Cordova
          Issue Type: Bug
          Components: cordova-plugin-splashscreen
    Affects Versions: 4.0.0
         Environment: ios ; cordova-plugin-splashscreen-4.0.3; CDVSplashScreen.m
            Reporter: Krishna Mohan
            Priority: Blocker
             Fix For: 4.0.0


Please refer:
Defect: CB-9762 Launch Storyboard

Issue-1
getImageName function is checking for : isUsingCDVLaunchScreen. 
issue: it is checking for a string called 'CDVLaunchScreen'. What if i have a different storyboard name?
Fix: read "UILaunchStoryboardName" from plist. Don't* try to validate if the value is "CDVLaunchScreen".
{I can create any text file with name: CDVLaunchScreen & set it in UILaunchStoryboardName }

Issue-2
in getImageName fucntion, if "isUsingCDVLaunchScreen" is true, you are looking for a hardcoded "imageName"
fix: read it from another flag in plist 
Ex:
imageName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UILaunchStoryboardImage"];
if(!imageName) //if not set in plist
imageName = @"LaunchStoryboard"; //set the default

issue-3:
As a fix for: CB-9762 Launch Storyboard, all that is being done is: reading the name from xcassetts.
-->instead of fixing issue-1 & issue-2, set a flag "StoryboardImage" in plist, which is a image name.
-->read the value, get the imagename from plist vriable. if mistakenly set as path in plist, handle it
-->here u can read/check for default name in case as fallback

Suggestion:
If you want to make the system more robust, 
refer the below links.
//i am android developer, no knowledge about ios coding.
Basically, read the Storyboardname from plist, create an object from the string, then cast it to Storyboard Calss & then, try to get the id of resource(s) from storyboard.

https://stackoverflow.com/questions/1174093/create-objective-c-class-instance-by-name
id object = [[NSClassFromString(@"NameofClass") alloc] init];

https://stackoverflow.com/questions/2055940/how-do-i-test-which-class-an-object-is-in-objective-c
[yourObject isKindOfClass:[a class]]
Ex:
[myObject isKindOfClass:[NSString class]]
[myObject isKindOfClass:[UIImageView class]]

https://stackoverflow.com/questions/13708660/programmatically-get-a-storyboard-id
NSString *restorationId = self.restorationIdentifier;

https://stackoverflow.com/questions/13867565/what-is-a-storyboard-id-and-how-can-i-use-this
   MyCustomViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"MyViewController"];

EX: https://stackoverflow.com/questions/24035984/instantiate-and-present-a-viewcontroller-in-swift
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"myStoryboardName" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"myVCID"];
[self presentViewController:vc animated:YES completion:nil];



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org