iOS: storyboard for the launch screen

projucer
#1

Hi all,

Is there anyone who uses storyboard for their iOS app’s launch screen? Every time when I save my project in the Projucer, it messes up the storyboard’s fileRef number in /project.pbxproj so the launch screen cannot be shown. Then I have to manually change those fileRef numbers in /project.pbxproj to make the launch screen work.

In the exporter configuration page of Projucer, I have included the storyboard in “Custom Xcode Resource folders”, and added it in the “Custom Plist” as

<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>

Have anyone ever worked it out? Thanks.

0 Likes

#2

Search for a post by me from a few days ago, I explained what to do

0 Likes

#3

Thanks for your reply. I believe you meant this post right?

I think I did the same thing as you said. Or do you mean instead of adding LaunchScreen.storyboard in “Custom Xcode Resource folders” under iOS exporter configuration, I should add it under File explorer->Resources ?

0 Likes

#4

add it the same place you add your source code files (add existing file) and set it to be an xcode resource (uncheck compile, uncheck binary resourse)

25%20PM

1 Like

#5

Thank you very much!

0 Likes

#6

Hi, I’d like to ask one more thing. This solution solves my issue for my iOS app. However, now I’ve been needing to delete that storyboard from the Xcode project before building the macOS app.

Do you or does anyone know if there’s any way to conditionally exclude this storyboard from macOS in the ProJucer? Thanks again for your help!

0 Likes

#7

If you rebuild the Projucer from the tip of the develop branch, you can now specify a custom launch storyboard via the iOS exporter (see here).

As for excluding it from the macOS build, you can add the storyboard file to a folder in your project structure and then add this to the “Custom Xcode Resource Folders” field in the iOS exporter.

0 Likes

#8

Thank you for your reply.

That was what I did in the very beginning, if you look at my first post. Haven’t you run into any issue like mine?

0 Likes

#9

Apologies for not reading the OP fully, I just saw the latest post and thought the new additions might be of use. I’m not seeing this problem if I use the latest Projucer though - I’ve added a MyStoryboard.storyboard file to a test project like so:

and set the iOS exporter settings like this:

and it’s working as expected when I save and open in Xcode. Can you clarify what issues you’re having?

1 Like

#10

Hi Ed, thanks for your reply.

I pulled the latest commit from the dev branch and built the Projucer. I did what you suggested:

And after “save & open in IDE” I did see my storyboard under resources in Xcode:
37%20PM

But the launch screen didn’t show up. It behaved exactly the same as what I described in my first post (what I did then was adding MyStoryboard.storyboard to the “Custom Xcode Resource Folders” field in the iOS exporter).

To make the storyboard work right, I need to add that storyboard manually in Xcode. But the problem is that every time when I save in the Producer, it got messed up.

@matkatmusic 's solution works for me but the only small issue is that I’ve been needing to delete the storyboard when I build the macOS app. Hope that clarifies it.

0 Likes

#11

What does the Xcode storyboard setting field display in the project settings? Does it show the name of the storyboard that you specified in the Projucer?

0 Likes

#12

Yes. As what I specified in the custom Plist in the iOS exporter.

0 Likes

#13

So the “Launch Screen File” setting in Xcode is displaying the custom storyboard that you specified in the Projucer and the .storyboard file shows up in the “Resources” folder, but it’s not displaying when you start the app? Can you try completely removing the Builds folder of your project and re-saving?

0 Likes

#14

Yes. Every time before making and running a build I cleared the Builds folder to make sure my change was applied.

0 Likes

#15

Ah, I see what’s happening now. The folders specified in “Custom Xcode Resource Folders” are added to the project as folder references so the target membership is set for the whole folder and not the individual files within the folder, which is why the file isn’t being picked up by Xcode.

Unfortunately I can’t see a simple way to work around this so for the time being it looks like you’ll need to add the .storyboard file as an “Xcode Resource” in the Projucer and then delete the file from macOS builds as you were doing before. I’ll try to come up with a nicer solution…

0 Likes

#16

That makes sense. Cause I used to add my storyboard in “Custom Xcode Resource Folders” and applied a patch I created which changes the storyboard’s fileRef number in /project.pbxproj to make launch screen display correctly, until @matkatmusic gave his solution.

Thank you very much for your help! Hope there will be a nicer solution.

0 Likes

#17

In a similar vein/to support this thread, I have the LaunchScreen.storyboard added as an Xcode resource in ProJucer. The same name applied in the iOS exporter for Custom Launch Storyboard.

This works fine for iOS work. When I want to switch over to MacOS testing I get the understandable error iOS storyboards do not support target device type “Mac”. Which makes sense. What I then do is go to the Inspector for the LaunchScreen.storyboard and uncheck Target Membership for the App that I’m building. This works fine but seems like a silly step.

So I wonder if it’s possible to define resources in the exporter sections (perhaps as a list of names per Custom Launch Storyboard) that you now want excluded from target membership, or just excluded from the Xcode project altogether. Either works for me.

Does this seem like a fair ask? Is it already being worked on?

This experience was had on ProJucer 5.4.3 and the Dev branch.

Cheers, Jeff

0 Likes

#18

I think it would probably be easier/faster to just have separate jucer files for desktop and ios, assuming the project wasn’t too complex.

0 Likes

#19

Doesn’t that somewhat defeat the purpose of the switchable Selected Exporter from the Projucer UI? I quite like that feature - seems like it should work, no?

1 Like

#20

Well, when Apple switched from xcassets to storyboards, the iOS side of the ProJucer didn’t really keep up… They’re busy with SOUL, anyway…

Just separate out your iOS specific files from your OS X/Windows specific files from your common files, and make separate Jucer projects for the time being. it’s the simplest thing to do for the time being.

0 Likes