iosobjective-csmbfile-browserafp

How to access an AFP or SMB share (e.g. time capsule) in Swift or Obj-C


I am currently developing a tvOS/iPhone app. The goal is to browse my local network and find different devices that publish AFP and SMB shares, and read files from them.

So far I have managed to find and list the different devices in my network (like my time capsule) using NSNetServiceBrowser.

My issue is: How can I access and read the information (e.g. directories or files) of the AFP or SMB shares I found?

I have tried NSFileManager, but from what I found, it is not suitable at all for this task… Any idea on how to achieve this, using an iOS framework or third party library?


Solution

  • I was not able to find an Objective-C or Swift example, but this one is in C.

    Tango library in C

    This seems to be able with NSURLRequest with a smb:// URL, but that might be limited to OS X according to Apple's documentation.