I am running creating an iPhone application which performs a costly operation and I wanted to create an activityIndicator to let the user know the application has not frozen
Yes, you need to put your operation in a separate thread while the UIActivityIndicatorView calls remain on the main thread.
Here's why: If you start animating your indicator view then immediately begin your process, your process will block until finished, and the user will never see any "activity."
Instead, start animating the indicator, then pop a new thread for your process. Use notifications, a delegate pattern, or performSelectorOnMainThread:withObject:waitUntilDone:
to let the main thread know that the process is finished. Then stop the animation and continue.
This will ensure that the user knows something is happening while your process does its thing.