iOS Build Environment Help Center

Diverging package structure when reading in the ipa from builder

append delete Tom_LeFx

Windows 11
Builder 3.58
iOS SDK 16.2

I have the issue, that one of our corporate clients uses a custom Enterprise AppStore to deploy the iOS Apps that we create for them. You upload the app to their portal and they unpack it, read the information from the info.plist and then pack/resign the whole thing with their enterprise provision.

The issue now is, that the apps built with the iOS package builder behave differently when being decompressed by the rubyzip libary in use than the XCode built apps.

We figured that out in detail - the current ipas from the builder don't show their full parent-folder structure, allthough when upacking with 7zip on windows, you get all the folders and the apps themselves are valid.

I assume, that there is some weird header/metadata issue - and we can solve it so far, by manually unpacking the built ipa and then repacking it with 7zip afterwards. Then the package behaves identical to the one built with XCode.
We assume, that the current packaging library in use by the iOS project builder has some setting, that makes it diverge from the original XCode archiving process.

It's not a deal breaker, as we do have a working work-around (which feels super silly) - but it could be looked into, to make the IPAs more identical to the ones that XCode creates.

To debug this:
install Ruby and import the package (called gems in Ruby) rubyzip (https://github.com/rubyzip/rubyzip) - and simply run this ruby short ruby-script:

require 'zip'

Zip::File.open('PATH_TO_IPA') do |zip_file|
# Handle entries one by one
zip_file.each do |entry|
puts entry
end
end

You will see, that an ipa created by the builder does not output any "Parent folder" structure (like /Payload/) but only the full path to the content files /Payload/appname.app/filename.xyz)

Reply RSS

Replies

append delete #1. Pierre-Marie Baty

Hello Tom, and thank you for reporting.

That's a curious one. What do you mean exactly with "the current ipas from the builder don't show their full parent-folder structure" ? Do you mean there should be empty entries for directories, is that right ?

The IPA packager "makeipa.exe" uses libzip to create these files. Indeed I don't use this call at all : https://libzip.org/documentation/zip_dir_add.html
Instead I just add the files with their paths. I never quite understood the need for those directory entries in zip files before as I was assuming the arborescence could already be reconstructed from the files' paths, but now I realize these entries are the only way to "store" an empty directory.

I'll modify my IPA creation tool so that it creates those directory entries in the next version.

:: @Pierre-Marie Baty added on 13 Jul ’23 · 11:59

*edit* I've done a quick build of makeipa.exe with the zip_dir_add() calls in the appropriate place: https://www.pmbaty.com/iosbuildenv/makeipa.zip

Would you mind testing it and report whether it solves your problem ? Thanks in advance for your feedback.

append delete #2. Tom_LeFx

Yes, correct. There should be empty entries for the parent/root folders. I get your point, that it feels pointless - and I would have agreed with your assumption. But seemingly it has its importance for some reason.

I'll try the new build you created asap and let you know, if it solves the issue. Thank you for your fast respone.

:: @Tom_LeFx added on 17 Jul ’23 · 10:23

edit:
Can't download the makeIPA zip from you - the link is not working for me

:: @Tom_LeFx added on 17 Jul ’23 · 10:24

User stupid - please ignore. It worked

append delete #3. Tom_LeFx

I tested your new makeIPA - it actually turns things worse.

The official old state was:

Payload/LC-Pro-AR.app/Assets.car
Payload/LC-Pro-AR.app/Data/boot.config
Payload/LC-Pro-AR.app/Data/globalgamemanagers
Payload/LC-Pro-AR.app/Data/globalgamemanagers.assets
Payload/LC-Pro-AR.app/Data/globalgamemanagers.assets.resS
Payload/LC-Pro-AR.app/Data/level0
Payload/LC-Pro-AR.app/Data/Managed/Metadata/global-metadata.dat
Payload/LC-Pro-AR.app/Data/Managed/mono/4.0/machine.config
...

What we would need is (and what XCode/7zip output):

Payload/
Payload/LC-Pro-AR.app/
Payload/LC-Pro-AR.app/Assets.car
Payload/LC-Pro-AR.app/Data/boot.config
Payload/LC-Pro-AR.app/Data/globalgamemanagers
Payload/LC-Pro-AR.app/Data/globalgamemanagers.assets
Payload/LC-Pro-AR.app/Data/globalgamemanagers.assets.resS
Payload/LC-Pro-AR.app/Data/level0
Payload/LC-Pro-AR.app/Data/Managed/Metadata/global-metadata.dat
Payload/LC-Pro-AR.app/Data/Managed/mono/4.0/machine.config
...

What your current version outputs:

