[4.7.2] Failed to find a valid matching mobile provision

Using the 4.7.2 hotfix, I still get an error at the end of my iOS Shipping packaging step. My distribution mobile provisioning profile is valid and it is used successfully the first time during the packaging process just right after

Staging files before copying to Mac ...

But at the end of the packaging process, I get the following:

IPP WARNING: Failed to find a valid matching mobile provision, will attempt to use the embedded mobile provision instead if present
IPP ERROR: Could not find myIOSProject.mobileprovision in D:\UE4\myIOSProject\Build\IOS (error: 'Could not find file 'D:\UE4\myIOSProject\Saved\StagedBuilds\IOS\embedded.mobileprovision'.').  Please follow the setup instructions to get a mobile provision from the Apple Developer site.
IPP ERROR: Application exception: System.IO.FileNotFoundException: Could not find file 'D:\UE4\myIOSProject\Saved\StagedBuilds\IOS\embedded.mobileprovision'.
File name: 'D:\UE4\myIOSProject\Saved\StagedBuilds\IOS\embedded.mobileprovision'
   at iPhonePackager.CodeSignatureBuilder.GetMobileProvision(String CFBundleIdentifier) in d:\UE4\Engine\Source\Programs\IOS\iPhonePackager\CodeSigning.cs:line 191
   at iPhonePackager.CodeSignatureBuilder.LoadMobileProvision(String CFBundleIdentifier) in d:\UE4\Engine\Source\Programs\IOS\iPhonePackager\CodeSigning.cs:line 196
   at iPhonePackager.CodeSignatureBuilder.PrepareForSigning() in d:\UE4\Engine\Source\Programs\IOS\iPhonePackager\CodeSigning.cs:line 613
   at iPhonePackager.CookTime.RepackageIPAFromStub() in d:\UE4\Engine\Source\Programs\IOS\iPhonePackager\CookTime.cs:line 287
   at iPhonePackager.Program.Main(String[] args) in d:\UE4\Engine\Source\Programs\IOS\iPhonePackager\iPhonePackager.cs:line 753

However, after copying my distribution profile to D:\UE4\myIOSProject\Saved\StagedBuilds\IOS, renaming it to embedded.mobileprovisioning and running the IPhonePackager command in a Windows cmd, the ipa is successfully packaged. I ran the following command in the cmd:

IPhonePackager.exe RepackageFromStage "D:\UE4\myIOSProject\myIOSProject.uproject" -config Shipping -compress=best -sign -distribution -stagedir "D:\UE4\myIOSProject\Saved\StagedBuilds\IOS" -project "D:\UE4\myIOSProject\myIOSProject.uproject

I guess this is a bug, where the profile is not copied to the specific directory?

Did you import the distribution provision using the Import Provision button in the IOS Project Settings?

We use the development provision for the initial sign and then distribution provision during the final package sign. The log you show implies it tried find the distribution provision but after not finding it we tried to copy it from a fallback location for backwards compatibility and didn’t find it there either.

Anyway try importing from the project settings and see if it works then.

-Pete

Hi Pete,

yes I used the IOS Project Settings to import my distribution provision. However, I only imported my distribution and not my development provision and the initial signing is then made with the distribution provision, too (I checked the UnrealBuildTool.2.txt).

Ok, could you post the full log from the editor of this error? I need to see what’s happening further upstream from the final package.

-Pete

Sure, should have done this when I asked the question… Here are the UnrealBuildTool.2.txt and the IPhonePackager.txt. I replaced some things in the logs like the actual app id and sigining id and stuff.

The IPhonePackager cannot find a correct provisioning profile, however, when I copy an embedded.mobileprovision (my ‘MyProject distribution profile’) in the staging dir just right before the packing process is searching for it, the process finishes without an error. Even using the IPhonePackager.exe to re-sign the ipa works. But no matter what I do, when uploading it to iTunes Connect, I get an invalid binary error. In the mail from ITunes Connect it says Invalid Signature - Make sure you have signed your application with a distribution certificate, not an ad hoc certificate or a development certificate.

I really need to get the app uploaded to the app store, hopefully you can tell where I am mistaken.

Ok, I think I know what the problem is. When you made your distribution provision, did you select Ad Hoc instead of App Store? I believe this is the case because the IPP log is telling me your distribution provision has two devices specified in it. This is indicative of an Ad Hoc distribution provision which is not the right kind of provision for attempting to upload to the App Store. You will need to generate an App Store provision from developer.apple.com, import that via the Project Settings, and then it should work and you should be able to upload to the store as well.

