简体   繁体   中英

How to remove unused storyboard from iOS app?

How do I remove a storyboard from an iOS app?

I had an older app that I added a new universal storyboard and want to remove the old iPhone- and iPad-specific storyboards.

I tried just deleting them and the app will not compile after a clean and rebuild. I get an error that the iPhone storyboard cannot be found.

I did a search for the iPhone storyboard but do not see any references.

I had to revert my code back to having the unwanted storyboards.

Could a link from the old storyboard to a ViewController class be causing this?

Here's my current storyboards showing the new launch and universal and the 2 old ones. 当前故事板显示 2 个不需要的旧故事板

I checked my targets and they don't reference the old storyboards any more.

在此处输入图片说明

在此处输入图片说明

Per Reinier's comments I have done this and still get a build error if I delete the old storyboard files from disk.

在此处输入图片说明

So, I finally figured out the problem and am answering my own question for anyone else stuck in this situation.

I knew there had to be some reference to the storyboards somewhere I was not seeing the my normal all files search in Xcode.

I was right. The issue was the .pbxproj file which is within the .xcodeproj bundle.

I stumbled across this file while doing a GIT checkin comparison to see if there was some reference I was not finding by searching within Xcode. Xcode does not appear to search within this file.

The .pbxproj file had several references to the old, unwanted storyboards like this:

D7DB80AD191BEAC900114581 /* MainStoryboard_iPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D7DB8057191BEAC900114581 /* MainStoryboard_iPad.storyboard */; };
D7DB80AE191BEAC900114581 /* MainStoryboard_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D7DB8059191BEAC900114581 /* MainStoryboard_iPhone.storyboard */; };

They were all over the place in this file.

I just went in and deleted all references to them.

I can clean and build the project without issue now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM