Saturday, July 6, 2013

[Xcode] Newbie Pitfall

As an former ActionScript coder who's try to have fun with Xcode. I love to jump on to some example and get dirty. The fancy part of this fun is many example out there is not working properly due to plenty of deprecated and version conflicted.

Lucky us, we have google and stack overflow to help us get through this mess, but many time I realize that I've to try many random thread to get working answer (some is in random comment and not mark as an answer!) so I think I better collect my pitfall here for later reference.

Problem : Unknown class MyClass in Interface Builder file.
Cause : rename FooViewController -> BarViewController
Solution : click Foo.xib -> Click at Identity Inspector -> make sure it has correct new name

Problem : clang: warning: argument unused during compilation: '-stdc++'
Cause : Tesseract...

Problem : Xcode hangs "Attaching to (app name)" and throw "invalid host string: 'localhost'" when try to run and connect to simulator
Cause : XAMPP mess with hosts file and Xcode doesn't seem to like it.
Solution : sudo nano /private/etc/hosts and make sure it look like this... localhost broadcasthost ::1 localhost fe80::1%lo0 localhost
Related :

Problem : Can't move/organize/refactoring physical folder like Eclipse.
Cause : Xcode is stupid.
Solution : Bear with it.
Related :

Problem : Can't find all references within a workspace like Eclipse. (Ctrl+Shift+G)
Cause : Xcode is stupid.
Solution : Bear with it, Select target function -> Right Click -> Jump to definition -> Search for definition (Yeah 4 step vs 1 shortcut)

Problem : Plenty of error after change project name.
Cause : Xcode is stupid.
Solution : Drag whole project folder to Sublime -> Find and Replace in file manually what Xcode forget to change for you. (yeah, I know WTF)

Problem : Could not change executable permissions on the application
Cause : Xcode is stupid, It just didn't know what to do if we change bundle identifier
Solution : Delete app related to bundle identifier on target device.
Related :

Problem : Keyboard shortcut to find the currently selected text
Cause : Xcode is awkward, In eclipse we use shortcut like a boss...all things f..up in Xcode
Solution : Use Cmd +E then Cmd+G
Related :

Problem : Can't organize import
Cause : Xcode is stupid
Solution : Bear with it, or buy AppCode
Related :

Note to self

Objective-C Literals : Suffer from [[[[wow][[lol][wtf]][whyIhaveToTypeValueBeforeKey]][oh]]]? try this or instead.

Simulator document path
: /Users/katopz/Library/Application Support/iPhone Simulator/6.1/Applications/SOME_RANDOM_LOL_GO_HERE/Documents/

more to come I bet! ;p

PS : Don't worry next blog will be AS3 related, AIR is not dead yet! ;)

Post a Comment