开发者

Blank simulator screen due to file name or name change or neither?

开发者 https://www.devze.com 2022-12-20 17:33 出处:网络
i have a problem, clearly. when i started the project i had stupidly named my [AppName]ViewController just [AppName]Controller.

i have a problem, clearly.

when i started the project i had stupidly named my [AppName]ViewController just [AppName]Controller. As i went along i could never get iphone simulator to display more than a blank white screen. upon having made all the connections in interface builder and still facing the same problem, i decided my blank screen may have something to do with a controller vs. viewcontroller just not being recognized. so i changed the name of all controller files (and occurrences in the code) to viewcontroller (or [appnameviewcontroller]). despite som开发者_如何转开发e prior research i messed up: the project finder in xcode still comes up with one search result for [appname]controller; namely somehow within my main view nib file (which, btw, is only named [AppName].xib). said finder is unable to replace this last occurrence with the new name.

now i have 2 problems, or one in 2 parts: -still only get a blank screen in iphone simulator -all connections in interface builder are broken (and i was gonna delete and rebuild those, except once i delete the connections there isn't a set of new ones to connect, since it's looking for [AppName]Controller, the old name.

i should note that when run from interface builder the iphone simulator works just great.

what to do? was the "view" part missing from my filenames the original problem, or was the blank screen just a fluke that led me to "destroy" my project? should i just go in and rename all files and occurrences to what they used to be?

thanks in advance to anyone who may have an answer :)


I'm pretty certain that the issues were not to do with the naming of your files. I'd put them back.

However, as you asked I have successfully renamed files (and in fact entire projects) following these instructions :

1.  Copy/rename the folder into new name
2.  Get inside the new folder and rename the .pch and .xcodeproj files
3.  Delete the build folder
4.  Open .xcodeproj file in text editor, like TextMate or TextWrangler. That’s actually a folder, which contains 4 files (you can also right-click and do Show package contents, which will reveal the files)
5.  Open project.pbxproj in text editor and replace all instances of the old name with the new name
6.  Load the project file in XCode, do Build/Clean all targets

I also needed to fix up the XIB file by making changes within it directly using a text editor.

Final bit of advice... If all else fails, cut and paste your classes into a new project, and re-make the XIBs

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号