I had this problem when I used a Distribution certificate instead of Developer one when running the app from Xcode. You may check it out your target –> Build Settings –> Code signing.
As @AndyDynn pointed out in his comment:
Make sure you do this on the “Target” build settings and not just the “Project” build settings.