How to disable ARC for a single file in Xcode 5? - ios

I recently downloaded Xcode 5, and it's now my primary IDE. However, I now need to disable Automatic Reference Counting for a single file in my project.
In Xcode 4, I went to the Build Phases tab under my target, and I could double click the on the right side of a row in the Compile Sources section, add -fno-objc-arc to the list of compiler flags, and be off.
In 5, however, the column seems to be unclickable:
So, how do I do this?

Well, I just tried and found that you must had dragged the window to a smaller width. You need to drag it back to show the Compiler Flag column:

To fix the real issue rather than a GUI issue, select the file and press ENTER, then you can add the -fno-objc-arc compiler flag.

You appear to be missing the right-hand column. On my install it looks like this:
Notice the 'Compiler Flags' column to the right of the 'Name' column.
Double-clicking anywhere on the row allows me to type into the flags as long as that column is on screen. Making my window sufficiently thin causes it to be invisible so the first thing I'd try is making your window super-wide, to see whether you can get a flags column.

Related

What does the "automatically adjusts font requires using a dynamic type text style" warning mean?

I am getting the following warning:
"automatically adjusts font requires using a dynamic type text style"
Which I can not get rid of the warning is on main.storyboard.
I have checked every UILabel in the Identity Inspector to make sure the "Automatically Adjusts Font" is unchecked.
Open your storyboard as Source Code
Search for key "adjustsFontForContentSizeCategory"
Check which object has this option and uncheck Dynamic Type checkbox from interface builder.
I just changed Text style to Body & Warning vanishes.
It's Just because
it is dynamic type textStyle
See list of predefined supported dynamic type textStyle -
I had the same problem. Even after I opened the storyboard as source and removed the "adjustsFontForContentSizeCategory" key, saved and cleaned the project it would still show.
So then I:
Cleaned the project
Closed Xcode
Deleted the derived data folder contents
Re-Opened Xcode and rebuilt
It was gone. :)
It seems to have been a bug in Xcode. This is what I did to fix it:
Change the font in the label that showed the error, to a dynamic type, as suggested
Select check box for "Automatically Adjusts Font"
Build and run the project (the error disappears)
Uncheck the "Automatically Adjusts Font" box
Change the font back to the previous setting that caused the error
Rebuild the project
The error is still gone.
If the "Automatically adjusts font" box is checked with a non dynamic font this warning will appear. Either uncheck the box on the offending label or use a dynamic font type.
Open your storyboard, right click storyboard in file navigator.
Search for (command F) and delete instances of
adjustsFontForContentSizeCategory="YES"
In the Storyboard, after uncheck every "Automatically Adjusts Font" in the Attributes Inspector, run shift + command + K and then build your project again. This should clean your project and remove the warning.
Swift 5+, Xcode 11+:
Right-Click the storyboard that's having this issue (Check Issue Navigator if you don't know which)
Go to the Open As option and select Source Code
Replace every adjustsFontSizeToFit="NO" with adjustsFontSizeToFit="YES"
Run your application
Watch the warning go away (And even if you undo step 3)
I got this error for automatic adjusting on a button. But I could not find "Automatic Adjust Font" checkbox on right panel. Get rid of warning by going to source code of .storyboard and deleting "adjustsFontForContentSizeCategory" properties on problematic button solved my problem.

Quick way to fix Xcode warnings

