Fix deprecated call to `lock` for iOS 8

Uses `-performBlockAndWait:` for iOS 8; `-lock` otherwise.