From 4d2f0e19cb47dc422560f8f068910080b40fa76e Mon Sep 17 00:00:00 2001 From: zemanj Date: Thu, 24 Jul 2025 13:28:49 +0200 Subject: [PATCH] Replace VendContainer by VendDocuments to fix fsync command with --app option. --- ios/afc/fsync.go | 24 ++++++++++++------------ ios/house_arrest/house_arrest.go | 2 +- main.go | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ios/afc/fsync.go b/ios/afc/fsync.go index eff493aa..4ce19c80 100644 --- a/ios/afc/fsync.go +++ b/ios/afc/fsync.go @@ -50,24 +50,24 @@ func New(device ios.DeviceEntry) (*Connection, error) { return &Connection{deviceConn: deviceConn}, nil } -func NewContainer(device ios.DeviceEntry, bundleID string) (*Connection, error) { +func NewVendDocuments(device ios.DeviceEntry, bundleID string) (*Connection, error) { deviceConn, err := ios.ConnectToService(device, "com.apple.mobile.house_arrest") if err != nil { return nil, err } - err = VendContainer(deviceConn, bundleID) + err = VendDocuments(deviceConn, bundleID) if err != nil { return nil, err } return &Connection{deviceConn: deviceConn}, nil } -func VendContainer(deviceConn ios.DeviceConnectionInterface, bundleID string) error { +func VendDocuments(deviceConn ios.DeviceConnectionInterface, bundleID string) error { plistCodec := ios.NewPlistCodec() - vendContainer := map[string]interface{}{"Command": "VendContainer", "Identifier": bundleID} - msg, err := plistCodec.Encode(vendContainer) + vendDocuments := map[string]interface{}{"Command": "VendDocuments", "Identifier": bundleID} + msg, err := plistCodec.Encode(vendDocuments) if err != nil { - return fmt.Errorf("VendContainer Encoding cannot fail unless the encoder is broken: %v", err) + return fmt.Errorf("VendDocuments encoding cannot fail unless the encoder is broken: %v", err) } err = deviceConn.Send(msg) if err != nil { @@ -81,8 +81,8 @@ func VendContainer(deviceConn ios.DeviceConnectionInterface, bundleID string) er return checkResponse(response) } -func checkResponse(vendContainerResponseBytes []byte) error { - response, err := plistFromBytes(vendContainerResponseBytes) +func checkResponse(vendDocumentsResponseBytes []byte) error { + response, err := plistFromBytes(vendDocumentsResponseBytes) if err != nil { return err } @@ -92,11 +92,11 @@ func checkResponse(vendContainerResponseBytes []byte) error { if response.Error != "" { return errors.New(response.Error) } - return errors.New("unknown error during vendcontainer") + return errors.New("unknown error during VendDocuments") } -func plistFromBytes(plistBytes []byte) (vendContainerResponse, error) { - var vendResponse vendContainerResponse +func plistFromBytes(plistBytes []byte) (vendDocumentsResponse, error) { + var vendResponse vendDocumentsResponse decoder := plist.NewDecoder(bytes.NewReader(plistBytes)) err := decoder.Decode(&vendResponse) @@ -106,7 +106,7 @@ func plistFromBytes(plistBytes []byte) (vendContainerResponse, error) { return vendResponse, nil } -type vendContainerResponse struct { +type vendDocumentsResponse struct { Status string Error string } diff --git a/ios/house_arrest/house_arrest.go b/ios/house_arrest/house_arrest.go index 605d5c0c..7e72daef 100644 --- a/ios/house_arrest/house_arrest.go +++ b/ios/house_arrest/house_arrest.go @@ -22,7 +22,7 @@ func New(device ios.DeviceEntry, bundleID string) (*Connection, error) { if err != nil { return &Connection{}, err } - err = afc.VendContainer(deviceConn, bundleID) + err = afc.VendDocuments(deviceConn, bundleID) if err != nil { return &Connection{}, err } diff --git a/main.go b/main.go index ea240dc6..97c7cfec 100644 --- a/main.go +++ b/main.go @@ -1091,7 +1091,7 @@ The commands work as following: if containerBundleId == "" { afcService, err = afc.New(device) } else { - afcService, err = afc.NewContainer(device, containerBundleId) + afcService, err = afc.NewVendDocuments(device, containerBundleId) } exitIfError("fsync: connect afc service failed", err) b, _ = arguments.Bool("rm")