Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-13557

Not able to set splashscreen image

    XMLWordPrintableJSON

    Details

    • Flags:
      Patch, Important

      Description

      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];

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              krishnamohan_519 Krishna Mohan
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 9h
                9h
                Remaining:
                Remaining Estimate - 9h
                9h
                Logged:
                Time Spent - Not Specified
                Not Specified