set self.navigationItem.rightBarButtonItem background image cause crash - iphone

I used the codes below to set the background image of self.navigationItem.rightBarButtonItem
[self.navigationItem.rightBarButtonItem
setBackgroundImage: [UIImage imageNamed:#"top_button.png"]
forState:UIControlStateNormal
barMetrics:UIBarMetricsDefault];
it will cause crash,
I used Xcode 4.3, deploy target 4.0, iPhone os 4.3.3
It worked well on simulator 5.1, but crashed on device
Welcome any comment

That method is only available on devices running iOS 5.0.
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIBarButtonItem_Class/Reference/Reference.html

the method u are trying to use is only available on iOS >= 5.0.
in Simulator you are using iOS 5.1.1 which is >= 5.0 so it works.
on your target devices os = 4.0/4.3.3 which does not have this support.
either you need to test on target device iOS >= 5.0 or you need to drop out the use of this method for iOS devices < iOS 5.0

Available in iOS 5.0 and later.

Related

Is it possible to build an app for iPhone 5 screen size with the former SDK (iOS5)?

The latest SDK (Xcode 4.5) doesn't support armv6 and I need to support it right now, so I don't want to upgrade Xcode. Can I support iPhone 5 screen size and make an app in non letterbox mode on iPhone 5 from the previous Xcode (4.3.2)?
[edit] Comment by Brad Larson, change it all : Apple is now explicitly rejecting applications submitted with the iOS 5.x SDK and iPhone 5 default images, saying "Your app contains a launch image with a size modifier that is only supported for apps built with the iOS 6.0 SDK or later."
You can build an app that is compatible with iPhone 5 screen size by adding the 640x1136 Default-568h#2x.png in your resources (if the splash screen defined in your Info.plist is Default.png).
Xcode below 4.5 will let you test on iOS6 devices which is a new for Apple as when iOS5 arrived, all previous version of Xcode where not compatible with iOS5 (impossible to test on iOS5 devices).
So, YES you can develop for iOS6 and iPhone5 screen size from Xcode 4.4 or 4.3.

Error when testing iOS 5 app in Deployment Target 4.2

i have made an application with storyboard and the new iOS 5 feature like this:
[[UINavigationBar appearance] setBackgroundImage:navigationBarImage forBarMetrics:UIBarMetricsDefault];
if i try to test the app Deployment Target to 4.2 for the user that still have that firmware, i receive an error in the line i write above, so my question is how i can test my app on 4.2 device?
For something which only works on iOS 5, you can do the following.
You can try to get the version by this way :
float version = [[[UIDevice currentDevice] systemVersion] floatValue];
And you try which version the user has before your code :
if (version >= 5.0) { your code }

UIKeyboardTypeDecimalPad for currency field in 4.3 iphone sdk

I am not able to successfully use UIKeyboardTypeDecimalPad when i run on simulator 4.3 and it successfully works on simulator 5.0. I have currency to be filled in textfield.
How can i use UIKeyboardTypeDecimalPad for device running 4.3 ?
Edited
in simulator 4.3 it is giving following warning:
"Can't find keyplane that supports type 8 for keyboard iPhone-Portrait-DecimalPad; using Default"
I think it's a warning because i am using IOS 4.3 and it's printing that error in Logs and working perfectly.I am using following code
- (void)viewDidLoad
{
[super viewDidLoad];
myTextField.keyboardType=UIKeyboardTypeDecimalPad;
}
simulator autocorrection was called which crashed my app..
it is Lion 10.7.2 + Xcode 4.2 + Simulator running iOS 4.3 problem
Now solution to it is
We have to update Simulator 4.3 , by following this steps: 1) Go to Xcode->Preferences->Download 2) Update iOS 4.3 Simulator
And Reset Simulator ,and run it again... its done...

iPad with iOS 3.2 compatibility with iPhone iOS 3.0

Recently submitted iPhone and iPod Touch application to app store successfully, but later came to know that is not working on iPad 3.2 but works on iPad with high iOS like 4 in scaled version.
Reason: setOrientation property of Movie player.
Actual Query: In order to make it work on iPad 3.2 in MAC Desktop I used
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
player.view.frame = CGRectMake(0, 0, 768, 1024);
[self.view addSubview:player.view];
[player play];
}
else {
#ifdef __IPHONE_4_0
player.controlStyle = MPMovieControlStyleNone;
#else
[player setOrientation:UIDeviceOrientationPortrait animated:NO];
}
when i run the same code on my MAC BOOK with iOS 3.0 this code is throwing the error...not supported.
So
If i build the above code on MAC DESKTOP(with iOS 4) will that work
on iPhone device with iOS 3.0 ? ..in reference to Event Kit Frame
Work(which throws error in iOS 3.0..but required in iOS 4).
I need to go for separate iPad app instead of Universal?
Is there any difference in iPhone with iOS 3.2 and iPad with iOS 3.2 in terms of
properties used?
I don't think you should hardcode it like that at compile time. Instead you should test if a particular class or method/property on a class exists and then do the appropriate thing. Like using [NSObject respondstoSelector:] to test whether your object understands a particular method.
Okay, first of all it does not matter if you use the Mac desktop or the MacBook to compile. It looks like you may be confusing the "minimum iOS" value and the "base SDK".
Base SDK: Refers to the code library that the complier will use to check your code, but does not determine which OS's your app will actually run on. You can have a base SDK of 5.0 and your app may still work fine on a 3.0 system. The catch is that if you are using code that is compatable with your Base SDK and not older OS's, the compiler will not catch it.
Minimum OS: This value does determine which OS's your app will run on.
If you are using code for higher OS's but want to run on lower OS's you need to test in the code for which OS you are running on and then run the appropriate code for that platform.

MPMoviePlayerDidExitFullscreenNotification

MPMoviePlayerDidExitFullscreenNotification is working fine in IOS 4.0 (>=3.2). But leaves a white screen when loaded in IOS 3.1.3 (<3.2).
As stated in the iOS Class Reference, that notification is available in iOS 3.2 or later.
http://developer.apple.com/library/ios/#documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/MPMoviePlayerController/MPMoviePlayerController.html%23//apple_ref/doc/uid/TP40006953