How check the availably of all objective-c function in source code for Cocoa - objective-c

When you read the Class Reference of every object of iOS, you will find:
Available in iOS 2.0 and later.
There are a program or a way to list all function and the minimum iOS system?
How can I know if the iPhone with iOS 3.0 will run all iOS function? I can check it in runtime with respondToSelector, but can be more easy with source code?

Set your project's base SDK to iOS 3, and see if it builds.

AFAIK there is no way to list all the APIs you use in your app into one list and check that you are building past the minimum for all those APIs. You will just have to check each one, one by one. Highlight the API in Xcode, and then click escape and it will tell you very easily.
But also I have to mention that this won't be extremely necessary since you should test on the minimum OS you are building for and if it crashes at any point then you have your issue for that certain API.

Related

xcode framework & API?

I am new to iphone development, but my question is for example,
resignFirstResponder
Where you guys found that? Is that considered a built-in function in xcode framework/API? Where do I find those built-in ones or API to use on my learning projects to see which one I need?
If you have a project open in Xcode and you see a call like that you can typically:
cmd-click on that method call to show the declaration.
opt-click on the method call to see documentation, if any is available.
But, if you are new to iPhone development, this is the last place you should start. You should start at the overviews, concept guides, etc... and work down to needing to know about individual methods.
Specifically, start here.

Discover calls to methods not available in earlier iOS versions

I am building my app using iOS 5.0 as base SDK and iOS 3.0 as deployment target.
I know I need to check for existence of methods and classes when I work with features that are not available in the earlier iOS versions, but lately I've lost a few hours on a problem just to discover I was calling a method not available in some iOS versions. I simply did not notice it was a new method and did no check before to call it. The app of course compiled with 0 errors and 0 warnings.
This is a big problem because if I forgot some other check somewhere in the app, I will not know it until I or, worst, some user will activate that specific part of code.
Maybe I am missing something, is there some compiler option I can set to detect the calls I make to methods not available in the iOS deployment target? How do you deal with such a problem?
This link might point you in the right direction. Supporting mutiple ios Versions in your apps. It explains how to deal with taking advantage of the newer ios features while maintaining backwards compatibility. Hope that helps.
The only way to check for compatibility with a prior version of iOS, currently, it to test the app on an old non-updated device running that version of the OS.
If you can't find a device that old, even just to borrow for short time, then there may not be a good buiness reason to set the Deployment target that low.

Embeding streaming player inside my app IOS

I'm trying to create an iPhone app which plays local radio station in my district. I found this player to work best for me :
https://github.com/DigitalDJ/AudioStreamer
When testing it against my requirements it did the best without any doubt.
I thought I'll use this players API and it should be straightforward(not really for a newbie). How exactly I do that is where I'm stuck now. Because when I run the player original project it runs smooth, but when I copy code inside Classes to my app, this is what happens :
Ok, I've been developing some apps(test apps) for two weeks maybe and I lack experience.
How do you usually embed/import other projects code into your code and user the other codes api?
EDIT
So per Sunil Pandey answer, this cannot be run using IOS SDK version 5.0?
EDIT 2 :
I feel like I'm really close now, have this one issue :
Receiver 'AudioStreamer' for instance message is a forward declaration
It's declared in my h file. as AudioStreamer *streamer
As said Sunil Pandey, ARC mecanism is enabled for your project. With ARC, your project require at least iOS4 on the phone.
I would suggest you to disable ARC for the file you imported from the third party librairy. So you can keep using ARC in your own code (this mean, you never use retain, release, autorelease).
To disable ARC for each file of your AudioStreamer library, refer to How can I disable ARC for a single file in a project?
You must have implemented ARC inside your project. that's why it is giving you this error.
If you are using ARC then only way to use this project library is to create a static library of your AudioStreamer lib and then import it inside your app
Or
If you don't want to use ARC inside your app then you can turn it off by following method
select your target -> Build Setting -> Apple LLVM Compiler 3.0 - Language
set Objective c Automatic Reference Counting to NO

making app compatible with previous iOS versions

I just released my app but I am only able to make it compatible from 4.3 and up.
When I try to go any lower than 4.3 (xcode), it says I need to add code to make this work.
Does anyone know how to do this or has any suggestions? I would like my app to be compatible with 3.0 and onwards.
Thank you very much
You have to reach the least common code, what I mean by this is that you must find all the methods that are all incompatible within all of these versions of the OS. After that you will have to find each and every of it's functional equivalents. Then you can use conditional statements to check for every version and see what fits better or you can use the respondsToSelector method inherited from the NSObject class. In the end you have to test it on each device you are targeting :P
You can run this checkup list that I have always liked.
Edit:
I think I misunderstood your question though it has already been mentioned, be sure to check your deployment target in your build settings.
Checklist:
In your project's build settings…
Did you set the "iOS Deployment Target" to iOS 3?
Did you include the armv6 architecture in both, the built and the valid architectures?
In general:
Do you link to any framework that is not supported on iOS 3?
Do you use any methods, classes or other features that have been added later?

Android and Objective-C

I'm completing a project for the iPhone entirely written in Objective-C. I'd like to port this for Android too.
While the user interface of the iPhone and the Android OS are very different and will need different code, can I some how import the core of my code (ie. the black box that does the thinking) as is to Android as part of some Java code?
I have no familiarity with bridging between Objective-C and Java even though I have written in both.
You got luck! Phil Hassey has recently ported his own game from iPhone to Android within a week and wrote up what he did steps by steps. Here is his journey: http://www.philhassey.com/blog/2010/08/03/porting-galcon-using-the-android-ndk/
You could have a look at Apportable which allows to generate an Android app from an existing Objective-C code base. See this article too.
there is a fork of the gcc that supports objective-c on the android by patching the NDK on
http://code.google.com/p/android-gcc-objc2-0/. But it's considered beta at the moment and i'm not sure if jni/java bridges are already implemented
I have been doing a lot of work on this front — for example by creating my own C++ base framework that does not depend on STL (called Platform Core) and writing the core of the next version of my iOS app with that, so that I can easily port it to Android and whatever else has a C++ compiler and strikes my fancy.
I suggest having a (ick, I can't believe I'm about to say this, but eh), ahem, having a C++ core (there, I said it!) so it can be easily ported.