Make sure bytesSent is initialized. No need to zero packetLength - it's reset at the top of the loop.
Create a mutable array.
Free the serializedMsg buffer
Update project settings for Xcode 5.0