diff --git a/CoreFoundation.py b/CoreFoundation.py index af3e643..d737503 100644 --- a/CoreFoundation.py +++ b/CoreFoundation.py @@ -466,7 +466,7 @@ def CFTypeTo(value): bufsize = CFStringGetMaximumSizeForEncoding(l, kCFStringEncodingUTF8) + 1 buf = create_string_buffer(bufsize) CFStringGetCString(value, buf, bufsize, kCFStringEncodingUTF8) - retval = buf.value + retval = buf.value.decode("utf8") elif typeid == CFDataGetTypeID(): retval = string_at(CFDataGetBytePtr(value), CFDataGetLength(value)) diff --git a/afcroot.py b/afcroot.py index e14a182..71c49b9 100644 --- a/afcroot.py +++ b/afcroot.py @@ -28,8 +28,11 @@ class AFCRoot(AFC): def __init__(self, amdevice): - s = amdevice.start_service(u'com.apple.afc2') + try: + s = amdevice.start_service(u'com.apple.afc2') + except RuntimeError: + s = amdevice.start_service(u'com.apple.afc') if s is None: - raise RuntimeError(u'Unable to launch:', u'com.apple.afc2') + raise RuntimeError(u'Unable to launch:', u'com.apple.afc / com.apple.afc2') AFC.__init__(self, s)