MPMediaPickerControllerDelegate error - iphone

I get an error when trying to use MPMediaPickerControllerDelegate even though I have added the reference to the framework and added
#import <MediaPlayer/MediaPlayer.h>
The error I get is:
"error: cannot find protocol declaration for 'MPMediaPickerControllerDelegate'"
I'm trying to have a single binary work for iPhone OS 2.2 and 3.0, so I set the Base SDK to 3.0 and iPhone OS deployment target to iPhone OS 2.2
What could I be doing wrong?

Whats wrong here is that MPMediaPickerControllerDelegate is not available in any version of the OS before 3.0, so you wont be able to run that on the OS 2.2 and if you dont find a way around using this class it wont be compatible with OS 2.2, from reading the docs it looks like this class is f or IPod access on the iphone, thats a 3.0 only feature...

Related

Why can't I compile with iPhone OS 3.0 as a deployment target in Xcode 4.2?

I have an iPhone app which was developed with 4.0 as the base SDK and a deployment target of 3.0. Everything was working fine.
Last week I upgraded to Xcode 4.2. Now when I open the existing project, I can't compile with a deployment target of 3.0. It compiles successfully and runs only when the deployment target is 4.0.
I get the following error when I set the target to 3.0:
Unsupported compiler 'GCC 4.2' selected for architecture 'armv7'
The compiler which I use is LLVM 3.0. I am not using ARC.
Should I go back to the 3.x SDK? Is there a way that I can support 3.x using Xcode 4.2?
Uhhh, don't?
That might sound flip but iOS 4 has achieved pretty good penetration. Looking at Intstapaper's data says it really isn't worth it. And the "accepted" answer at this stackover flow answer even suggests just supporting 4.2!
Now, of course, you may have really good reasons for wanting to support 3, perhaps you are working with an Enterprise client who needs 3. In which case, just completely disregard what I've said.

regarding check for base sdk in application code

I want to check if a particular device is having base sdk 5.0 or 4.3 or 4.2 or any other iOS sdk version. To put it more clearly, I want a particular code to run only and only if the iOS sdk version is 5.0 (using the APIs only supported in iOS 5) and if it is less than 5.0, then I want a different code to run. Does anyone has any idea about this???
Use the - (BOOL)respondsToSelector:(SEL)aSelector to check if the object has iOS version specified selector.
I would try setting application properties in Xcode. Start reading here.

(iphone) how can I tell I need a 3.0 + iOS installed device when looking at apple doc?

I've seen iphone related open source library which says something like,
"You need 4.0+ iOS build environment but the code will run on 3.0+ iOS device."
I wonder how those two requirements can differ and how can I tell a minimum 'device' iOS version which a certain api would need.
For instance I want to use UIGestureRecognizer but the apple doc says it's 3.2+, but I want my app run on 3.12+.
Is there a difference between build os requirement and device os requirement to run an app?
Thank you
Yes there is a difference. You can use a higher version of iOS to build an app targeted for a lower version of iOS (they are build settings, Base SDK & iOS Deployment Target respectively).
An example would be using the 4.0 iOS as your base sdk but setting your iOS Deployment Target to iOS 3.0, in this case if the compiler came across a function that is not supported for all iOS versions from 3.0 to 4.0 it will take that into account (i think its called weak linking).
If you know that there is a function that isn't going to work on versions of iOS that you want to support you can use something like this to stop that code executing:
if ( [anObject respondsToSelector:#selector(myFunctionForiOS4)] ) {
[anObject myFunctionForiOS4];
} else {
[anObject myFunctionForiOS3];
}

Can i use Base SDK 4.0 for iPad only app?

We are developing an iPad app for which I am trying to use sharekit http://getsharekit.com
I am getting this error if I use the Base SDK 3.2
Cannot find protocol declaration for NSXMLParserDelegate
But if I change Base SDK to 4.0 it works fine.
I think its possible to use Base SDK 4.0 when creating Universal apps.
Does anyone knows if apple accepts iPad only apps compiled with Base SDK as 4.0 and target 3.2?
It'll work. I'm using them in the same configuration currently, but I've been using NSXMLParserDelegate with 3.2 till too, not really sure why it won't work for you.
Was googling for NSXMLParserDelegate and came across this question -
Error Building Project With NSXMLParserDelegate
or
NSXMLParserDelegate compile problem - iPhone SDK 30. vs 4.0
Maybe this will work?

Developing for both iPhone os 2.2.1 and iPhone os 3.0

I am, as an enrolled developer into iPhone developer program, received a message from apple, requesting to make all applications to be compatible with iPhone os 3.0. It was said that they won't process applications that are incompatible with iPhone os 3.0
The issue is that if I change the code to work with iPhone os 3.0 it won't work on 2.2.1.
For instance sdk 2.2.1 doesn't support the following which is a necessity in sdk 3.0:
cell.textLabel.text = #"text";
In 2.2.1 I would write instead:
cell.text = #"text";
And it's not the only issue.
How do you handle this problem?
Thank you in advance.
Without breaking any NDA. Suffice it to say that since most apps currently on the store built to target 2.0 / 2.2.1 will also work under 3.0... You'll understand that even though there might be APIs that will eventually be deprecated it doesn't mean that are effectively deprecated just now. It only means that as you start developing apps specifically targeting 3.0, you should stop using them. In the meantime, you want to continue building for 2.2.1, just like you would if you hadn't heard of 3.0. You'll simply want to test your app on 3.0, but unless you're doing something weird, you shouldn't have any problem.
Without going into details about OS 3.0 because of the NDA;
You should check this SO question and answer.
It shows how to differentiate between the OS's.
EDIT: I agree with François P.
I'd probably just wrap each of these instances in a conditional based on [[UIDevice currentDevice] systemVersion], which will be an NSString of the form "1.2" "2.0" or "3.0".
If there are lots of instances in your code, abstract through a method or extend the offending class with a category.