iPhone app opens to black screen after refactor proj name in xCode 4 - iphone

Guys, i wonder if any one can help - My project was fully working in both the simulator and on a device, however, i renamed the project in xcode 4 (double clicking at the root of the project navigation pane, it was happy to rename any references - but now when i launch the app it only opens to the main window (yes it has outlets, all have outlets etc etc),
no code in the app delegate stops at a break point (even in didFinishLaunchingWithOptions)
so unsure what i could have missed, i have looked at other answers and everyone writes and says "missing outlet" etc.
I have dragged some backed up version of the app delegate that used to work and no difference, what could i be missing.
I do have source control, however currently in the process of merging from VSS to GIT.
thanks
lee

Check your Info.plist for what it uses as it's Main Nib File. Perhaps something changed there? Also, within the nib file itself you might have problematic connections to classes that are still named with the old name.

Related

I lost some of my work while refactoring a storyboard on XCode? What can I do?

I have read the First Book from appcoda "Beginning programming with Swift"
One feature that I learned in said book and that I really liked while working with storyboards is the ability to refactor some storyboards when the amount of storyboards becomes too large, so at first I was doing it successfully, no problem whatsoever.
I began dividing my storyboards into smaller chunks like so
OH THE HORROR
then this happened
As soon as I pressed "refactor to storyboards" it didn't prompt me for a name as it did before but instead it renamed the new storyboard reference to "Main copy.storyboard"
Can I recover the storyboard that I lost?
When that happened, the old storyboard dissapeared and an exact copy of the main.storyboard appeared
CTROL-Z Did not work as I tried that immediately and I haven't versioned for the past 2 days or so (I know, that was really stupid)
If I can not recover the storyboard, can someone tell me why did this happen? I don't want to do this again
Btw, I am running the last version of XCode 7.2.1
Xcode may have put the lost storyboard in the Trash. Use the Finder to check. The Trash is the wastebasket-looking thing at the right or bottom end of the Dock.
If the lost file is in the Trash, you may be able to right-click it and choose “Put Back” to send it back into your project folder. You may also need to add it back to your project in Xcode using File > Add Files to “MyProject”.
I got in to the same problem. If you accidentally replaced the original storyboard with new one while refactoring, you can find the old one in project folder with a name ending with "~" symbol.
Hope you can restore it from there.

Xcode 7 beta (5 & 6) cannot see IBOutlets of some VCs

Sometime in the past week or two, the Storyboard editor in Xcode 7 beta (then beta 5, now also still in beta 6) stopped recognizing the IBOutlets in some (not all) of my UIViewController subclasses. (NOTE: my app is a pure Swift 2, iOS 9-targeting project.)
Specifically, it cannot "see" the IBOutlets in VCs whose source files reside within my project's (app-specific) main folder, but it can see them in (generic, non-app-specific) VCs that I keep in an "Externals" folder. What's more, if I move those app-specific VCs out of the main folder, the Storyboard editor sees their IBOutlets just fine:
<Project Folder>
IIAM.xcodeproj <-- Project
Externals <-- Where I keep non-app-specific code and resources
Classes
Views <-- The Storyboard Editor sees the IBOutlets of all these files just fine
IIAM <-- All app-specific code and resources
Classes
Views <-- The Storyboard Editor doesn't recognize any IBOutlets of these files
But if I move the affected Views out of the IIAM folder:
<Project Folder>
IIAM.xcodeproj <-- Project
Externals <-- Where I keep non-app-specific code and resources
Classes
Views <-- The Storyboard Editor sees the IBOutlets of all these files just fine
IIAM <-- All app-specific code and resources
Classes
Views <-- The Storyboard Editor _does_ recognize IBOutlets these files when moved out here!
In the Storyboard Editor , the "module" property for all the classes that aren't recognized is empty (note: it doesn't have the default, greyed-out "Current - IIAM", it just has greyed-out "None" ) — and even if I set the module name to that of my project, the IBOutlets still aren't recognized. Meanwhile, the modules of the VCs under "Externals" do have the greyed-out "Current - IIAM".
So, it seems evident that the underlying problem is that the Storyboard Editor (and possibly Xcode generally) doesn't recognize my app-specific VCs as beloing to the app's module when they are stored under my app-specific "IIAM" folder (which, BTW, is where the AppDelegate and nearly all classes and resources are also located), but does when they are moved out of that folder.
I checked my target's build settings to confirm that all my VCs (external and app-specific) are specified. I've even gone so far as to examine the XML of my storyboard file, to see if I could spot any difference in how the VCs are specified and identified therein, and I did notice one thing: those VCs whose IBOutlets are recognized all have the attributes:
customModule="IIAM" customModuleProvider="target"
while (at least most of) those whose IBOutlets aren't recognized lacked the customModuleProvider="target" attribute. But even after I edited the storyboard file to set that attribute for all my VCs, the Storyboard Editor stil doesn't recognize them as belonging to my app's module, or recgonzie their IBOutlets. I've tried cleaning, rebuilding, nuking all Xcode preferences and derived data, reinstalling Xcode, and yet nothing makes any difference except moving my VCs to the top level of the project directory.
(Note that my app still executes fine, if I manually add (or replace) IBOutlets in my source by control-dragging from the storyboard; BUT even when I do that, all such IBOutlets show up as unrecognized by the Storyboard Editor, with the little yellow warning icons. And of course I have to manually add all IBOutlets this way, even those for such things as the view — which I then have to immediately delete from the VC source because of course it conflicts with the inherited view property, but this does at least make a yellow-warning IBOutlet show up, and lets the app then run)
So, I'm at a complete loss. Has anyone else encountered this behavior? Does anyone have any idea how I might be able to fix the problem?
Help! And thanks!
Carl
OK, I don't know if this is really an "answer", but I was at least able to correct the issue. I was seeing the issue reported above on my laptop, which is my primary development machine, but I was also synching my project files to my desktop Mac. This morning I updated my desktop Mac to the latest Xcode beta and launched my project from there; and as I hoped, on that Mac, the Storyboard Editor "sees" my VCs and their IBOutlets just fine. Even better, after synching the files again with my laptop, everything behaves fine now on my laptop, too. So, the problem has been resolved, though I don't really have an explanation for what happened or a sure procedure to follow if it happens again.

