Unified Contacts

06 February, 2014

Problem of declaring CF Object as property in NS Object

Error message when analyze: incorrect decrement of the reference count of an object that is not owned

If the CF Object is declared as a property in a NS Object, the compiler is not able to determine whether the property is still being referencing by other method. In my case, I declared ABAddressBookRef as a property in a NS Object.

@interface AddressBookManager : NSObject

@property ABAddressBookRef addressBook;

The problem has been solved by changing property to instance variable

@interface AddressBookManager : NSObject {
    ABAddressBookRef addressBook;
}

16 November, 2013

[Question] UIScrollView doesn't work in Storyboard

I cannot make UIScrollView work when I add some components into it using Storyboard with auto layout turned on. So, I now add all components by code.

Does anyone know how to fix it? Thanks~

12 September, 2013

Common Mistake: initWithCoder VS viewDidLoad

One of the common mistake is that initializing objects/variables in viewDidLoad method. However, the best place to initialize objects/variables in ViewController is initWithCoder. When creating new files of UIViewController, they do not contain this method, therefore type this method manually in .h and .m file.

Difference:
initWithCoder is called when using Storyboard which initialize ViewController object. Usually used to initialize objects/variables.
viewDidLoad is called when it is loaded into memory and it only happens once. Usually used to instantiate objects/variables.

09 September, 2012

Let's get started

I have planned to write some apps for smartphone for a long time. I have so many ideas in my mind, and I think it's the time to start. I would like to record my learning journey and share to everyone.