How do i migrate an app to iOS 5? (or turn on ARC) - objective-c

I've got an app i'm working on and i just started using iOS 5. I'd like to start using Automatic Reference Counting but I'm not sure what steps i need to take to either migrate to iOS 5 or at least to turn on ARC.

If you look in Edit > Refactor menu, you'll see an option called Migrate to Objective-C ARC. That tool will help convert your code to ARC.

iOS 5 docs are not publically viewable yet, but in your Xcode you can go to the Organizer and view documentation. Search for "Programming with ARC Release Notes" and there's a document in there which will hopefully answer most of the questions you have about the process.

Related

Xcode 8.3 macOS Project without storyboard

I am trying to find a way to start a project in Xcode 8.3.1 (8E1000a) using .xib files instead of storyboards in Objective-C on macOS.
There isn't a clearcut way to do it, and everything I've seen is iOS using single view storyboard application.
I'm hoping you guys have a fix or at least a quick hack.
Thanks in advance.
A workaround is to keep a copy of Xcode 8.2 around to create new projects. Create the project in 8.2. Develop the project in 8.3.
If you're going to use Xcode 8.3 to create new projects, you'll have to manually remove the storyboard and add xib files to the project. You'll also have to tell the project to use one of your xib files as the main interface file for the project. The following discussion on Apple's developer forums shows you how to do this:
Did Xcode 8.3 update eliminate the basic AppDelegate project template?
Update in 2018: In Xcode 9, the Use Storyboards option is back!
This does not apply to all templates, for example the Game template, but it is in the normal Cocoa App template.
You can't. Basically Xcode is proposing you some templates when you create a new project.
And there are all using Storyboards.
However, you can definitely use xib files in your project.
I myself use xib files because it is so much simpler when your project is under version control.
Storyboard + Version Control = Mess

Including iOS 6 properties in an object for an iOS 4.3 backwards-compatible app?

I'm adding some iOS 6 features to an existing app -- specifically, the built-in facebook integration. However, I need my app to retain backwards compatibility with iOS 4.3.
In most code, I understand how to handle this using respondsToSelector; I also understand to weakly link the Social and Accounts frameworks so they're only loaded if available.
What I don't know, though, is this: In order to enable the Facebook integration, I need to add a property to my "ShareViewController" -- which handles all the sharing for my app -- to hold the composition sheet, i.e.:
SLComposeViewController *mySLComposerSheet;
However, SLComposeViewController is a class that exists only in iOS6. So essentially, I need that property only to exist if the user is running iOS 6.
How does one handle this sort of situation?
It will just work. There's some metadata in the property/ivar that references the class name, but it doesn't actually link against the class or cause an error at runtime.
Of course, always test!
I suggest you use NSClassFromString and [UIDevice isSystemVersionHigherOrEqualTo:#"6.0"].

XCode 4.2: How To Use Page-Based Application

I am trying to explore xcode 4.2, and now i am trying to build a simple book app using the page-based app template on xcode.
I actually have no idea how things go on page-based app. to practice i want to load 1 image (different image each page) in every page. it's just a simple picture look book just for me to learn and be familiar how will i able to work with page-based application.
I am a bit confused with it, i don't know where to start. how will i able to do that??
any links for reference? or books that tackles the page-based application??
There is a book by Wei-Meng Lee called 'Beginning iOS 5 Application Development" he has online source code free for book owners. It's located here: http://www.wrox.com/WileyCDA/WroxTitle/Beginning-iOS-5-Application-Development.productCd-1118144252,descCd-DOWNLOAD.html
In the FULL DOWNLOAD there is an app called UsingViews (UsingViews.zip). That app shows you how to move through views. I highly recommend purchasing his book. Very Helpful.
Apple Documentation is also very helpful as others have already pointed out.

How to make Notification Center Widgets (iOS 5)

iOS 5 introduced Notification Center Widgets and I would like to experiment with those widgets and make custom ones (with a Jailbroken device). I couldn't quite figure out how to make such a widget. The Widgets (WeeApps) are bundles stored in /System/Library/WeeAppPlugins. It would be great if anyone has already writren a guide or could share how the principal class of a WeeApp has to look like. Ideal would be to have a WeeApp NIC template for theos :)
Note: This question is regarding so called WeeApps, system plugins for Notification Center introduced in iOS 5. Not to be confused with Today View Extensions introduced in iOS 8.
I don't want to shameless-plug in here, but I wrote a small tutorial to help you with this.
How to write Notification Center Widgets for iOS (iOS 6 and Below)
Hope it helps you!
UPDATE
Please note this is for iOS widgets running iOS 6 and below - In other words, this is for old jailbreak development. I may write an iOS 8 tutorial eventually, but this one is not it.
OK i think i have found a good way to understand it, a sample widget with full source code available on github: https://github.com/WillFour20/WeeAppTest But whats most helpful is this tutorial and the NIC template for theos mentioned in the tutorial, I already made several widgets using this method and my custom NIC templates. http://weeplugins.com/blog/?p=1

How build a custom control in Xcode for the iPhone SDK?

I want to build a custom control to reuse in my project which consists of two UITextFields that are linked together + a label.
It is starting to become repetitive across my App and smells of code duplication ;)
However, I wonder what is the best aproach here.
Is it best do everything by code in a controller or is posible do a visual thing like the ones built-in in Xcode?
You can build an Interface Builder plug-in for this. It's fairly straight-forward. To get started, read the Interface Builder Plug-In Programming Guide. It even has a quick, step-by-step tutorial to get you started. Apple recommends creating a plug-in to IB for just your case...
I don't think this is possible. I briefly looked at the IB Plug-In Programming Guide and apparently Interface builder plugins are implemented through Custom Cocoa Frameworks. That is, your plugin is defined in a framework which is loaded in Interface Builder. IB looks in the current projects frameworks to find any custom components defined and will load plugins accordingly. It is not possible to use custom or third party frameworks on the iPhone so I don't see how IB would make a connection here. If somebody has more info I'd love to see this discussion continued.
This is fine except it is for the iPhone. The iPhone presents a more difficult environment to create the plug-in for interface builder. It should be possible but I have yet to see a Xcode project that does this. They are all limited to creation of desktop "AppKit" versions, not iPhone "UIKit" versions of the plugins for IB.