I have created an ad-hoc distribution profile. I am trying to load the app to the app store for beta testing only. However, when I run the xcode (using xcode 7) archive it ignores the build settings and switches to the non-ad-hoc distribution profile.
I have read many threads and I am still not clear if
Since you're uploading to the AppStore, you need to use AppStore distribution provisioning profile. You can still use your ad-hoc profile when exporting for ad-hoc deployment. (TestFlight is an integral part of the AppStore now, and is not considered ad-hoc distribution platform anymore...)
From Test Flight Beta Testing:
You should take the following steps to set up prerelease versions of your app for testing in iTunes Connect:
...
Generate a new App Store Distribution profile containing the beta entitlement to distribute builds via TestFlight.
...