What does the property “Nonatomic” mean?

Take a look at the Apple Docs. Basically, if you say nonatomic, and you generate the accessors using @synthesize, then if multiple threads try to change/read the property at once, badness can happen. You can get partially-written values or over-released/retained objects, which can easily lead to crashes. (This is potentially a lot faster than an … Read more

What’s the difference between “bundle display name” and “bundle name” in cocoa application’s info plist

I don’t think any of the other answers concisely answers the question. CFBundleDisplayName – displayed: below icon. According to docs, should be localized, but only if the app itself is localized, otherwise there will be some kind of penalty (if this is true in reality I cannot say) CFBundleName – displayed: I have no idea. … Read more

How does an underscore in front of a variable in a cocoa objective-c class work?

If you use the underscore prefix for your ivars (which is nothing more than a common convention, but a useful one), then you need to do 1 extra thing so the auto-generated accessor (for the property) knows which ivar to use. Specifically, in your implementation file, your synthesize should look like this: @synthesize missionName = … Read more

How to initialise a string from NSData in Swift

This is the implemented code needed: in Swift 3.0: var dataString = String(data: fooData, encoding: String.Encoding.utf8) or just var dataString = String(data: fooData, encoding: .utf8) Older swift version: in Swift 2.0: import Foundation var dataString = String(data: fooData, encoding: NSUTF8StringEncoding) in Swift 1.0: var dataString = NSString(data: fooData, encoding:NSUTF8StringEncoding)

What is the best way to solve an Objective-C namespace collision?

Prefixing your classes with a unique prefix is fundamentally the only option but there are several ways to make this less onerous and ugly. There is a long discussion of options here. My favorite is the @compatibility_alias Objective-C compiler directive (described here). You can use @compatibility_alias to “rename” a class, allowing you to name your … Read more

How to convert CFStringRef to NSString?

NSString and CFStringRef are “Toll free bridged”, meaning that you can simply typecast between them. For example: CFStringRef aCFString = (CFStringRef)aNSString; works perfectly and transparently. Likewise: NSString *aNSString = (NSString *)aCFString; The previous syntax was for MRC. If you’re using ARC, the new casting syntax is as follows: NSString *aNSString = (__bridge NSString *)aCFString; works … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)