-Pete

Hi Pete, thanks for your reply. Wow this really would be a stupid error by me. I re-generated a distribution profile for the AppStore now and will package the whole thing. In 2h I will know the result.

When you import the new provision, import it as a different filename (for example, Distro_MyProject.mobileprovision), that way your original Ad Hoc provision will still be there for use in the future.

-Pete

Signing now works correct, thanks for that! Unfortunately I get the same invalid signature error from iTunes Connect. I am 100% sure I have an AppStore distribution profile. Here is the [IPhonePackager.txt][1] just in case…

edit:

I attacked a screenshot from the project settings and one from developer.apple.com.

,

Ya, that looks correct. The Invalid Signature error was seen in the past, but a fix was added which should be in 4.7.2. Just to be sure, did you upload the GameFolder\Binaries\IOS\Distro_Game-IOS-Shipping.ipa?

-Pete

hmm… I guess there is another possible way of getting that bug then. In the meantime, do you have access to a Mac and the editor? You can run your project through File | Package there and it will use Xcode to do the final code sign and should get you past this issue for the time being while I see if I can figure out the problem with PC code signing.

Also, can you private message me your MyProject.stub? It should be in your Game/Binaries/IOS directory. If you can, I can try to re-sign it here in a debugger and see if I can figure out what is going on. I won’t be able to run it as it won’t have content, so your IP should be safe and I don’t plan on running it anyway, just want to get the bug fixed and I suspect it is another Mach-O header issue which I should be able to figure out from the debugger :slight_smile:

-Pete

I uploaded the file from another directory which I whoose with the “Browse For Folder” dialog of File > Package Project > IOS

I now uploaded the the file D:\UE4\MyProject\Binaries\IOS\Distro_MyProject-IOS-Shipping.ipa and got the same itunes connect error (I had to increase the CFBundleVersion in the plist and re-sign with the IPhonePackager.exe using the app store distribution provision in order to upload a new build with the application loader)

edit:

I am using 4.7.2

Unfortunately no, for now I am kinda stuck on my Windows machine. I am sending you a private message through the UE Forum in a minute.Thanks for investigating this issue.

Nevermind, I see where you sent it :slight_smile:

-Pete

Hi trutty,

Could you try making an IPA with just armv7 and arm64? That may be the issue as I don’t believe we have ever tested all three architectures. I’m still going to figure out what is going on, but that might solve your issue for now.

-Pete

I am doing that right now. I ticked the armv7s checkbox because I want to support the iPad 4 (and iPad 3 retina apparently; reference iOS device architectures and iOS device matrix). I am coming back when packaging is complete

Ok, I ran through the code signing and everything looks ok. Putting the universal binary on my mac, the tools there show it to be a valid binary for the three architectures. When I do the same thing with the 4.6 version of IPP, then it shows me the 64-bit architecture is not found correctly which is what was happening when the bug occurred. Could you crack open the Distro_XXXX.ipa and get the executable and send that to me over message? I will compare it to what my signing did and see if there is a difference.

-Pete

alright, sent you the message

Sounds very strange. I use the Application Loader 3.0 (downloaded from iTunes Connect here) on a MacBook. I just follow the normal process of selecting the ipa and clicking through each step. At the end I get a warning stating The resulting API analysis file is too large. We were unable to validate your API usage prior to delivery. This is just an informational message., after that I hit send and a few minutes later I get the said mail saying Invalid Signature

The armv7, arm64 package is nearly finished…

Edit:

Just to rule that out: I am sure that I am uploading the correct ipa file, because the CFBundleVersion string in the plist and on in iTunes Connect are the same.

Update:
With the armv7, arm64 package, I get the following errors:

 Minimum OS Version Mismatch - The minimum OS version (LC_VERSION_MIN_IPHONEOS) in the binary ('6.1') for architecture ('armv7') differs from the MinimumOSVersion ('8.0') in the Info.plist.

Minimum OS Version Mismatch - The minimum OS version (LC_VERSION_MIN_IPHONEOS) in the binary ('7.0') for architecture ('arm64') differs from the MinimumOSVersion ('8.0') in the Info.plist. 

I don’t want to support iOS versions < 8.0

So your signed binary is different from mine, probably because we used different provisions and certificates. However, the mac tools “lipo” and “file” both show your binary as being a valid universal binary with three architectures in it, so I think the signing is fine at this point. I’m not sure why it is failing to upload. How are you uploading it to the App Store? As far as I know, you need to upload it via the Application Loader on a Mac. Maybe that is the issue?

-Pete