objective c - How to read from usb mass storage device when AppSand box is enabled -
in app, when user connects usb device (phone), use nsworkspacedidmountnotification
notify user device detected performing nsalert
.
if accepted, app proceed copy(read) text file contents device. worked fine until enabled appsandbox. have enabled usb entitlement when app tries copy, following error.
error reading content of file: error domain=nscocoaerrordomain code=257 "the file “office.txt” couldn’t opened because don’t have permission view it." userinfo={nsfilepath=/volumes/officedrive//documents/office.txt, nsunderlyingerror=0x600000049390 {error domain=nsposixerrordomain code=1 "operation not permitted"}}
is possible read usb device if appsandbox enabled.
you can access files user explicitly grants access if you're sandboxed:
user-specified files. sandboxed app (with appropriate entitlement) automatically obtains access files in arbitrary locations when files explicitly opened user or dragged , dropped onto application user.
so you'd have open file dialog (probably pointing location you've figured out notification) , have user pick in order gain access.
remotely related post:
Comments
Post a Comment