Little detail in your question, here is one possible outline which may help:
- Create a semaphore (
dispatch_semaphore_create
) - Execute your library code asynchronously (
dispatch_async
) - Have the completion block for your library code signal the semaphore
- Have your main method wait on the semaphore
HTH