Resource bundles inside PlugIns are treated as app extensions (AltSign.Error 4: Could not find matching provisioning profile)

Aperta
#1,829 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
62/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
ios, swift
Ambito
mobile

Direzione di ricerca

The failing loop is in ResignAppOperation.swift: it walks appBundle.builtInPlugInsURL and calls prepare() on every child Bundle(url:) can open, so the profiles[identifier] guard throws for resource bundles. Read that loop and the existing .xctest skip, then check whether the ALTError cases are thrown from prepare(). Done when non-.appex children such as ClipViewerKitResources.bundle are skipped before the profile lookup and an app with resource bundles in PlugIns resigns without AltSign.Error 4.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

ResignAppOperation.prepareAppBundle treats every direct child of PlugIns as an app extension and requires a provisioning profile for it. Many shipping apps keep resource .bundle packages in PlugIns. Those bundles are not extensions. codesign signs them as part of the parent app, and they do not need their own profile.

AltStore throws ALTError.missingProvisioningProfile during prepare(), before ALTSigner.signApp. Resign never starts.

Observed error

The alert shown by AltStore is:

AltSign.Error 4
Could not find matching provisioning profile.

AltSign.Error 4 is ALTError.missingProvisioningProfile, thrown here:

guard let identifier = bundle.bundleIdentifier else { throw ALTError(.missingAppBundle) }
guard let profile = profiles[identifier] else { throw ALTError(.missingProvisioningProfile) }

The on-device notification looks like this:

Install VK Failed: AltSign.Error 4 — Could not find matching provisioning profile.

This is not a later codesign failure such as 0xe8008015 ("A valid provisioning profile for this executable was not found"). The profile lookup fails inside prepare(), so ALTSigner.signApp is never called.

If CFBundleIdentifier is removed from the resource bundle, the first guard fails instead and the alert becomes ALTError.missingAppBundle ("Could not find app bundle.").

Where it fails

On branch marketplace, ResignAppOperation.swift walks appBundle.builtInPlugInsURL with .skipsSubdirectoryDescendants and calls prepare() on every child that Bundle(url:) can open.

The only child that is skipped is an embedded .xctest bundle, and only in DEBUG. There is no .appex filter.

profiles is keyed by the original bundle identifiers of the app and its real extensions. A resource bundle's CFBundleIdentifier is never in that dictionary, so the second guard always fails with AltSign.Error 4.

Why this is not a codesign requirement

A resource bundle loaded with pathForResource:ofType:inDirectory: is data, not a separate process. Xcode signs it as part of the parent. Only a real .appex (its own executable, its own App ID) needs a provisioning profile.

Two nearby workarounds both fail:

  • Stripping CFBundleIdentifier from the bundle's Info.plist makes bundle.bundleIdentifier nil, so the first guard throws ALTError.missingAppBundle instead of AltSign.Error 4.
  • Deleting the bundles lets resign succeed, but the app crashes at launch if a framework fatalErrors when its resource bundle is missing.

Example: VK App 8.183

Installing this IPA with AltStore reproduces AltSign.Error 4, Could not find matching provisioning profile. Installing the same build with Xcode succeeds, because Xcode does not require a separate profile for resource bundles.

The official VK client IPA has two different kinds of children directly under VK.app/PlugIns:

  • 7 real extensions (.appex): Notification Service, Photo Feed Today, Share, Siri Intents, Start Call Intent, WidgetKit, and VK Broadcast. These are separate processes and do need profiles.
  • 146 resource bundles (.bundle), including ClipViewerKitResources.bundle. These are resource packages. Several frameworks resolve them with pathForResource:ofType:inDirectory: and abort if the bundle file is gone. ClipViewerKit is one of them.

Each of those .bundle directories has an Info.plist with a CFBundleIdentifier, so Bundle(url:) succeeds and prepare() demands a profile. A free or personal team cannot create 146 extra App IDs for resource packages, and those identifiers are not extension App IDs in the first place.

After the 146 .bundle directories were moved out of PlugIns (the bundles themselves were kept, and the in-binary directory name used to find them was updated to the new location), the same IPA resigned and installed. AltSign.Error 4 no longer appeared. That confirms the failure is the PlugIns walk, not the main app's profile, the certificate, or the extension profiles.

Suggested change

Only call prepare() for real app extensions. For example, skip any PlugIns child whose path extension is not appex (the existing .xctest removal can stay). Resource .bundle packages, and any other non-extension child, should be left for the parent signature.

Empty or missing PlugIns already works. The change is to ignore children that are not extensions, instead of requiring a profile for every child Bundle(url:) can open.

Workaround we verified

On the IPA side, move resource .bundle directories out of PlugIns into another directory, and update the path the binary uses to load them. Do not delete the bundles, and do not only delete CFBundleIdentifier. Once PlugIns no longer contains those bundles, AltStore resigns the IPA and AltSign.Error 4 is gone.

Lingua principale
Swift
Stelle
15.1k
Fork
1.8k
Merge medio
5g 16h
PR unite (30g)
1

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di altstoreio/AltStore

Tutte le issue di altstoreio/AltStore

Issue simili

Altre issue su Swift

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.