Try to open your console and go to your Xcode project folder then type these commands:
to clean your project
xcodebuild clean -project YourProjectName.xcodeproj -configuration Release -alltargets
to build and archive your app
xcodebuild archive -project YourProjectName.xcodeproj -scheme YourSchemaName -archivePath YourProjectName.xcarchive
You can simply find YourSchemaName in
Xcode > Product > Scheme > Edit Scheme...
finally to create your app .ipa file
xcodebuild -exportArchive -archivePath YourProjectName.xcarchive -exportPath YourProjectName -exportFormat ipa -exportProvisioningProfile 'Your Provisioning Profile Name'
To find Your Provisioning Profile Name please login to Apple Developer Member Center and go to Certificates, Identifiers & Profiles, then click on Provisioning Profiles for iOS Apps. There you will find Your Provisioning Profile Name.
If it does not work try to replace single quote with double one ( ' with " ).
You will find .ipa file in your Xcode project folder.
After this you will able to open your .ipa file in iTunes and install on your iOS device.
I hope it helps!