After several months of dev, a project could easily become ugly, probablly contains many used resources files(like pngs). It is easy to remove images that you know they are not using anymore, but that's not working for these looks unfamiliar. So i need to check their existence, it's simple to do a search in xcode, but xcode doesn't search in the xib files. Here is a line of command you can use in the terminal:
grep -i -r --include=*.xib "text you want to search" /your project's path
This command could search for all files (*.*).
Showing posts with label XCode. Show all posts
Showing posts with label XCode. Show all posts
Feb 22, 2013
Jun 27, 2012
(XCode) How to have lower simulator in Xcode 4.3 of Lion
The Xcode 4.3 does not have a simulator other than 5.1 and 4.3, but sometimes we need to test apps on the lower environment. So here is the trick:
You need to have lower Xcode installation files, and copy the simulator folders to Xcode 4.3.
For exemple:
sudo mv /XCode file/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/ /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/
For exemple:
sudo mv /XCode file/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/ /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/
Jul 28, 2010
(iPhone)How to debug EXC_BAD_ACCESS
In iOS programming, the EXC_BAD_ACCESS happens when application try to access some deallocated objects, but the Debugger Console usually display a simple message of "EXC_BAD_ACCESS", here is an useful solution to track the deallocated object.
- Set NSZombieEnabled = YES. With this argument, console will display a little bit more information, like "method : message sent to deallocated instance ...", sometime we can track the object in the method when it is easy to find.
- Set MallocStackLoggingNoCompact = 1, this argument allow to display alloc history of the object, for example: we got a message "message sent to deallocated instance 0x58448e0", type "info malloc-history 0x58448e0" in the console will display the allocate history of object 0x58448e0, which contains object allocation and deallocation, it is really useful to debug the incorrect release call.
To setup these 2 arguments, you should go to "Project"->"Edit Active Executable project name", add these 2 variables in "Variables to be set in the enviroment", names are "NSZombieEnabled" and "MallocStackLoggingNoCompact", values are "YES" and "1". And check the checkbox to active.
Don't forget remove these variables when you release your application.
- Set NSZombieEnabled = YES. With this argument, console will display a little bit more information, like "method : message sent to deallocated instance ...", sometime we can track the object in the method when it is easy to find.
- Set MallocStackLoggingNoCompact = 1, this argument allow to display alloc history of the object, for example: we got a message "message sent to deallocated instance 0x58448e0", type "info malloc-history 0x58448e0" in the console will display the allocate history of object 0x58448e0, which contains object allocation and deallocation, it is really useful to debug the incorrect release call.
To setup these 2 arguments, you should go to "Project"->"Edit Active Executable project name", add these 2 variables in "Variables to be set in the enviroment", names are "NSZombieEnabled" and "MallocStackLoggingNoCompact", values are "YES" and "1". And check the checkbox to active.
Don't forget remove these variables when you release your application.
May 10, 2010
(iPhone)How to resolve "resources have been modified" when install an adhoc version
It's pretty weird my client has met this problem when he install an adhoc version on his iPhone. Arial Balkan posted a very useful solution, the idea is transforming the application (file .app) to an .ipa file which is executable in the iTunes.
May 6, 2010
(XCode)How to resolve Error: 155015 (A conflict in the working copy obstructs the current operation)
It happens on a file i updated from SCM, the solution i found is:
- Backup current working file.
- Run svn revert in console.
- Backup current working file.
- Run svn revert
Mar 19, 2010
(XCode) How to resolve "Warning: Multiple build commands for output file ..."
Just met a weird warning message in XCode which is "Warning: Multiple build commands for output file ..." after deleting a resource file, and i checked the file does not exist in resource folder any more, finally i found the the file did appear in "targets/app name/copy bundle resources/", than i figure out i accidentally pressed "Delete reference" when i delete the file, and that's why the resource file still exist in the "copy bundle resources" folder
Mar 24, 2009
(XCode) How to setup a bracket / brace macro in XCode
Before i used XCode and learned Objective-C, i never thought the bracket is a horrible symbol, there is a solution of creating text macro to insert bracket / brace:
1. Open ObjectiveC.xctxtmacro with an text editor, you can find this file with this path:
2.Add follow code in the file:
You can create a similar macro for Brace, here is an example:
Update: In the XCode 3.2 which is released for Snow Leopard, the above lines wouldn't work until add this line in each section:
OnlyAtBOL = YES;
1. Open ObjectiveC.xctxtmacro with an text editor, you can find this file with this path:
/Developer/Applications/Xcode.app/Contents/PlugIns/TextMacros.xctxtmacro/Contents/Resources/ObjectiveC.xctxtmacro 2.Add follow code in the file:
{
Identifier = objc.bracket;
BasedOn = objc;
IsMenuItem = YES;
Name = "Bracket Expression";
TextString = "[<#!expression!#>]";
CompletionPrefix = bra;
},This scope create a text macro "bra" to insert "[<#!expression!#>]", you need to type bra in your code and presse "esc" button, there is a window shows "Bracket Expression", press enter "[<#!expression!#>]" will be inserted.You can create a similar macro for Brace, here is an example:
{
Identifier = objc.brace;
BasedOn = objc;
IsMenuItem = YES;
Name = "Brace Expression";
TextString = "{<#!expression!#>}";
CompletionPrefix = bra;
},Here you have a same text macro "bra" to choose bracket or brace.Update: In the XCode 3.2 which is released for Snow Leopard, the above lines wouldn't work until add this line in each section:
OnlyAtBOL = YES;
Oct 8, 2008
(XCode) How to compile a XCode project using command line
XCode has a very useful toll which named xcodebuild, it allows to compile a XCode project by command line, here is an example:
xcodebuild PRODUCT_NAME="AppName"
the PRODUCT_NAME argument is defined in the info.plist of your project which means the application's name, it is also the name showen in your iPhone or simulator.
The xcodebuild command is executed only in the project directory, so you should use it in the right place.
xcodebuild PRODUCT_NAME="AppName"
the PRODUCT_NAME argument is defined in the info.plist of your project which means the application's name, it is also the name showen in your iPhone or simulator.
The xcodebuild command is executed only in the project directory, so you should use it in the right place.
Subscribe to:
Posts (Atom)