I've been switching between versions of Swift in Xcode 6 and my project now has 220 warnings. Mostly minor code suggestions.
Is there an easy way in Xcode to run through all the warnings and use the "Fix-it" tool to auto correct it?
I would like to review each warning, then click a button to fix the warning, and then skip to next warning. Otherwise it's going to take me a few hours to manually get through each warning.
Your best bet is to use keyboard shortcuts. The default keyboard shortcut for Navigate > Jump to Next Issue is ⌘' (command-single-quote). If you press it, Xcode will jump to the next issue it knows about. If that issue has a Fix-it available, the Fix-it popover will appear automatically and you can press return to execute the Fix-it, or press ⌘' to leave the code unchanged and go to the next issue, or press escape to leave the code unchanged and stay on that issue.
You can also open the Issue Navigator (default shortcut: ⌘4). Then you can click on issues one-by-one. If you click on an issue with a Fix-it, Xcode will show the Fix-it popover and you can press return to execute the Fix-it.
Previous answer is best solution,before doing it you must Fix Validate project Settings (Update to recommended Settings).Suppose you decided to fix it last,it may again arises some new warnings.
control - option - command - f
⌃ ⌥ ⌘ f
Just type
⌘ Enter
afterward to adjust back to normal screens view.

Why in iOS Framework, xctest is always red colour?

I'm trying to make a new framework to use in my other project. I know if it is red colour means can not find to the path of the file. But this not a file I created!
What I don't understand is why my new framework with pretty much nothing inside is always red colour. I even run test cases (default). I appreciate if anyone can help me to fix this:
No, Scheme(not schema) is different from Target. Check out this thread for better understanding Xcode: What is a target and scheme in plain language?
To solve your issue, click on the WSBandKit framework icon on top left section(adjacent to iPad2 simulator icon); and select editScheme option from drop down. You will be presented with a new screen with some option. Go to Build option and tick the option of Run for your test target. Close the screen and Build the framework for Device.
Check the image for reference. Initially the Run option will be unchecked for test target that you have to check.

Why does my Xcode 5 doesn't autocomplete nothing?

I'm starting a project but I have another one very similar as base.
I create my new project with storyboard and CoreData, create a new file of NSObject class, and when I start writing in the .h file:
#property (nonanatomic, retain) ns...
nsstring or any type of variable doesn't appear... for example, I start writing ns and it appears:
NS_DURING
NS_ENDHANDLER
NS_HANDLER
NS_VALUERETURN
NS_VOIDRETURN
and the most of code is in black letter, i mean, nothing is coloured as it shoud be normal like purple, blue, etc... the colour that xcode sets... here you can see it:
http://oi61.tinypic.com/359iws6.jpg
P.S: I'm using Xcode 5 Preview 3 and OsX Mavericks. I've never had this problem I think.
Possibly your dot-m (the implementation) file is not a member of the target.
When adding a new file to the project on the bottom of the save dialog there is a Target Membership window . Did you check that box?
To view the target membership and/or to add an existing file to your target open the implementation file. Then open the File Inspector using ⌥+⌘ 1 or View, Utilities, Show File Inspector.
In the File Inspector window halfway down there is the Target Membership. Check the box next to your target.
Syntax highlighting will begin after a short moment, wait for Xcode to finish its indexing.
Try out this: In XCode open Preferences, click on the Text Editing Tab and make sure "Use Escape key to show completion suggestions" is checked.

Xcode 5 indentation issue

I get indentation issues when I copy few lines and paste it. Xcode does not copy indentation properly or applies another indentations.
As shown in below images, I copied first function and pasted which is second function. Indentation are reapplied except for first line.
I played with Xcode indentation settings but could not solve it neither do I have any clue why this happens.
Below are 2 indentation settings I tried.
Do anybody see anything wrong in above settings?
In Xcode preferences, Key Bindings tab, redefine ⌘-V to "Paste and Preserve Formatting" and ⌘-option-shift-V to "Paste". Then ⌘-V will do "Paste and Preserve Formatting" which is what you want.
Try turning off Auto-Indentation. That way, Xcode doesn't remove formatting.
That was when i customized indentation in Swift and then get back to Obj-C. Nothing with changing preferences helped. Just fully restart xcode.
With cut and paste, you have to actually tell xcode to indent after the pasting.
⌘ A and then Control I.
The first one select the whole class contents (when the cursor is inside) and the second one indents it based on your indent preferences.
Hope this helps.
I just checked Xcode settings in another mac and made changes to match that and solved the issue. Sorry I don't remember what were they as it has been too long.

Resources