@@ -3,6 +3,7 @@ package imagemounter
33import (
44 "errors"
55 "fmt"
6+ "github.com/Masterminds/semver"
67 "github.com/danielpaulus/go-ios/ios"
78 log "github.com/sirupsen/logrus"
89 "io"
@@ -16,17 +17,23 @@ const serviceName string = "com.apple.mobile.mobile_image_mounter"
1617type Connection struct {
1718 deviceConn ios.DeviceConnectionInterface
1819 plistCodec ios.PlistCodec
20+ version * semver.Version
1921}
2022
2123//New returns a new mobile image mounter Connection for the given DeviceID and Udid
2224func New (device ios.DeviceEntry ) (* Connection , error ) {
25+ version , err := ios .GetProductVersion (device )
26+ if err != nil {
27+ return nil , err
28+ }
2329 deviceConn , err := ios .ConnectToService (device , serviceName )
2430 if err != nil {
2531 return & Connection {}, err
2632 }
2733 return & Connection {
2834 deviceConn : deviceConn ,
2935 plistCodec : ios .NewPlistCodec (),
36+ version : version ,
3037 }, nil
3138}
3239
@@ -56,9 +63,13 @@ func (conn *Connection) ListImages() ([][]byte, error) {
5663 if ok {
5764 return nil , fmt .Errorf ("device error: %v" , deviceError )
5865 }
66+
5967 signatures , ok := resp ["ImageSignature" ]
6068 if ! ok {
61- return nil , fmt .Errorf ("invalid response: %+v" , signatures )
69+ if conn .version .LessThan (semver .MustParse ("14.0" )) {
70+ return [][]byte {}, nil
71+ }
72+ return nil , fmt .Errorf ("invalid response: %+v" , resp )
6273 }
6374
6475 array , ok := signatures .([]interface {})
0 commit comments