Justified or Natural text alignment before iOS 7 Warning - ios

I have an iOS App that is targeted to iOS 6 and above (I know, I know. But a disturbing number of our users are still on iPhones that have never been updated) and I'm seeing a warning when I compile my app:
Justified or Natural text alignment before iOS 7.0
This is seen for each place I've chosen "natural" text alignment for a control in my xib files. This is confusing to me, because the docs clearly state that NSTextAlignmentNatural is "Available in iOS 6.0 and later."
NSString Documentation
No warnings are presented when I set the alignment in the code, only from the xib.
Unfortunately, I am unable to test this myself because I don't have an iOS 6 device. Is this a warning that I just need to ignore, or could issues still arise in the older devices?

I just made a test project and got the same result with a UILabel set to justified. I repeated with a UITextArea and didn't get the error, so it seems to only relate to setting justified on UILabels.
I ran the same code on an iOS 6 device I have here and didn't get a crash, it just stayed left aligned, so you can probably ignore it, but it is very odd.
Perhaps you could try setting attributed text on the UILabels instead and see if the same thing happens.

UILabel set to Left-justif,like this
setting

Related

Storyboard warning : First baseline layout attribute before iOS 8.0

I can't figure out how to get rid of this warning, I'm using a storyboard with many viewControllers (with labels, textfields and a lot of constraints ) all of them have been created almost the same way.
When I click on the warning it highlights a UILabel inside a scrollView :
This scrollView has many UILabels with constraints, I tried everything I could find on so including : Attribute Unavailable: First baseline layout attribute on iOS versions prior to 8.0
This Warning doesn't cause my app to crash,I've tried on the simulator and an iPhone 4 (ios 7.1.2). But I'm worried about the AppStore approval.
I think the issue is you have many constraints that are using NSLayoutAttributeFirstBaseline and when you click on the warning Xcode is pointing to wrong constraint.
To identify the constraints search in Xcode with "firstBaseline". Change all constraints that are using NSLayoutAttributeFirstBaseline.
Note: You may need to adjust your views. In my case NSLayoutAttributeBaseline worked well.
NSLayoutAttributeFirstBaseline
The object’s baseline. For objects with more than one line of text, this is the baseline for the topmost line of text.
The object’s baseline. For objects with more than one line of text, this is the baseline for the topmost line of text.
Available in iOS 8.0 and later.
NSLayoutAttributeBaseline
The object’s baseline.
The object’s baseline.
Available in iOS 6.0 and later.

UITextView with text less than 10 characters hangs iOS 9

Starting from iOS 9 (I used Xcode 7.0 beta 6 (7A192o)), an Objective-C app with UITextView will hang if the text view's text is less than 10 characters. CPU usage goes up to 99-100% and the whole system hangs.
How to reproduce:
Create a brand new single view app from template (or anything else).
In storyboard, add a UITextView with default settings anywhere in the main view.
Set the text to a string that is less than 10 characters long.
Launch the app in simulator (any device, as long as it's iOS 9).
Upon launch, before displaying the single view, the system will hang and CPU usage will go to maximum forever.
Set the text to any other text that's more than 10 characters and the app runs correctly.a
Looks like constraints or any other settings do not affect this behaviour.
The immediate solution would be to simply not have less than 10 characters, but, well, that's lame.
You can check out this github repository that also demonstrates the problem.
I also submitted a bug report to Apple (bug no. 22736256, although you probably can't see it there yet).
Weirdest. Bug. Ever.
Is anyone also encountering this one??
Took me half a day to narrow the error down to a UITextView. This has got to be the stupidest bug ever.
You don't need to ensure that the UITextView holds at least 10 characters. Just adding a default of at least 10 characters to the UITextView in Interface Builder will fix the problem. Then, you can empty the UITextView using code.
By the way, this is an Xcode 7 bug, not an iOS9 bug. New builds built using Xcode 7 will create the same problem in iOS7 and iOS8.
According to the release notes of Xcode 7.1.1 this should be fixed now:
Storyboards and nibs containing UITextView elements with between 1 and 11 characters no longer hang when loaded on iOS. (23264732)
Refer the blow. It is a bug in Xcode 7 and still has not been fixed.
http://xcode7criticalbug.blogspot.in/2015/10/uitextview-bug-in-xcode-ios-app-getting.html
It can overcome by programatically setting the text property for UITextView.
i have found the solution first check the memory leak and please add the this line of code in particular class.
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:YES];
}
This is helpful for me my problem is resolved.

Ignoring warnings in Xcode 6

I'm a beginner iOS programmer and I guess this is a newbie question.
Are you allowed to ignore warnings when placing views in storyboard if the autolayout is working as expected - warnings like misplaced view or ambiguous height?
Is the app going to work even if I don't fix the warnings and will that app be published?
It seems that the layout may get distorted on some devices if the warnings are ignored. The display of the simulator is not accurate and the app must be tested on actual devices.
All credits for the answer go to Raptor for answering in the comments.

UIKeyboardTypeDecimalPad decimal button capped at half width

I use the UIKeyboardTypeDecimalPad in one of my apps, but when running on iOS 8 the comma button is capped at half width.
I tried creating a simple app with only a UITextField and the DecimalPad keyboard (in both Objective-C and Swift), it exhibits the same issue. Is this a bug in UIKit? I have not been able to find much information online, and iOS 8 has been out quite a while now. In iOS 7 the same code displays correctly.
This is a really annoying oversight from Apple. The only real solution will come from them.
Otherwise use the number pad and add the '.'. I did that before the DecimalPad came out.

iOS - iPad layout top/botton spacing doesn't seem to do what I tell it to do

I am creating this screen:
But when I run things, I get it to look like this.
If you notice, the space below/above some elements looks off. Would anyone know why thing happens and how to fix this?
Thank you!
If you're asking about why the buttons look the way they do, that is because your storyboard is set to be viewed as "iOS 6.1 and Earlier", so you're seeing the interface elements as the appear under iOS 6.1 -. Then when you run the application on your iOS 7 simulator, these same elements appear as they do in iOS 7 +, which you can see is quite different.
Then as far as the alignment problems go, I suggest you read through the 80 iPad storyboard related warnings that Xcode is generating and fix your constraints.

Resources