LC-Pro-AR.app/
Payload/LC-Pro-AR.app/Assets.car
LC-Pro-AR.app/Data/
Payload/LC-Pro-AR.app/Data/boot.config
Payload/LC-Pro-AR.app/Data/globalgamemanagers
Payload/LC-Pro-AR.app/Data/globalgamemanagers.assets
...

It messes up the data structure and actually generates. It also creates a parallel folder structure:

There is now a "Payload/" as root and an "LC-Pro-AR.app/" on root level - while it should just be "Payload/"

append delete #4. Pierre-Marie Baty

I have goofed something: the folder names don't have the Payload/ prefix. Very sorry. Let me fix that.

But your feedback is intriguing in that I see that *not all the directory entries are needed*. I see that Xcode/7zip show directory entries for "Payload/" and "Payload/LC-Pro-AR.app/" for example (both entries that contain files), but not for "Payload/LC-Pro-AR.app/Data" (which *also* contains files). What's the logic ?

:: @Pierre-Marie Baty added on 18 Jul ’23 · 12:26

*edit* binary updated, same URL. Can you please try this new one ?

append delete #5. Tom_LeFx

I somehow can't download it - Windows antivirus prevents it - it worked before. Don't know why it acts up so much now.

Can you pack it into an encrypted archive or smth.?

append delete #6. Tom_LeFx

Made a built - looks good so far. Sent it for final verification, but it seems to have fixed the issue.
The original XCode Package does create folder-entries for "Payload/LC-Pro-AR.app/Data" and all other folders - just further down - it is by no means a sorted list either :-/

Thanks for your efforts by the way!

Also:
Windows Defender recognizes the makeipa.exe of your latest build falsly as a trojan with signature Win32/Phonzy.B!ml
Just so you are aware of that.

append delete #7. Pierre-Marie Baty

Thank you for reporting. I'll have to make my software approved, probably by signing each executable. So far only the installer was signed. I wanted to avoid that because signing each bit slows down the rebuild of the whole toolchain a lot. But I understand that nowadays so many malware were put in circulation that it's becoming a chance when a legitimate build of one's software doesn't hit a random hash that's stored in the virus scanner databases. Still, they could *at least* make the effort to scan the file for real and discover that there's not a single network API call in this executable !

append delete #8. Tom_LeFx

@Pierre-Marie Baty: I updated to the most current 3.60.2 and the problem is back, because the structure change seemingly was not migrated to the build? Do you have plans to put this into an official release? I would really appreciate it, because for now we are back to the workaround of creating the ipa, unzipping and rezipping it...

append delete #9. Pierre-Marie Baty

Er, I don't understand. The "makeipa" tool hasn't changed since that date. Here's what it says on a dummy app I just generated (the app is called "IOS TEST Swift Support"):

% 7-zip "l" output

Z:\Downloads\Builder Xcode\Packages>"C:\Program Files\7-Zip\7z.exe" l "IOS TEST Swift Support.ipa"

7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21

Scanning the drive for archives:
1 file, 6736954 bytes (6580 KiB)

Listing archive: IOS TEST Swift Support.ipa

--
Path = IOS TEST Swift Support.ipa
Type = zip
Physical Size = 6736954

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2023-11-23 12:53:12 D....            0            0  Payload
2023-11-23 12:53:12 D....            0            0  Payload\IOS TEST Swift Support.app
2023-11-23 12:53:13 .....        77376         6063  Payload\IOS TEST Swift Support.app\IOS TEST Swift Support
2023-11-23 12:53:12 D....            0            0  Payload\IOS TEST Swift Support.app\_CodeSignature
2023-11-23 12:53:13 .....        13491         3705  Payload\IOS TEST Swift Support.app\_CodeSignature\CodeResources
2023-11-23 12:53:09 .....          913          913  Payload\IOS TEST Swift Support.app\Icon.png
2023-11-21 03:13:34 .....          128          114  Payload\IOS TEST Swift Support.app\LaunchScreen-iPhonePortrait.png
2023-11-21 03:13:34 .....          128          114  Payload\IOS TEST Swift Support.app\LaunchScreen-iPhoneLandscape.png

