How do I change ARC setting after the project is created? - objective-c

I am new to iOS development. When I created my project, I chose the wrong setting for ARC, and now I don't know how to go back and change that setting. Where can I find that?

You have to go under the section Build settings of the project settings and change the value of the : Objective-C Automatic Reference Counting property :

Go into the Build Settings and search for "automatic reference counting" and you should see a Yes/No option.

Related

How to show access modifiers for classes in IntelliJ IDEA?

I've recently upgraded to Intellij IDEA 2017.2 and access modifier icons disappeared from my file tree... How to get them back?
UPDATE
Since 2019.2 version you can enable it in the Project view options, toggle the Show Visibility Icons:
For older versions:
This option was disabled intentionally, see this comment for the explanation:
This information was intentionally removed, as we believe that it
brings more clutter than actual value.
To enable it back add -Dide.projectView.show.visibility=true in Help | Edit Custom VM Options.
Since 2019.2 there is actually an easy to use option as described in comment:
you can find this setting in options menu of Project Tool Window. It's called "Show Visibility Icons"

How to enable ARC for a single file

I want to bring a single Objective-C class written using ARC into an old project. The internet provides many references for how to enable ARC for your project and then disable it for single files but I want to do the opposite.
I want to leave the project as it is, i.e. using manual reference counting, and then enable ARC just for the new file. (My searches have failed me here.)
Is this possible? How?
Add the -fobjc-arc flag to any files for which you'd like to enable ARC, as described in the ARC documentation.
Select Target > Build Phases > Compile Source > Select Your class > Double Click> Type
-fobjc-arc in dialog box
Enter.

Where to set automatic reference counting - xcode 4.2

When I created my project, I checked the "Use Automatic Reference Counting" to on. Now, I'm thinking of turning it off but I can't find where to change it.
One more thing, is it advisable to use ARC for iPad/iPhone apps?
Open the project file.
Under Build Settings tab search for "Objective-C Automatic Reference Counting".
Set the value for it.
Yes, sure if you want to deliver a product for iOS 4.0 and above you can definitely use ARC.
You can turn off "Use Automatic Reference Counting" by clicking on your project in the navigator (the top item in the finder-like thing on the left) click on your target, select "Build Settings" and turn off the option "Objective-C Automatic Reference Counting"
If programmer is novice than it is good advice to let them do it manually , otherwise his memory fundamentals will be never clear , Otherwise it is just fine to use it.
Go to the Project Menu->Target->Build Settings->Objective-C Automatic Reference Counting, then you can set here Yes or No. if You are a beginner and You can't handle memory issue yourself then you can enable ARC.

My.Settings.mytext has a value but i cannot find where it is set?

onload i do a msgbox (my.settings.mytext)
it returns a value, but i cannot find where in the project i have set this value!! it was definitely set by me, but i cannot find it anywhere. please help
it is attached to textbox1.text, but that has no value either
Please see My.Settings:
The My.Settings object provides access
to the application's settings and
allows you to dynamically store and
retrieve property settings and other
information for your application. For
more information, see Managing
Application Settings.
and also How to: Add or Remove Application Settings:
Application settings allow you to
store and retrieve property settings
and other information for your
application dynamically. There are two
types of application settings, based
on scope: user-scoped and
application-scoped settings.
At design time, you can add
application settings either using the
Settings pane of the Project Designer,
or using the Properties window for a
form or control, which allows you to
bind a setting directly to a property.
This last line that I have emphasized is most likely where you want to look.
Maybe you could goto the Edit menu and do a Quick Find on the Settings name, if it finds it you'll probably find out where you've set the value.
Also, have you checked the Program.vb file? I always forget about that file.
Hope this has helped.

How to use NSzombie in xcode? [duplicate]

I have an app that is crashing with no error tracing. I can see part of what is going on if I debug, but can't figure out which object is "zombie-ing".
Does anybody know how to enable NSZombie in Xcode 4?
Environment variables are now part of the "scheme".
To edit the scheme and turn on zombies:
In the "Product" menu, select "Scheme" > "Edit Scheme...".
Go to the "Run Foo.app" stage in the left panel, and the "Arguments" tab on the right.
Add NSZombieEnabled to the "Environment Variables" section and set the value to YES, as you could in Xcode 3.
In Xcode 4.1 and above, there's also a checkbox on the "Diagnostics" tab of the "Run" stage to "Enable Zombie Objects".
With Xcode 6.4:
I encountered the same problem with troubleshooting EXC_BAD_ACCESS and had hard time to find the setting with Xcode 4.2 (the latest one that comes with iOS5 SDK). Apple keeps on moving things and the settings are no longer where they used to be.
Fortunately, I've found it and it works for the device, not just Simulator. You need to open the Product menu in the Xcode, select Edit scheme and then choose the Diagnostics tab. There you have "Enable Zombie Objects". Once selected and run in debugger will point you to the double released object! Enjoy!
In short
Product->Edit Scheme->Diagnostics-> Click Enable Zombie Objects
Product > Profile will launch Instruments and then you there should be a "Trace Template" named "Zombies". However this trace template is only available if the current build destination is the simulator - it will not be available if you have the destination set to your iOS device.
Also another thing to note is that there is no actual Zombies instrument in the instrument library. The zombies trace template actually consists of the Allocations instrument with the "Enable NSZombie detection" launch configuration set.
It's a simple matter of setting an environment variable on your executable (NSZombieEnabled = YES), and then running/debugging your app as normal.If you message a zombie, your app will crash/break to debugger and NSLog a message for you.
For more information, check out this CocoaDev page: http://www.cocoadev.com/index.pl?NSZombieEnabled
Also, this process will become much easier with the release of 10.6 and the next versions of Xcode and Instruments. Just saying'. =)
Product > Profile will pop up Instruments. Select zombies from the panel and go nuts.
Go to Product - Scheme - edit scheme - Arguments - Environment Variables set NSZombieEnabled = YES
In xcode 4.2
Goto, Product -> edit scheme -> click Run yourappname.app -> Diagonostics -> Enable Zombie object.
Here's a video and explaination how to use Instruments and NSZombie to find and fix memory crashes on iOS:
http://www.markj.net/iphone-memory-debug-nszombie/
As of Xcode 3.2.5 and Snow Leopard (Mac OS X 10.6), you can run your code through the Zombies instrument: Run > Run with Performance Tool > Zombies. That allows you to see particular objects and their retain counts on a timeline.
In Xcode 4.5.2 goto Product -> Edit Scheme -> and Under the Diagnostics tab check the check box in between Objective C and Enable Zombie Objects and Click on OK
To enable Zombie logging double-click the executable in the executables group of your Xcode project. At this point click the Arguments tab and in the Variables to be set in the environment: section, make a variable called NSZombieEnabled and set its value to YES.
In XCode 4.0: To detect NSZombie in Instruments, select the Simulator as your target (can't detect NSZomboe on device). Run Instruments (CMD+I) and select "Zombies" trace template. Enjoy.
In the preferences of your executable add the environment variable NSZombieEnabled and set the value to YES.
in ur XCODE (4.3) next the play button :) (run)
select : edit scheme
the scheme management window will open
click on the Arguments tab
you should see : 1- Arguments passed on launch
2- environment variables
inside the the (2- environment variables) place
Name: NSZombieEnabled
Value: YES
And its done....
NSZombieEnabled is used for Debugging BAD_ACCESS,
enable the NSZombiesEnabled environment variable from Xcode’s schemes sheet.
Click on Product⇒Edit Scheme to open the sheet and set the Enable Zombie Objects check box
this video will help you to see what i'm trying to say.