In the app I support iOS 7+. But I can't download a simulator to test it on iOS 7, because the latest simulator available is iOS 8. Everything works fine on iOS 8 and iOS 9. But my customer has iPhone 4 with iOS 7 and when he runs the app, it crashes immediately after launch with error:
Auto Layout still required after executing -layoutSubviews. UITableView's implementation of -layoutSubviews needs to call super
I took this error from crashlitics report. May be somebody knows how to correct that?
Check your all layoutSubviews methods where you have write and in that method first call [super layoutSubviews]; .
because before few month I have same problem for ios 7 and then I call [super layoutSubviews]; In custom cell where I have used layoutSubviews method and its working fine for me.
-(void)layoutSubviews
{
[super layoutSubviews];
// do your stuff
}
Related
I have some weird behavior differences running my app on an iPhone and iPad I am trying to understand.
I have the following method to reload a UITableView when a user starts to edit a text field. It works 100% correctly on my iPhone, however when I load the app onto my iPad, the table does not reloadData when this function is called. I can see that the textFieldDidBeginEditing: function is called (and all code inside it) however the table does not reloadData: when the app is run on my iPad.
-(void)textFieldDidBeginEditing:(UITextField *)textField
{
self.concatLabel.hidden = false;
NSLog(#"BEGIN EDITING");
self.messageField.text = nil;
self.concatLabel.text = nil;
[self.arySelectionState removeAllObjects];
[self.tableView reloadData];
}
My iPhone is running iOS 8.1, while my iPad is running iOS 7.0
My deployment target is set to 7.0. I switched the Deployment target device from iPhone to Universal and I have the same issue.
I would appreciate any insight or advice.
I've been developing an iPad app which was working fine until i updated my Xcode to version 6 and my iPad to iOS 8.The problem i am encountering now is that when i change the orientation of my iPad i can catch the event but the views do not rotate accordingly.To be specific in my iPad with iOS 7 app rotates itself size of the views stay the same; for example if i start the app in portrait mode and change rotation to landscape there is a space on the right side of the uiview.In my iPad with IOS 8 views do not even rotate itself and stay the same all the time.I'm not using auto layout and app used to work like charm before IOS 8 SDK release.I need your help on finding articles and cause of the problems.Thanks in advance
probably the cause of problem is this line but i need to have this because otherwise my app won't release uiwebview from memory.
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
self.view.window.rootViewController=self;
}
Rotation handling has changed in iOS 8. Methods such as willRotateToInterfaceOrientation:duration: and didRotateToInterfaceOrientation: are now deprecated and replaced by viewWillTransitionToSize:withTransitionCoordinator:. Depending on how you're handling rotations in your app, you may have to make changes in your code to adapt to the new methods. Check chapter "Handling view rotation" in the UIViewController reference docs
My app subclasses a UITableViewCell and implements layoutSubviews to modify the cell's contentView's width, like so:
- (void)layoutSubviews {
[super layoutSubviews];
// position subviews...
CGRect frame = [[self contentView] frame];
frame.size.width -= 20;
[[self contentView] setFrame:frame];
}
When running this code with the iOS 8 simulator and Xcode 6 GM seed, this triggers an infinite loop. However, when running on a real iPhone or iPad running iOS 8 GM seed, it does not loop, as in previous versions of iOS.
I first thought the difference was a compiler optimization, but the simulator loops in both debug configuration and release configuration.
Questions
Why the difference between the iOS 8 GM and the simulator?
Is this a critical bug fix? I'm very reluctant to release an app that exhibits a potentially serious hanging bug, even if I can't reproduce it on device.
What in your opinion is the best way to refactor this to eliminate the looping without causing regression on iOS 7 and 6?
This happened to me on one of the previous iOS 8 betas. Occurred on both device and simulator. After some debugging I found out that UITableViewCell probably uses autolayout internally on iOS8. Moreover, any changes to contentView.frame triggered layoutSubviews (which might be a reason of your infinite loop as well).
As a workaround, I added a subview to the cell's contentView and modified its frame instead. Then I used this view like I would use the contentView (as a superview of all the custom cell elements).
Hi In past I had developed one application which supports IOS6.Now the time came to support the same app for IOS7 also. For supporting the app for IOS6 & IOS7 I increased the Y value of each and every component by 20 pixels.
Here I am getting the OS version by using[[[UIDevice CurrentDevice]SystemVersion] floatvalue]; method.Based on that OS version I am changing the rect values for each and every component.
For handling the StatusbarStyle I am using the following methods in IOS7
1. [self setNeedsStatusBarAppearanceUpdate];
2.-(UIStatusBarStyle)preferredStatusBarStyle;
These methods are working fine in IOS7, But if I install the app in IOS6 the app is crashing due to the above two methods.
So now my requirement is I have to hide or not execute IOS7 related methods or changes in IOS6 Device.With the help of this Implementation I hope I can resolve the issue.
Even I used few methods to resolve this crash issue.The methods which I used are
1. #if __IPHONE_OS_VERSION_MAX_ALLOWED== 70000
2.#if __IPHONE_OS_VERSION_MIN_REQUIRED==70000
Here while creating the ipa file deployment Target Which I had set is 6.0. Because I have to support IOS6 & IOS7.
So please help me to resolve this issue. Thanks in Advance.
use NSFoundationVersionNumber condition for doing this Supporting iOS 6
If you need to load different resources for different app versions—and you currently identify a storyboard or XIB file in your Info.plist file—
you can use the version of the Foundation framework to determine the current system version and load the appropriate resource in application:didFinishLaunchingWithOptions:. The code below shows how to check the Foundation framework version:
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
// Load resources for iOS 6.1 or earlier
} else {
// Load resources for iOS 7 or later
}
Take a look the best answer of the same thing that you want
iOS 7 status bar back to iOS 6 default style in iPhone app?
Try checking for this condition :
if ([self respondsToSelector:#selector(setNeedsStatusBarAppearanceUpdate)]) {
// iOS 7
} else {
// iOS 6
}
Hi In past I had developed one application which supports IOS6.Now the time came to support the same app for IOS7 also. For supporting the app for IOS6 & IOS7 I increased the Y value of each and every component by 20 pixels.
Here I am getting the OS version by using[[[UIDevice CurrentDevice]SystemVersion] floatvalue]; method.Based on that OS version I am changing the rect values for each and every component.
For handling the StatusbarStyle I am using the following methods in IOS7
1. [self setNeedsStatusBarAppearanceUpdate];
2.-(UIStatusBarStyle)preferredStatusBarStyle;
These methods are working fine in IOS7, But if I install the app in IOS6 the app is crashing due to the above two methods.
So now my requirement is I have to hide or not execute IOS7 related methods or changes in IOS6 Device.With the help of this Implementation I hope I can resolve the issue.
Even I used few methods to resolve this crash issue.The methods which I used are
1. #if __IPHONE_OS_VERSION_MAX_ALLOWED== 70000
2.#if __IPHONE_OS_VERSION_MIN_REQUIRED==70000
Here while creating the ipa file deployment Target Which I had set is 6.0. Because I have to support IOS6 & IOS7.
So please help me to resolve this issue. Thanks in Advance.
use NSFoundationVersionNumber condition for doing this Supporting iOS 6
If you need to load different resources for different app versions—and you currently identify a storyboard or XIB file in your Info.plist file—
you can use the version of the Foundation framework to determine the current system version and load the appropriate resource in application:didFinishLaunchingWithOptions:. The code below shows how to check the Foundation framework version:
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
// Load resources for iOS 6.1 or earlier
} else {
// Load resources for iOS 7 or later
}
Take a look the best answer of the same thing that you want
iOS 7 status bar back to iOS 6 default style in iPhone app?
Try checking for this condition :
if ([self respondsToSelector:#selector(setNeedsStatusBarAppearanceUpdate)]) {
// iOS 7
} else {
// iOS 6
}