I am using XCode 4.3 and I am creating a tab bar application following an example in my book (likely used for XCode version < 4.3) but when I add a new tab and turn on check-mark to generate XIB file while adding a new file of Cocoa Touch, the GUI doesn't appear but display instead its generated XML file content. Do you know how to fix this ?
I find each time there is a new version of XCode, the Gui and defined functions seem to change a lot, doesn't this annoy for low programmers like me ? (By low, I mean newbies and those who can't keep up with such rapid changes). Thank you.
You can view my shot here
http://imageshack.us/photo/my-images/685/appleimg.png/
Right-click on the .xib file and choose Open as...
There will be a list of options. Currently you are using "Source Code", which displays as XML. Use Interface Builder - iOS instead.
This will be remembered between sessions. I don't know how it got set to this in the first place.
Alternatively, you may be in the Version editor instead of the Standard editor - this will show xibs as XML in order to correctly display changes.
Related
My app is currently localized for English and Japanese, with seperate storyboards for each. I want to switch to base localization so that I only have to maintain a single storyboard. I've checked the "Use Base Internationalization" box in the project's info tab and chosen the English iPhone and iPad storyboards for the base.
I assume I should delete the Japanese iPhone and iPad storyboards I had previously used, but I don't see an option to delete them when right-clicking on their files in the file inspector. Should I delete these old storyboards, and, if so, how?
** Edit **
Changing the 'Main Interface' shown in the screenshot doesn't allow me to delete the Japanese storyboard. It's hard to tell which storyboard to select in the dropdown because its width is more narrow than the storyboard names, but that's a separate issue.
This tutorial drives you through the process step-by-step. This is how it worked for me:
Remove all localizations and leave only the base.
Ensure that the localized files were moved from the project directory (in Finder)
Add the localizations one-by-one
The localized strings are extracted from the storyboard only when the localization is created. The Tutorial above provides a script that can help you keeping the localized files up to date if the storyboard is changed.
In your case, you will have to merge the existing translations into the new files but I suppose it is not a huge deal compared to the gain with using a single file.
For reference, the process is described in this official tutorial too: http://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/chapters/InternationalizeYourApp/InternationalizeYourApp/InternationalizeYourApp.html
After cleaning and reloading, I was able to remove the Japanese storyboards by clicking on the - in the project settings:
I'm trying to localize my app.
I noticed that if I add a language every localized file become doubled.
In this way it's impossible to maintain code or storyboard so I learnt that I need Base internationalization.
The problem is that when I select that checkbox in xcode project setting it shows a window without nothing to select, does anyone know how to fix this?
Here's a screenshot
First, you need to go to your storyboard file, open the bar on the right side, and go to Show the File Inspector, the furthest tab to the left. Then, scroll down and click localize. After this, when you check Use Base Localization, you should see the storyboard appear.
This could happen if Base Internationalization was active before then disabled and files deleted manually.
Create Base.lproj folder in your project folder using the finder.
Move your main story board to it also using the finder.
fix the reference to it from Xcode.
remove app. from device, clean & build your project.
All will be back to normal.
I just bought the book: Sams Teach Yourself iPhone Application Development in 24 Hours.
In the book it uses xCode 3.2.4, so I went ahead and tried xCode 4.3 (the current version), but I didn't understand what to do...
I then found this page...
https://developer.apple.com/downloads/index.action
I downloaded the version of xCode used in the book (just so I could see the same thing the book shows).
But, I'm getting two errors each having something to do with the Interface Builder...
"This version of Interface Builder does not support documents of type "Interface Builder Cocoa Touch Document (XIB 3.x)" targeting "iPhone/iPod touch"."
And it comes up twice for two different documents in my xCode project.
How can i get it to work? In the book the code I put in works just fine.
Also my Mac Version is: 10.7.3
Do not waste time learning anything about Xcode 3.x. That would be like learning how to build catapults and siege engines in preparation for a career in the military.
Apple completely rewrote Xcode with version 4.0, and every single thing about the user interface is totally and completely different. If you invest time learning 3.x, you will be totally lost and confused when you move up to 4.x (version 4.3. was just released, and there is yet a new version on the horizon.)
I was totally lost and confused for about 2 weeks when I made the move from Xcode 3.x to 4.x, and I do this for a living and have been using Xcode for over 6 years now.
Unfortunately, the iOS development books are behind the curve when it comes to versions of Xcode.
Do yourself a favor and set the Xcode 3 book aside and find an Xcode 4 book (an ebook might be a better choice, since they can be updated.)
From what I just read, the xib files you have are not compatible with the newest version of Xcode.
You may learn loads by fixing this.
Don't delete the two files yet...
Will the xib documents still display in IB?
Try this:
Rename the two xib files to some other name.
*) With the old file open in IB, click View, Utilities, Show File Inspector.
Click File's Owner, Rename
1) In toolbar click File, New, File
2) Choose User Interface, Empty, Next, Next
3) Type the name of the corresponding .h file, be case sensitive. Click Create.
4) Click File's Owner
5) With the new file open in IB, click View, Utilities, Show Identity Inspector.
6) For the class name, Use the class name in which you are attempting to fix.
7) Drag a New View object to to the canvas, right click the new view, and set a Reference to the file owner's view variable by dragging to File Owner.
At this point, you could attempt to copy all the objects out of the old xib and paste to the new one. Make sure you check all referencing outlets and target action stuff.
8) Delete the old files in Xcode by right clicking and choose Delete, References Only.
Let me know if this works or not.
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.
I've been iPhone programming for 6 months and come from a PC/Java/Eclipse background and still have a few annoyances with Xcode/iPhone programming I wonder are there any shortcuts to.
Is there any way to prevent multiple windows opening all the time in XCode?
a) When you click on the Errors/Warnings in the bottom right of the status bar build errors are shown in separate window. Any way to get these to show in the main editor?
b) Anyway to get debugger to appear in main editor.
I have a big screen iMac and it's still window hell on Macs.
When you come from Alt-Tab the Mac is a nightmare.
2) Anyway to get a toolbar item on the main editor to:
a) Open Console (I know CMD-thingy-R)
b) Open Break points (you have to open Debugger first then breakpoints)
I know there's keyboard shortcuts but I have only left hand free others on the trackball so any keys on right hand side of keyboard are too far.
I know you can add Finder toolbar scripts (just wondering if anyway to extend Xcode).
Are there utilities to extend Xcode? Scripts/Automator/Any Services I can setup to help.
Can you automate Xcode like you can with Windows/ActiveX/VBA
3) Limit lookups using CMD + double click.
If I double click on a variable to find its definition using CMD + double click it shows every occurrence of all variables with that name. (annoying it you name all you maps mapView)
Anyway to get it to limit to the current class or at least order so current class is first.
4) Find doesn't seem to loop backwards if result all above cursor position
I'm in a class and I hit CMD + F for find.
Find box appears.
I enter some text hit return.
It says I have x matches but only back arrow is highlight in Find
But when I hit < it does nothing.
I need to scroll to the top and redo the search.
If the text is both forwards and backwards then both < > are highlighted and it works.
is this a bug or a 'feature'
Missing Eclipse features
I have been looking at the User Script menu but was wondering how powerful they are?
5) any scripts around to generate source from members such as description: #property #synthesize
if I add a new member, run a script will generate #property/#syntesize and release in dealloc
7) any good sites for scripts?
SCM
Im having problems with SCM and Folders on HD under project Classes directory.
You get a library e.g. JSON. It usually comes as a folder. You copy it to the /Classes for your project. /Classes/JSON
I create a Group for the Library in Xcode under Classes group.
Classes
JSON
I drag the files from the folder into xcode into the JSON Group.
I add them to the SCM and icon changes from ? to A
but if I try and commit them it say folder /JSON is not under SCM.
Can you drag a folder into Xcode so that it AND its files get included in SCM?
Anyway to stop Xcode Help from being on top all the time.
I keep feeling like punching it and telling it to get out of the way! :)
I dont mind it open just not in the way once I've finished.
Yes I know I can Ctrl-W
Sites: the main site I use to learn Obj-C are :
stackoverflow.com
Google code Search - tonnes of full apps on here
http://www.iphonedevsdk.com/forum/iphone-sdk-development/
Apple Developers Forums (anyway to get RSS feed to these or is that blasphemy :) )
Safari - 100s of IT book though prob too many to keep up :)
any others?
Any site that gives simple examples for Obj-C/ UIKit
The docs just show the methods but actual examples (Google code search has helped a lot here)
--> 1):
In Xcode -> Preferences -> General, select "All-In-One" for the Layout.
I was used to have only one window and found this mode much better than the default.
Generating #property and #synthesize code.