I can build and run my app on my device, but when I tried to build archive, I got many errors. The errors are about my 3rd library - google protobuf. It showed that #error H
For me the problem was that the scheme for "Archive" was different than the scheme for "Run". When i switched "Archive" to use DEBUG instead of RELEASE it worked.