I want to create an ipa file but I get the following error message. Maybee someone knows what's going on here? Or just a hint where the error might be.

Sometimes it may happen that Xcode Archiver fails to generate ipa file. Then here is the another option.
Thats it.
Reverse procedure is used to retrieve the app file from an ipa file.
Hope this answer helps.
Check to make sure you have changed your Code Signing Identity to a Distribution profile, rather than your Developer profile cert. You need to explicitly create a Distribution cert in the provisioning areas of the Apple Developer website.
Here are two links that are pretty helpful, first and second.