2023-11-23 12:53:10 .....         2337         2257  Payload\IOS TEST Swift Support.app\Icon-120.png
2023-11-23 12:53:10 .....          348          348  Payload\IOS TEST Swift Support.app\Icon-Small.png
2023-11-23 12:53:10 .....         3976         3800  Payload\IOS TEST Swift Support.app\Icon-144.png
2023-11-23 12:53:10 .....         1609         1581  Payload\IOS TEST Swift Support.app\Icon-76.png
2023-11-23 12:53:09 .....          993          993  Payload\IOS TEST Swift Support.app\Icon-60.png
2023-11-23 12:53:10 .....          473          473  Payload\IOS TEST Swift Support.app\Icon-Notification@2x.png
2023-11-23 12:53:10 .....         2538         2310  Payload\IOS TEST Swift Support.app\Icon-152.png
2023-11-23 12:53:10 .....         3297         3053  Payload\IOS TEST Swift Support.app\Icon-180.png
2023-11-23 12:53:10 .....          993          993  Payload\IOS TEST Swift Support.app\Icon-Notification@3x.png
2023-11-23 12:53:10 .....         1163         1162  Payload\IOS TEST Swift Support.app\Icon-72.png
2023-11-21 03:13:34 .....          128          114  Payload\IOS TEST Swift Support.app\LaunchScreen-iPad.png
2023-11-23 12:53:10 .....         2606         2538  Payload\IOS TEST Swift Support.app\Icon@2x.png
2023-11-23 12:53:12 D....            0            0  Payload\IOS TEST Swift Support.app\LaunchScreen-iPad.storyboardc
2023-11-23 12:53:10 .....          971          611  Payload\IOS TEST Swift Support.app\LaunchScreen-iPad.storyboardc\UI
ViewController-UnityLaunchScreen-ViewController.nib
2023-11-23 12:53:10 .....         2324         1302  Payload\IOS TEST Swift Support.app\LaunchScreen-iPad.storyboardc\Un
ityLaunchScreen-ViewController-view-UnityLaunchScreen-RootView.nib
2023-11-23 12:53:10 .....          552          265  Payload\IOS TEST Swift Support.app\LaunchScreen-iPad.storyboardc\In
fo.plist
2023-11-23 12:53:09 .....        65576        34219  Payload\IOS TEST Swift Support.app\Assets.car
2023-11-23 12:53:10 .....         3069         2815  Payload\IOS TEST Swift Support.app\Icon-167.png
2023-11-23 12:53:10 .....          216          214  Payload\IOS TEST Swift Support.app\Icon-Notification.png
2023-11-23 12:53:12 D....            0            0  Payload\IOS TEST Swift Support.app\LaunchScreen-iPhone.storyboardc
2023-11-23 12:53:10 .....          971          611  Payload\IOS TEST Swift Support.app\LaunchScreen-iPhone.storyboardc\
UIViewController-UnityLaunchScreen-ViewController.nib
2023-11-23 12:53:10 .....         2334         1311  Payload\IOS TEST Swift Support.app\LaunchScreen-iPhone.storyboardc\
UnityLaunchScreen-ViewController-view-UnityLaunchScreen-RootView.nib
2023-11-23 12:53:10 .....          552          265  Payload\IOS TEST Swift Support.app\LaunchScreen-iPhone.storyboardc\
Info.plist
2023-11-23 12:53:10 .....         2142         2104  Payload\IOS TEST Swift Support.app\Icon-Small-100.png
2023-11-23 12:53:10 .....         1860         1847  Payload\IOS TEST Swift Support.app\Icon-Small@3x.png
2023-11-23 12:53:10 .....          713          713  Payload\IOS TEST Swift Support.app\Icon-Small-50.png
2023-11-23 12:53:12 D....            0            0  Payload\IOS TEST Swift Support.app\Frameworks
2023-11-23 12:53:12 D....            0            0  Payload\IOS TEST Swift Support.app\Frameworks\UnityFramework.framew
ork
2023-11-23 12:53:12 D....            0            0  Payload\IOS TEST Swift Support.app\Frameworks\UnityFramework.framew
ork\_CodeSignature
2023-11-23 12:53:13 .....         1798          422  Payload\IOS TEST Swift Support.app\Frameworks\UnityFramework.framew
ork\_CodeSignature\CodeResources
2023-11-23 12:52:48 .....          807          580  Payload\IOS TEST Swift Support.app\Frameworks\UnityFramework.framew
ork\Info.plist
2023-11-23 12:53:13 .....     13642256      5591486  Payload\IOS TEST Swift Support.app\Frameworks\UnityFramework.framew
ork\UnityFramework
2023-11-21 18:47:01 .....        12100         7683  Payload\IOS TEST Swift Support.app\embedded.mobileprovision
2023-11-23 12:53:12 D....            0            0  Payload\IOS TEST Swift Support.app\Data
2023-11-23 12:53:12 D....            0            0  Payload\IOS TEST Swift Support.app\Data\Managed
2023-11-23 12:53:12 D....            0            0  Payload\IOS TEST Swift Support.app\Data\Managed\Resources
2023-11-21 03:13:33 .....       337563       127732  Payload\IOS TEST Swift Support.app\Data\Managed\Resources\mscorlib.
dll-resources.dat
2023-11-23 12:53:12 D....            0            0  Payload\IOS TEST Swift Support.app\Data\Managed\mono
2023-11-23 12:53:12 D....            0            0  Payload\IOS TEST Swift Support.app\Data\Managed\mono\4.0
2023-11-21 03:13:34 .....        33598         4461  Payload\IOS TEST Swift Support.app\Data\Managed\mono\4.0\machine.co
nfig
2023-11-23 12:53:12 D....            0            0  Payload\IOS TEST Swift Support.app\Data\Managed\Metadata
2023-11-21 03:13:33 .....      1472552       460532  Payload\IOS TEST Swift Support.app\Data\Managed\Metadata\global-met
adata.dat
2023-11-21 03:13:34 .....        65212        30368  Payload\IOS TEST Swift Support.app\Data\globalgamemanagers
2023-11-21 03:13:33 .....          113           99  Payload\IOS TEST Swift Support.app\Data\boot.config
2023-11-21 03:13:34 .....          218          154  Payload\IOS TEST Swift Support.app\Data\RuntimeInitializeOnLoads.js
on
2023-11-23 12:53:12 D....            0            0  Payload\IOS TEST Swift Support.app\Data\Resources
2023-11-21 03:13:34 .....       410576        89091  Payload\IOS TEST Swift Support.app\Data\Resources\unity_builtin_ext
ra
2023-11-21 03:13:34 .....       689096       127157  Payload\IOS TEST Swift Support.app\Data\unity default resources
2023-11-21 03:13:34 .....         2640          560  Payload\IOS TEST Swift Support.app\Data\ScriptingAssemblies.json
2023-11-21 03:13:34 .....         9308         4903  Payload\IOS TEST Swift Support.app\Data\sharedassets0.assets
2023-11-21 03:13:34 .....      1250704        74570  Payload\IOS TEST Swift Support.app\Data\globalgamemanagers.assets.r
esS
2023-11-21 03:13:34 .....       524288        95183  Payload\IOS TEST Swift Support.app\Data\level0.resS
2023-11-21 03:13:34 .....         2020          908  Payload\IOS TEST Swift Support.app\Data\level0
2023-11-21 03:13:34 .....       153760        24132  Payload\IOS TEST Swift Support.app\Data\globalgamemanagers.assets
2023-11-23 12:53:10 .....          473          473  Payload\IOS TEST Swift Support.app\Icon-Small-40.png
2023-11-23 12:53:10 .....         2109         1255  Payload\IOS TEST Swift Support.app\Info.plist
2023-11-23 12:53:10 .....          911          911  Payload\IOS TEST Swift Support.app\Icon-Small@2x.png
2023-11-23 12:53:10 .....            8            8  Payload\IOS TEST Swift Support.app\PkgInfo
2023-11-23 12:53:10 .....         1452         1442  Payload\IOS TEST Swift Support.app\Icon-Small-80.png
------------------- ----- ------------ ------------  ------------------------
2023-11-23 12:53:13           18807339      6720918  52 files, 15 folders