Why is my XIB modified every time I open it in IB?

I click on the XIB via the project navigator. It opens up and immediately changes the icon to gray showing I have unsaved changes. If I save changes, click on a different file and click back to re-open it, more changes. Always modifies on open.
It happens with one XIB file in this project and a couple in another project. I'd love to know why it's happening and what I can do to fix it now and prevent it in the future.
Note: using Xcode 3.2 Build 4C199 with Snow Leopard
Edit: I've added a couple sections which got removed from the XML on one of these open/modifications
<key>outlets</key>
<dict>
<key>addEventTabBarController</key>
<string>UITabBarController</string>
<key>window</key>
<string>UIWindow</string>
</dict>
<key>superclass</key>
<string>NSObject</string>
and
<key>outlets</key>
<dict>
<key>courseTableCell</key>
<string>UITableViewCell</string>
</dict>
<key>superclass</key>
<string>UITableViewController</string>
I wound up submitting this issue to Apple. Their response was unenlightening, and talking about possible optimizations, updating meta data for new version of Xcode and the like.
I tracked 100 versions from clicking off and on the file. As Apple said, it was "optimizing" every time, but each time it simply moved some XML tags around. Never happy with it's own optimizations it moved them around the next time they were opened. I'd consider it a bug with Xcode, annoying, but mostly harmless.
This only happened with old XIBs and either moving the contents into a new XIB file or (what really happened) Storyboards got rid of the issue.
I did not want to use storyboards as suggested in one of the other answers.
Here is an alternative simple/quick fix.
Go to the Interface Builder Document Properties on the inspector when selecting the xib view file.
Then you need to
change "Deployment" to something different from Project SDK, in my case I set it to the latest iOS version (iOS 6 currently).
change the development to something different from "Previous version", in my case I set it to the latest Xcode version 4.5
I run Xcode 4.5.2 on Lion.
Hope this helps.
basic Idea...
XCode stores lots of version numbers of all different sorts of things. If you look at the XML representation of the XIB, you should find that the vast majority of these little changes are in these version numbers.
How it happens...
Whenever you do an update of Xcode, many different things within Xcode (and often inside the SDK) get updated. If you make a change to a XIB file, those version changes get stood in the XIB. So, if you happen to open a XIB file, the version changes get put into that file. As soon as you build or run the app, those changed get saved to the file.
But I haven't update Xcode in a while!
Well, whenever you did your last update, the XIB files will be updated with the new version numbers as you open them, one-by-one over time.
Edit XCode 4 is better now, (maybe), if you're tempted to vote this down then ask yourself, "Have I migrated from XCode 3 to XCode 4 using Versioning?" If no, then you have no idea what you're doing, and please don't vote on this. If you have, you know how bad you suffered, but yes this question is otherwise dead. If you do find yourself opening a legacy project, just recreate it and copy the files.
I don't know the exact answer, but I do know these things will help you find it:
XCode 4 is notorious for screwing things up.
If you put your directory into a Versioning system, (Git), then grab GitBox and save your project to give it a state and create a git repo out of it. The git repo will save the state. Gitbox will visually show you the changes.
After opening it, you'll be able to right-click on that file in GitBox and hit "see difference" or "view changes" or whatnot.
You will be auto-scrolled to the lines. If you can relate the XML to the Xib, you can figure out what changes.
I went from Lion to Snow Leopard, so I don't deal with this anymore.

App_AppDelegate.m no longer being called

I've been using xcode 4.0.2 for my project. I went to a computer lab today (also xcode 4.0.2) and opened up my project after downloading it from dropbox (possible corruption?) to discover that it wouldn't work when I ran the simulator. After a multitude of problems, I tried to open it on my own computer, and it also didn't work. I put NSLog(#"Hello") in the appdelegate applicationDidFinishLaunching -- it didn't appear. I haven't touched my project for a week, and it was working fine before -- now it suddenly does not.
I've looked on the internet at a variety of solutions (changing the compiler, changing the deployment target, deleting framework search directory) -- and none of them have worked. Any help would be great, otherwise I may have to completely copy paste my code into a new project or something like that.
The simulator shows a black screen in the computer lab. It shows a white screen on my computer.
One thing comes to mind - check if your MainWindow.xib file still has outlet connections to AppDelegate object as a delegate of File's owner (UIApplication).

Merging 2 Xcode projects - two AppDelegates causing errors

I have two Xcode iPhone projects I want to merge. Both have viewcontrollers, xibs and appdelegates.
I have merged them but have over a dozen fatal errors, largely about one of the appdelegates.
I went into info.plist and changed the main nib from the first project to the second but am still getting the errors about the second project's appdelegate.
Not sure how to resolve this ... copy everything from the second AD over to the first AD?
Brooks
Look in the settings for the targets, you should be able to specify their app delegates somewhere there, I dont quite remember where, dont have my mac infront of me, but when im there ill check it out and post an edit.