Project is buggy after upgrading Xcode - ios

I have an old app I maintaining. The app was first compiled on XCode 4.2. If I take the exact same project that works find and compile it on XCode 4.6 I'll get weird bugs such as ViewControllers not refreshing, Back doesn't work as it should etc'. If I'll take the same project and recompile it on xcode 4.2 on my other machine everything will work fine. Before I'm digging into the code, can someone give me an idea why something like this may happen? My main suspect is the Base SDK of each Xcode. Does that make sense?

I couldn't tell you if there will be a difference between 4.2 and 4.6, but historically the iOS frameworks on the device (and, to a lesser degree, the simulator) do adapt slightly depending on what version of the SDK an application was compiled against. You can't rule it out.
A classic (though now ancient) example is backgrounding. Apps built against older SDKs were quit when the Home button was pushed, rather than getting the newer behaviour. More recent (but subtle) examples have included several changes to table views and changes to device rotation.
You should not attempt to build with an older SDK using a newer compiler. Apple doesn't support that kind of configuration. You should always use the latest SDK. And you wouldn't want to pretend these problems don't exist, anyway: The bugs are real, they were just hidden before.
It's unlikely that you won't be able to fix those bugs in such a way that the older versions of iOS continue to function (though you may discover it opens a can of worms that you decide isn't worth fixing for older OSes).

Related

In Xcode, why does a specific Deployment Target break my code, and how should I use it?

Some background info: Syntax color/highlighting and auto-suggest stopped working correctly. I read a lot of questions about how to fix this but none of them helped me as they were related to Derived Data.
I'm learning Swift from some online tutorials, and noticed my syntax highlighting was different to that of the course teacher's. Then I noticed that when I create an instance of my struct, and use the dot syntax after the instance, Xcode didn't auto-suggest the struct's functions and variables, whereas it does in the downloaded version of the project. After some investigation I noticed that a key difference between my project and the teacher's is that my project has a Deployment Target of 8.1, whereas the teacher's has 8.0. I changed mine to 8.0 and immediately the syntax highlighting was restored and I could access the struct instance's functions and variables.
I'm guessing this may be a bug in Xcode, but perhaps I have something misconfigured in Xcode? I'd be grateful if anyone could explain how/why this bug occurred and what is best practice when choosing the Deployment Target.
The setting is located at Project > General > Deployment Info
I hope the above info may help others who encounter this issue.
Deployment Target is the iOS version that your app is intended for. This does not mean it is incompatible with other versions, simply that it is designed to work best on that version. Generally, using the app on a device with a newer version of the OS is much safer and less likely than using the app on a device with an older version of the OS. There's actually a lot of restrictions around installing an app with a deployment target higher than the OS version on the phone.
The most common deployment target right now is going to be 7.x, as most apps were updated when iOS 7 first came out (there was a pretty big change in UI standards and SDK functionality from 6 to 7), and iOS 8 isn't too terribly different from 7, so there's no need to restrict it and/or write new versions of the app for the new SDK. By having a deployment target of 7.x, you should ensure that the app works well on 7.x and all higher versions, including 8.x. You should also have the lowest deployment target you can that's reasonable - so, a purely iOS 8 app should ideally be targeting iOS 8.0. You'll save yourself a lot of PR and invalid bug reports from users who don't understand versioning.
In your scenario, it sounds like there may be a bug in Xcode when using the iOS 8.1 deployment target. You might want to check and see if your docs are downloaded. Go to Xcode -> Preferences -> Downloads and ensure everything is downloaded. I'm not sure if these are actually used in syntax highlighting and completion code, but it's possible. I would also do clean the build folder (Product -> Hold Alt -> Clean Build Folder). Again, I'm not sure, but I think there's just some small thing that's not clicking here. I'm assuming you cleared Derived Data based on your first paragraph - if not, do that (Window -> Organizer -> Select Project -> Delete).

Can I make a game in Xcode 6 Beta 7 then move your game project till the official release?

Ok I Just want to ask. If I work on a Game on xcode 6 beta 7 and then when the official release of xcode 6 comes out can I move the game that I worked on the beta version and work on the official release. Thank you
The answer to your question is most likely yes, though only Apple can give you this answer with certainty. The final release of XCode 6 is expected to arrive soon, and it is unlikely that Apple would make any major incompatible changes to it's project file format now. Which means that a project created with the Beta versions should open just fine with the final release version.
You could be on more dangerous grounds if you plan to use Swift for making your game though. Swift has still not been finalized, and Apple is actively working on making changes to the language as well as fixing compiler bugs. Therefore, it is possible that the final version of XCode 6 could contain some incompatible changes in the language. Which would mean that you might run into compilations issues when you move to the release version.
Personally, I would not wait for the release version to get started on a project. At this late stage in the release cycle, I'd expect incompatible changes to be few and mostly small enough that they should be easy to fix.

Can Xcode 4.6.x and Xcode 5 share project directories?

After installing Xcode 5 I immediately noticed it bringing up the windows/projects from a previous Xcode 4.6 session. Of course this is expected behavior if I am upgrading, but since this is only a preview/beta release it made me a bit nervous....
Is it reasonably safe to let Xcode 5 and Xcode 4.6.2 point to the same project directories (maybe not while running simultaneously?
Yes, it is perfectly fine and I have been using mainly XCode5 but switching to 4.x every once in a while. The only thing to be careful of is when opening some files, it may ask if you want to convert them to XCode 5 format. If you do, you will not be able to open that file in XCode 4.X anymore (or so the warning says, I've never clicked yes).
JSdodgers's answer is perfectly valid.
Upgrading XIBs is a big pain.
Note that you won't be able to use every new XIB feature in Xcode 5 if you don't use the Xcode 5 format.
The best solution is to have a separate branch (git or svn) for your iOS 7 code.

Troubleshooting with internationalisation

I recently added other language support to my ios project.
Then, I continued to develop.
Now if I turn my language back to English it runs an older (way older) version of the app and I don't know why since the storyboard and code are all correct in the project.
Any hint?
if I turn my language back to english it runs an older (way older) version of the app
This sort of thing is often caused by having old files lying around in the built app, even if they have been changed in the project. Try following my instructions for cleaning the caches and getting rid of all copies of the build app, here:
https://stackoverflow.com/a/6247073/341994

For iOS developers, are there many differences between XCode 4.2 (iOS5) and XCode 4.5 (iOS6)?

I'm starting to learn iOS development using this awesome course on iTunes U:
http://www.stanford.edu/class/cs193p/cgi-bin/drupal/
However, this course was done in Fall 2011 and is using XCode 4.2 and iOS5.
I now see that XCode 4.5 (iOS6) is out.
I just want to know if it's a good thing following this course as it's already one year old?
Or if XCode 4.2 (iOS5) and XCode 4.5 (iOS6) are so similar, that I'll just have to tweak some things a little?
I used to follow the Fall 2010 course with XCode 3.2.5 (iOS 4.2) and I stopped to start the Fall 2011... and there were so many differences that it was almost like starting over.
I just want to make sure that by investing my time in the Fall 2011 course that I'm not learning stuff I would have to learn again in iOS6.
Thanks!
Besides all of the other good info in the other answers, please be aware that Xcode 4.5 comes with an updated LLVM compiler that provides you with much improved Objective-C features. Working with properties is much easier. You no longer need to explicitly declare instance variables for properties nor do you need the #synthesize statement. The new compiler makes working with arrays and dictionaries easier plus it is easier to box basic types.
The good news is that any code you write with the older compiler of Xcode 4.2 will continue to work under the newer compiler (but not the other way around).
Also keep in mind that Xcode 4.6 will be out soon so using 4.2 will just put you further behind.
The Stanford course you're about to learn is great and it contains lots of subjects, both basic and advanced. I can't think of anything that's not worth learning from the course even though it's outdated - you'll just have to learn about what's new in iOS6.0 after you've come to terms with the more important foundations and basics featured in the course.
Have fun learning iOS
Regarding the differences between the various versions, I'd suggest you check out the Objective-C Feature Availability Index and the Xcode release notes. The major shift in Xcode 4.5 is the support for iOS 6, and you can see a list of those features in What's New in iOS: iOS 6
I think you'll be able to follow the Stanford class even if you're running Xcode 4.5.2 (or whatever). There are some minor differences, but most of those are just new features that you might not yet avail yourself of yet. Frankly, many (most?) of us are still deploying iOS 5 (or earlier) apps today, to ensure backwards compatibility with users with older versions of iOS on their devices, anyway, so if you focus on iOS 5 while you learn the basics, I think that's fine. So, go ahead and gain mastery of iOS 5 using that course, and when you're done, you can then go through the WWDC 2012 videos to familiarize yourself with some iOS 6 features and new Xcode features.
The only major stumbling block that leaps out at me (if you focus on iOS 5 targets) might be autolayout which is an iOS 6 feature which defaults to being turned on. To avoid confusion here, whenever creating a new storyboard or NIB, you may want to turn off "autolayout". If so, go to Interface Builder, click somewhere on the background, select the "file inspector" in the right panel, and make sure the "Use Autolayout" flag is unchecked.
For the record, they just updated the CS193P Web Site
They will make the Winter 2012-2013 course available via iTunesU:
Winter (2012-13) quarter's lectures are currently scheduled to be made
available via iTunesU. Don't expect them to appear the day after the
first lecture, however! There is some work involved to prepare and
publish them. Please be patient.
That sounds cool!

Resources