Z:\Downloads\Builder Xcode\Packages>
%

As you can see, the folders are created (these are the entries with the "D" attribute), so the problem must be elsewhere. Are you 100% sure you're not reusing an old version of the tool ?

append delete #10. Tom_LeFx

Well, you sent me the custom MakeIPA. Am I supposed to keep using that custom version or can I use the one, that is shipping with the most current build? I think this is, where the misunderstanding is coming from atm.

append delete #11. Pierre-Marie Baty

The one shipping with version 3.60.2 should be identical to the one I sent you a few months ago, except that it was recompiled since. It might not be binary identical but the source code from which it was recompiled is identical. Don't they produce the same result ?

append delete #12. Tom_LeFx

It seemingly produces different results. We had to do the workaround from before (manually unzipping and rezipping the resulting IPA) to pass the structural checks.
I will run our validation script to check the results of the MakeIPA-Tool in comparison to the repackaged ipa to make sure - I'll get back to you asap

append delete #13. Pierre-Marie Baty

That will be interesting. Thank you in advance.

append delete #14. Tom_LeFx

Ok, it get's weird. I verified the ipa straight from the build pipeline and after re-zipping it with 7zip - the folder-structure is identical in our test-script.
We will verify again with our client if the App-Plattform really, reliably rejects the new output from the project builder. If it does - it has to be in some file-details, we are not understanding yet.

I'll get back to you about it. Thanks for your input.

append delete #15. Pierre-Marie Baty

My 2 cents : if HTTP transport and a browser is involved, it's a browser cache issue. Or some other sort of caching. FWIW.

Reply

(Leave this as-is, it’s a trap!)

There is no need to “register”, just enter the same name + password of your choice every time.

Pro tip: Use markup to add links, quotes and more.

Moderators: Pierre-Marie Baty