iPhone 5.0 and 5.1 Simulators Not Calling IBActions? - iphone

I have an app with a target of iOS 5.0. Unfortunately, I no longer have any test devices with iOS 5.
I'd like to be able to use the iOS 5.0 and 5.1 simulators to do basic debugging, but for some reason, my IBActions aren't being called on these simulators.
Further info:
Xcode version is 4.5.2
All simulators are up-to-date (no pending updates/downloads available)
We do have customers who use iOS 5 and 5.1, and they don't have any issues clicking the buttons (or at least, we haven't received any reports about such from them ; )
On the iPhone 6.0 simulator, everything works as expected (pretty sure all IBActions are connected correctly)
Are these simulators just terribly buggy (is this a known issue)? Have others ran into this issue and know a fix?

It turns out that a UITapGesture on self.view was capturing the touches and NOT forwarding to the subviews... for some reason, this behavior appears to be different in iOS 6 and iOS 5 simulators... user beware...

Most Probably issue i seen that..
might be you not define your IBAction method in .h file.
might be you connect two IBAction on one UIButton TouchUpInside.
you also try uninstall app from simulatore clear xcode than might be solve your issue.
reset you simulator contain.
Check is any update of Xcode then you try to run your app then you got solution.
I am working on same configuration and i have no issue like yours..

Use UIGestureRecognizerDelegate to avoid effect of gestureRecognizer on a selectedView:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)recognizer shouldReceiveTouch:(UITouch *)touch {
UIView *selectedView = self.view;
CGPoint point = [touch locationInView:self.view.superview];
if (CGRectContainsPoint(selectedView.frame, point)) {
return NO;
}
else {
return YES;
}
}

Related

Scroll view doesn't visible when i am using removeFromSuperview in xcode 5 (ios 6.1 simulator)

I am using xcode 5. when i was run app from xcode 5 for ios 6.1 simulator then scroll view doesn' see. for ios 7.0 simulator .Before it was working. I am using interface builder
You can see in following image.....
In ios 7.0 simulator it is working
In ios 6.1 simulator It is Totally white
![It is totally White][2]
In my scroll view view controller in viewDidLoad method i have write below code
[scrollView removeFromSuperview];
[self.view addSubview:scrollView];
When I comment above code then scrollview is visible For ios 6.1 simulator
![enter image description here][3]
Seriously I dont know what is the actual reason? is that above reason or not. In xcode 4.6 it was working .Also my app is live on appstore . Please help me .
Thanks in advance
Seems that You have issue with memory management or with position/size of scrollView. Try to set breakpoint and check what heppends with Your object.
#Kalpesh its simply because removeFromSuperview doesn't work in iOS 7. So your scrollView was not removed (if you had touched the screen it would have crashed). But [scrollView removeFromSuperView]; removed the scrollView in iOS 6 .

didSelectAnnotationView not called for ipad

I am working on universal ios app which runs on iPhone, iPad and iPod-touch. I have
implemented the code for annotation and on selecting this annotation a callout would be
raised. It works fine for iPhone but didSelectAnnotationView method not called for iPad.
Should i add any additional to work for iPad? Thanks in advance
In your code i think you just forget to set Delegate in checking of device if else condition. please check Properly. if didSelectAnnotationView called in iphone but not in ipad it means for ipad condition you not set mapView.delegate = self; for ipad Condition.
So please check properly and set its delegate if your code working for iPhone so that probability for your issue.
see if adding this helps. [annotationView setCanShowCallout:NO]

Views are portrait in older versions

I have a problem here and am not able to come up with answer why my app is behaving so.
I made application using XCode 4.5+ and iOS6 and have set my application to work in landscape mode it was working and running fine till I tried to run it in previous version like iOS 5.1 simulator or below all views are in portrait mode :(
You can try defining this method in your controllers:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return ( interfaceOrientation == UIInterfaceOrientationPortrait)ç
}
This plays the same role as shouldAutorotate for iOS6.
as suggested by tkanzakic - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOr‌​ientation solved my problem with lower versions thanks a lot :)

Supporting iOS 4.3 to iOS 6.0

I already have the base code that supports ios 4.3 to ios 5. Now I would also like to support ios 6.0.
The present base code has modal views, hard coded CGRect's, and rotation is different for each view. So I would like to know whether we can support ios 4.3 to ios 6.0 with the same base code, by just tweaking some changes, or do we need to create a complete new target?
Like we cannot use auto layout of ios 6.0 if I want to support previous versions as it will lead to a crash.
Yes, we can do this by setting up the Deployment Target to iOS 4.3. But then, why do you need to support iOS < 5.0 as around 85-90% of devices are on iOS 5.0+. See this
Also, when you set up support for iOS 4.3 or even iOS 5.1.1, you would have to handle multiple things. For example, the method for Orientation,
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
isn't called for iOS 6. It is replaced by the methods,
- (NSUInteger)supportedInterfaceOrientations
- (BOOL)shouldAutorotate
You would need all the iOS versions on devices and then test each and every aspect of your app.
Using Xcode 4.5 it is perfectly valid to use one code base for building iOS 4.3 - 6.0 apps, but as always the key is testing on real iDevices with the given operating system versions.
Yes it is perfectly fine and can be done to support ios 4.3 to ios 6.0 using the xcode 4.5.
And for the orientations in ios 6 have to do some work around like have to put some code differently as posted in #Mayur J's answer.
Or all you can do is just add categories for the required controller's like UINavigationController, UIPopoverViewController, UIImagePickerViewController, etc to return the supported orientation in ios 6.0 like below
.h file
#import <UIKit/UIKit.h>
#interface UIPopoverController (UIPopoverController_Orientation)
-(NSUInteger) supportedInterfaceOrientations;
#end
.m file
#import "UIPopoverController+UIPopoverController_Orientation.h"
#implementation UIPopoverController (UIPopoverController_Orientation)
-(NSUInteger) supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
#end
Here I use UIInterfaceOrientationMaskLandscape as I only supports landscape orientations ie restrict my app to only landscape mode.
Hope this will help you.
Happy Coding :)

iPhone app autorotates on one device, but not another

Does anyone know of a reason why an iPhone would autorotate on one device, but not another? I can't reproduce it on my iPhone, iPod Touch, or any of the simulator devices.
Are there any device settings I should be paying attention to? The offending iPhone has the same SDK version installed (4.2.1), but is a different model (MC319LL) than mine (MC605DN).
Well, I never figured out why the two phones were acting differently, but this bit of code in in the UITabBarController subclass seems to have solved things:
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return toInterfaceOrientation == UIInterfaceOrientationPortrait;
}
You made sure that the misbehaving device had its rotation lock turned off in the settings, right?