Swift framework to connect SMB2/3 shares

Related tags

Files swift ios smb smb2
Overview

AMSMB2

This is small Swift library for iOS, macOS and tvOS which wraps libsmb2 and allows to connect a SMB2/3 share and do file operation.

Swift Version Platform License

Build Status Release version CocoaPods version Carthage compatible

Install

Cocoapods / Carthage

Add this line to your pods file:

pod "AMSMB2"

Or add this to Cartfile:

github "amosavian/AMSMB2"

Manually

To have latest updates with ease, use this command on terminal to get a clone:

git clone https://github.com/amosavian/AMSMB2

You can update your library using this command in AMSMB2 folder:

git pull

if you have a git based project, use this command in your project's directory to add this project as a submodule to your project:

git submodule add https://github.com/amosavian/AMSMB2

Then drop AMSMB2.xcodeproj to you Xcode workspace and add the framework to your Embeded Binaries in target.

Usage

Just read inline help to find what each function does. It's straightforward. It's thread safe and any queue.

To do listing files in directory and file operations you must use this template:

import AMSMB2

class SMBClient {
    /// connect to: `smb://[email protected]/share`
    
    let serverURL = URL(string: "smb://XXX.XXX.XX.XX")!
    let credential = URLCredential(user: "guest", password: "", persistence: URLCredential.Persistence.forSession)
    let share = "share"
    
    lazy private var client = AMSMB2(url: self.serverURL, credential: self.credential)!
    
    private func connect(handler: @escaping (Result<AMSMB2, Error>) -> Void) {
        // AMSMB2 can handle queueing connection requests
        client.connectShare(name: self.share) { error in
            if let error = error {
                handler(.failure(error))
            } else {
                handler(.success(self.client))
            }
        }
    }
    
    func listDirectory(path: String) {
        connect { result in
            switch result {
            case .success(let client):
                client.contentsOfDirectory(atPath: path) { result in
                    switch result {
                    case .success(let files):
                        for entry in files {
                            print("name:", entry[.nameKey] as! String,
                                  ", path:", entry[.pathKey] as! String,
                                  ", type:", entry[.fileResourceTypeKey] as! URLFileResourceType,
                                  ", size:", entry[.fileSizeKey] as! Int64,
                                  ", modified:", entry[.contentModificationDateKey] as! Date,
                                  ", created:", entry[.creationDateKey] as! Date)
                        }
                        
                    case .failure(let error):
                        print(error)
                    }
                }
                
            case .failure(let error):
                print(error)
            }
        }
    }
    
    func moveItem(path: String, to toPath: String) {
        self.connect { result in
            switch result {
            case .success(let client):
                client.moveItem(atPath: path, toPath: toPath) { error in
                    if let error = error {
                        print(error)
                    } else {
                        print("\(path) moved successfully.")
                    }
                    
                    // Disconnecting is optional, it will be called eventually
                    // when `AMSMB2` object is freed.
                    // You may call it explicitly to detect errors.
                    client.disconnectShare(completionHandler: { (error) in
                        if let error = error {
                            print(error)
                        }
                    })
                }
                
            case .failure(let error):
                print(error)
            }
        }
    }
}

License

While source code shipped with project is MIT licensed, but it has static link to libsmb2 which is LGPL v2.1, consequently the whole project becomes LGPL v2.1.

You must link this library dynamically to your app if you intend to distribute your app on App Store.

Comments
  • If the gracefully argument of disconnectShare is set to true, no response is returned

    If the gracefully argument of disconnectShare is set to true, no response is returned

    Hi,

    If the "gracefully" argument of disconnectShare() is set to true, no response is returned.

    If I use AMSMB2 frequently, my app may terminated, so I feel I need to make the disconnectShare() argument "gracefully" true.

    Looking at AMSMB2.swift, disconnectShare () itself increments operationCount, so it seems that disconnectShare () keeps waiting without oeprationCount becoming 0.

    I think 240 lines should be as follows.

    while self.operationCount> 1

    Best Regard,

    opened by geysee 26
  • Connect / contentsOfDirectoryAtPath fail on Xcode10.2.1 (iOS 11/12)

    Connect / contentsOfDirectoryAtPath fail on Xcode10.2.1 (iOS 11/12)

    The method while connecting or trying to get contents listing (I assume because it's never reached), hangs...and after a very long timeout no completion is called and nothing is returned. If in my code a execute again it crashes on bindMemory method.

    How can I solve? I need latest Xcode version to support iOS12.

    I already updated to latest (2.0) git release Tested on with Xcode 10.1 (AMSMB v1.7.0) everything works. I cannot test the latest due to swift 5.0 compatibility

    opened by fabiosoft 13
  • Error for listShares

    Error for listShares "NSPOSIXErrorDomain Code 22 Invalid argument"

    Hi!

    I get the following error when trying the listShares function when I connect to my Mac. The connectShare works fine and so does listDirectory

    Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument" UserInfo={NSLocalizedFailureReason=Error code 22: }

    My code

    let client = AMSMB2(url: URL(string: "smb://192.168.0.4/")!, credential: URLCredential(user: "user", password: "pass", persistence: .forSession))
    
    client?.connectShare(name: "Downloads", completionHandler: { (error) in
    	print("connectShare")
    	print(error)
    })
                
    client?.listShares(enumerateHidden: false, completionHandler: { (names, comments, error) in
    	print("listShares")
    	print(names)
    	print(comments)
    	print(error)
    })
    

    Console

    connectShare
    nil
    listShares
    []
    []
    Optional(Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument" UserInfo={NSLocalizedFailureReason=Error code 22: })
    

    Same problem in Simulator as on Device

    Thanks!

    opened by emilhornlund 10
  • Session setup failed with (0xc00000be) Unknown.

    Session setup failed with (0xc00000be) Unknown.

    Hey,

    at first thanks for this nice lib.

    Can you help me with a problem, create a connection to my smb server?

    For development i activated the File sharing functionality on my mac, so my address is a local ip smb://192.168.0.xxx and my login credentials are the same as on my mac.

    This is how i try to connect to my local smb server.

    class SMBConnection {
        
        func connect(handler: @escaping (_ client: AMSMB2?, _ error: Error?) -> Void) {
            let credential = URLCredential(user: "User", password: "MyPassword", persistence: .forSession)
            let client = AMSMB2(url: URL(string: "smb://192.168.0.xxx")!, credential: credential)!
            client.connectShare(name: "MYSHARE") { error in
                handler(client, error)
            }
        }
    }
    
    let conn = SMBConnection()
    conn.connect { (client, error) in
                if let error = error {
                    print(error)
                    return
                }
    
                print("WORKED !!")
            }
    

    So when i try this i always get the error Error Domain=NSPOSIXErrorDomain Code=5 "Input/output error" UserInfo={NSLocalizedFailureReason=Error code 5: Session setup failed with (0xc00000be) Unknown. }. It happens on my simulator and on my device (while its connected to the local network, other third party apps can connect to my smb server).

    Thanks in advance :)

    opened by mstolin 9
  • Build error occured

    Build error occured

    Hi,

    There are occured a build error where line 56 in Extensions.swift . The error message is following.

    The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions

    build_error

    My development environment is following.

    • Swift ver.5
    • xcode ver.10.2.1(10E1001)
    • macOS Mojave ver.10.14.5

    I could fix the error by changing the code to:

        mutating func append(value: UInt64) {
            let value1 = UInt8(value & 0xff)
            let value2 = UInt8(value >> 8 & 0xff)
            let value3 = UInt8(value >> 16 & 0xff)
            let value4 = UInt8(value >> 24 & 0xff)
            let value5 = UInt8(value >> 32 & 0xff)
            let value6 = UInt8(value >> 40 & 0xff)
            let value7 = UInt8(value >> 48 & 0xff)
            let value8 = UInt8(value >> 56 & 0xff)
            self.append(contentsOf: [value1, value2, value3, value4, value5, value6, value7, value8])
        }
    

    Please change the code.

    Best regards,

    opened by geysee 8
  • Error code 12: Unknown address family :30. Only IPv4/IPv6 supported so far.

    Error code 12: Unknown address family :30. Only IPv4/IPv6 supported so far.

    I'm trying to use AMSMB2 to connect to my Synology server at home (which I'm regularly connecting to using my Mac via SMB). My app is running on an Apple TV with tvOS 12.0 and both on the simulator and on my Apple TV, I can find a service, but when calling the listShares method or the connectShare method I get the following error:

    Error Domain=NSPOSIXErrorDomain Code=12 "Cannot allocate memory" UserInfo={NSLocalizedFailureReason=Error code 12: Unknown address family :30. Only IPv4/IPv6 supported so far.}
    

    The Synology's discovered NetService is the name of the server, something like MyServer, so it's not an IP address. I also tried my Synology's IP-address, but that didn't work either.

    You can find the code how I'm using AMSMB2 here on GitHub: https://github.com/Flinesoft/HomeCinema/blob/work/amsmb2/App/Sources/Networking/LocalNetworkConnector.swift

    Any idea what might be the issue?

    opened by Jeehut 8
  • Depending on some server, the error message

    Depending on some server, the error message "Inconsitency in writing to SMB file handle." is thrown.

    Hi,

    Thank you for your software and your response. I have new problem and fixed code.

    Problem

    Depending on some server, the error message "Inconsitency in writing to SMB file handle." is thrown.

    Source code location

    https://github.com/amosavian/AMSMB2/blob/d122db1842e6a89767034a2584f90412f1af0cc3/AMSMB2/AMSMB2.swift#L1005

    Cause

    On some server, smb2_get_max_write_size returns 65536. But returned written size from following code is 61440.

    let written = try file.write(data: segment)
    if written != segment.count {
        throw POSIXError(.EIO, description: "Inconsitency in writing to SMB file handle.")
    }
    

    Fixed code

    It seems some server issue, but Windows OS can write to this server without problem. So I fixed it with the following code.

    var written = try file.write(data: segment)
    
    while written < segment.count {
        let partialWritten = try file.write(data: segment.suffix(segment.count - written))
        if partialWritten <= 0 {
            throw POSIXError(.EIO, description: "Inconsitency in writing to SMB file handle.")
        }
        written += partialWritten
    }
    

    This fix has been tested.

    I will create pull request soon. Please merge it.

    Best Regards,

    opened by geysee 7
  • Can't Compile 2.6.0 (Build Failure)

    Can't Compile 2.6.0 (Build Failure)

    I'm new to Swift so it may be that I'm not doing something correctly, but the code does not compile. I've tried the CocoaPods method as well as the manual method. I get the following build errors:

    AMSMB2 Group
    Swift Compiler Error Group
    /Volumes/Brazil/Xcode/PhotoLibrarySync/AMSMB2/AMSMB2/Fsctl.swift:76:12: 'DataProtocol' requires the types 'Slice<IOCtl.SrvCopyChunk>' and 'UInt8' be equivalent
    /Volumes/Brazil/Xcode/PhotoLibrarySync/AMSMB2/AMSMB2/Fsctl.swift:76:12: Requirement specified as 'Self.Element' == 'UInt8' [with Self = IOCtl.SrvCopyChunk]
    /Volumes/Brazil/Xcode/PhotoLibrarySync/AMSMB2/AMSMB2/Fsctl.swift:76:12: Type 'IOCtl.SrvCopyChunk' does not conform to protocol 'RandomAccessCollection'
    /Swift.Collection:2:23: Candidate has non-matching type '<Self> (Range<Self.Index>) -> Slice<Self>' [with Element = IOCtl.SrvCopyChunk.Element, Index = IOCtl.SrvCopyChunk.Index, SubSequence = IOCtl.SrvCopyChunk.SubSequence, Indices = IOCtl.SrvCopyChunk.Indices]
    /Swift.Collection:2:23: Candidate has non-matching type '<Self, R> (R) -> Self.SubSequence' [with Element = IOCtl.SrvCopyChunk.Element, Index = IOCtl.SrvCopyChunk.Index, SubSequence = IOCtl.SrvCopyChunk.SubSequence, Indices = IOCtl.SrvCopyChunk.Indices]
    /Swift.Collection:3:23: Candidate has non-matching type '<Self> ((UnboundedRange_) -> ()) -> Self.SubSequence' [with Element = IOCtl.SrvCopyChunk.Element, Index = IOCtl.SrvCopyChunk.Index, SubSequence = IOCtl.SrvCopyChunk.SubSequence, Indices = IOCtl.SrvCopyChunk.Indices]
    /Volumes/Brazil/Xcode/PhotoLibrarySync/AMSMB2/AMSMB2/Fsctl.swift:38:5: Candidate has non-matching type '<Self> (Int) -> UInt8' [with Element = IOCtl.SrvCopyChunk.Element, Index = IOCtl.SrvCopyChunk.Index, SubSequence = IOCtl.SrvCopyChunk.SubSequence, Indices = IOCtl.SrvCopyChunk.Indices]
    /Volumes/Brazil/Xcode/PhotoLibrarySync/AMSMB2/AMSMB2/Fsctl.swift:76:12: Type 'IOCtl.SrvCopyChunk' does not conform to protocol 'BidirectionalCollection'
    /Swift.Collection:2:23: Candidate has non-matching type '<Self> (Range<Self.Index>) -> Slice<Self>' [with Element = IOCtl.SrvCopyChunk.Element, Index = IOCtl.SrvCopyChunk.Index, SubSequence = IOCtl.SrvCopyChunk.SubSequence, Indices = IOCtl.SrvCopyChunk.Indices]
    /Swift.Collection:2:23: Candidate has non-matching type '<Self, R> (R) -> Self.SubSequence' [with Element = IOCtl.SrvCopyChunk.Element, Index = IOCtl.SrvCopyChunk.Index, SubSequence = IOCtl.SrvCopyChunk.SubSequence, Indices = IOCtl.SrvCopyChunk.Indices]
    /Swift.Collection:3:23: Candidate has non-matching type '<Self> ((UnboundedRange_) -> ()) -> Self.SubSequence' [with Element = IOCtl.SrvCopyChunk.Element, Index = IOCtl.SrvCopyChunk.Index, SubSequence = IOCtl.SrvCopyChunk.SubSequence, Indices = IOCtl.SrvCopyChunk.Indices]
    /Volumes/Brazil/Xcode/PhotoLibrarySync/AMSMB2/AMSMB2/Fsctl.swift:38:5: Candidate has non-matching type '<Self> (Int) -> UInt8' [with Element = IOCtl.SrvCopyChunk.Element, Index = IOCtl.SrvCopyChunk.Index, SubSequence = IOCtl.SrvCopyChunk.SubSequence, Indices = IOCtl.SrvCopyChunk.Indices]
    /Volumes/Brazil/Xcode/PhotoLibrarySync/AMSMB2/AMSMB2/Fsctl.swift:76:12: Type 'IOCtl.SrvCopyChunk' does not conform to protocol 'Collection'
    /Swift.Collection:2:23: Candidate has non-matching type '<Self> (Range<Self.Index>) -> Slice<Self>' [with Element = Slice<IOCtl.SrvCopyChunk>, Index = Int, Iterator = IndexingIterator<IOCtl.SrvCopyChunk>, SubSequence = Slice<IOCtl.SrvCopyChunk>, Indices = Range<Int>]
    /Swift.Collection:2:23: Candidate has non-matching type '<Self, R> (R) -> Self.SubSequence' [with Element = Slice<IOCtl.SrvCopyChunk>, Index = Int, Iterator = IndexingIterator<IOCtl.SrvCopyChunk>, SubSequence = Slice<IOCtl.SrvCopyChunk>, Indices = Range<Int>]
    /Swift.Collection:3:23: Candidate has non-matching type '<Self> ((UnboundedRange_) -> ()) -> Self.SubSequence' [with Element = Slice<IOCtl.SrvCopyChunk>, Index = Int, Iterator = IndexingIterator<IOCtl.SrvCopyChunk>, SubSequence = Slice<IOCtl.SrvCopyChunk>, Indices = Range<Int>]
    /Volumes/Brazil/Xcode/PhotoLibrarySync/AMSMB2/AMSMB2/Fsctl.swift:38:5: Candidate has non-matching type '<Self> (Int) -> UInt8' [with Element = Slice<IOCtl.SrvCopyChunk>, Index = Int, Iterator = IndexingIterator<IOCtl.SrvCopyChunk>, SubSequence = Slice<IOCtl.SrvCopyChunk>, Indices = Range<Int>]
    /Volumes/Brazil/Xcode/PhotoLibrarySync/AMSMB2/AMSMB2/Fsctl.swift:76:12: Do you want to add protocol stubs?
    /Volumes/Brazil/Xcode/PhotoLibrarySync/AMSMB2/AMSMB2/Fsctl.swift:91:12: 'DataProtocol' requires the types 'Slice<IOCtl.SrvCopyChunkCopy>' and 'UInt8' be equivalent
    /Volumes/Brazil/Xcode/PhotoLibrarySync/AMSMB2/AMSMB2/Fsctl.swift:91:12: Requirement specified as 'Self.Element' == 'UInt8' [with Self = IOCtl.SrvCopyChunkCopy]
    /Volumes/Brazil/Xcode/PhotoLibrarySync/AMSMB2/AMSMB2/Fsctl.swift:91:12: Type 'IOCtl.SrvCopyChunkCopy' does not conform to protocol 'RandomAccessCollection'
    /Swift.Collection:2:23: Candidate has non-matching type '<Self> (Range<Self.Index>) -> Slice<Self>' [with Element = IOCtl.SrvCopyChunkCopy.Element, Index = IOCtl.SrvCopyChunkCopy.Index, SubSequence = IOCtl.SrvCopyChunkCopy.SubSequence, Indices = IOCtl.SrvCopyChunkCopy.Indices]
    /Swift.Collection:2:23: Candidate has non-matching type '<Self, R> (R) -> Self.SubSequence' [with Element = IOCtl.SrvCopyChunkCopy.Element, Index = IOCtl.SrvCopyChunkCopy.Index, SubSequence = IOCtl.SrvCopyChunkCopy.SubSequence, Indices = IOCtl.SrvCopyChunkCopy.Indices]
    /Swift.Collection:3:23: Candidate has non-matching type '<Self> ((UnboundedRange_) -> ()) -> Self.SubSequence' [with Element = IOCtl.SrvCopyChunkCopy.Element, Index = IOCtl.SrvCopyChunkCopy.Index, SubSequence = IOCtl.SrvCopyChunkCopy.SubSequence, Indices = IOCtl.SrvCopyChunkCopy.Indices]
    /Volumes/Brazil/Xcode/PhotoLibrarySync/AMSMB2/AMSMB2/Fsctl.swift:38:5: Candidate has non-matching type '<Self> (Int) -> UInt8' [with Element = IOCtl.SrvCopyChunkCopy.Element, Index = IOCtl.SrvCopyChunkCopy.Index, SubSequence = IOCtl.SrvCopyChunkCopy.SubSequence, Indices = IOCtl.SrvCopyChunkCopy.Indices]
    /Volumes/Brazil/Xcode/PhotoLibrarySync/AMSMB2/AMSMB2/Fsctl.swift:91:12: Type 'IOCtl.SrvCopyChunkCopy' does not conform to protocol 'BidirectionalCollection'
    /Swift.Collection:2:23: Candidate has non-matching type '<Self> (Range<Self.Index>) -> Slice<Self>' [with Element = IOCtl.SrvCopyChunkCopy.Element, Index = IOCtl.SrvCopyChunkCopy.Index, SubSequence = IOCtl.SrvCopyChunkCopy.SubSequence, Indices = IOCtl.SrvCopyChunkCopy.Indices]
    /Swift.Collection:2:23: Candidate has non-matching type '<Self, R> (R) -> Self.SubSequence' [with Element = IOCtl.SrvCopyChunkCopy.Element, Index = IOCtl.SrvCopyChunkCopy.Index, SubSequence = IOCtl.SrvCopyChunkCopy.SubSequence, Indices = IOCtl.SrvCopyChunkCopy.Indices]
    /Swift.Collection:3:23: Candidate has non-matching type '<Self> ((UnboundedRange_) -> ()) -> Self.SubSequence' [with Element = IOCtl.SrvCopyChunkCopy.Element, Index = IOCtl.SrvCopyChunkCopy.Index, SubSequence = IOCtl.SrvCopyChunkCopy.SubSequence, Indices = IOCtl.SrvCopyChunkCopy.Indices]
    /Volumes/Brazil/Xcode/PhotoLibrarySync/AMSMB2/AMSMB2/Fsctl.swift:38:5: Candidate has non-matching type '<Self> (Int) -> UInt8' [with Element = IOCtl.SrvCopyChunkCopy.Element, Index = IOCtl.SrvCopyChunkCopy.Index, SubSequence = IOCtl.SrvCopyChunkCopy.SubSequence, Indices = IOCtl.SrvCopyChunkCopy.Indices]
    /Volumes/Brazil/Xcode/PhotoLibrarySync/AMSMB2/AMSMB2/Fsctl.swift:91:12: Type 'IOCtl.SrvCopyChunkCopy' does not conform to protocol 'Collection'
    /Swift.Collection:2:23: Candidate has non-matching type '<Self> (Range<Self.Index>) -> Slice<Self>' [with Element = Slice<IOCtl.SrvCopyChunkCopy>, Index = Int, Iterator = IndexingIterator<IOCtl.SrvCopyChunkCopy>, SubSequence = Slice<IOCtl.SrvCopyChunkCopy>, Indices = Range<Int>]
    /Swift.Collection:2:23: Candidate has non-matching type '<Self, R> (R) -> Self.SubSequence' [with Element = Slice<IOCtl.SrvCopyChunkCopy>, Index = Int, Iterator = IndexingIterator<IOCtl.SrvCopyChunkCopy>, SubSequence = Slice<IOCtl.SrvCopyChunkCopy>, Indices = Range<Int>]
    /Swift.Collection:3:23: Candidate has non-matching type '<Self> ((UnboundedRange_) -> ()) -> Self.SubSequence' [with Element = Slice<IOCtl.SrvCopyChunkCopy>, Index = Int, Iterator = IndexingIterator<IOCtl.SrvCopyChunkCopy>, SubSequence = Slice<IOCtl.SrvCopyChunkCopy>, Indices = Range<Int>]
    /Volumes/Brazil/Xcode/PhotoLibrarySync/AMSMB2/AMSMB2/Fsctl.swift:38:5: Candidate has non-matching type '<Self> (Int) -> UInt8' [with Element = Slice<IOCtl.SrvCopyChunkCopy>, Index = Int, Iterator = IndexingIterator<IOCtl.SrvCopyChunkCopy>, SubSequence = Slice<IOCtl.SrvCopyChunkCopy>, Indices = Range<Int>]
    /Volumes/Brazil/Xcode/PhotoLibrarySync/AMSMB2/AMSMB2/Fsctl.swift:91:12: Do you want to add protocol stubs?
    Warning Group
    /Users/sabaata/Library/Developer/Xcode/DerivedData/PhotoLibrarySync-dljqurabsjpzepgufrwefrpszihc/Build/Intermediates.noindex/AMSMB2.build/Debug-iphoneos/AMSMB2.build/Objects-normal/arm64/FileHandle.dia:1:1: Could not read serialized diagnostics file: Invalid File: Invalid diagnostics signature
    

    I'm using Swift 5 and XCode 11.4 beta 3

    opened by sabaatworld 6
  • Test case 'testShareEnum' fails on Xcode10.2

    Test case 'testShareEnum' fails on Xcode10.2

    Hi Amosavian The test case testShareEnum failed on latest XCode. Can you have a try? PS. I recompiled the libsmb2 with your build script, and the issue is the same.

    opened by kasimok 5
  • STATUS_BAD_NETWORK_NAME

    STATUS_BAD_NETWORK_NAME

    Hello,

    I want to connect to my Windows 10 Laptop but always get this error message: Error Domain=NSPOSIXErrorDomain Code=36 "Operation now in progress" UserInfo={NSLocalizedFailureReason=Session setup failed with (0xc00000cc) STATUS_BAD_NETWORK_NAME. }

    Does anyone know what's the error?

    opened by m8tec 4
  • Not able to download item on iPad from Windows 10 Enterprise Edition machine using downloadItem API which works fine using Mac OS

    Not able to download item on iPad from Windows 10 Enterprise Edition machine using downloadItem API which works fine using Mac OS

    I am trying to download file from Windows server to iPad . It provides me list of directories and subfolders But while using the API client.downloadItem(atPath: filePath, to: copyURL, progress: download I get following error : Optional

    • some : Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument" UserInfo={NSLocalizedFailureReason=Error code 22: Open failed with (0xc000000d) STATUS_INVALID_PARAMETER.} It works fine with Mac OS but facing issue with Windows....

    Please help urgently...

    bug 
    opened by kheravarun08 4
  • Connect to a Distributed File System-Namespaces

    Connect to a Distributed File System-Namespaces

    Is it possible to connect with amsmb2 to a distributed file system-namespaces? With this example, the finder in Mac-OS is able to connect to a dfs.

    I tried with the serverURL "smb://resources.example.com/DFSroot" and an empty share. But is doesn't work.

    opened by andreastroeger 0
  • Which thread does amsmb2 run on

    Which thread does amsmb2 run on

     let credential = URLCredential(user: user, password: password, persistence: URLCredential.Persistence.forSession)
            client = AMSMB2(url: self.serverURL, credential: credential)!
            
            // AMSMB2 can handle queueing connection requests
            client?.connectShare(name: self.share) { error in
                if let error = error {
                    print("SMBClient ConnectShare",error);
                }
            }
    

    The above is the code for initializing and connecting SMB. I want to know which thread this is running on? How can I set it to run on other threads? Can I use multiple threads to read files?

    opened by seventeenYear 0
  • Cannot extract data, move, download, copy; etc. from Linux or Windows shares with latin characters in file name

    Cannot extract data, move, download, copy; etc. from Linux or Windows shares with latin characters in file name

    I almost re-opened the previous issue I posted, regarding extracting data from files from Windows shares. I thought that was completely fixed by dropping the first slash in the path (not necessary for MacOSX or Linux).

    … but I now find there are still problems with files containing certain latin characters, such as í, ì, ñ…; etc.

    The files are listed with these characters correctly, they appear in Windows File explorer and other OS's when shared. So I can only think it is a problem with this lib.

    This is a very common situation with music files, unless the user's Music lib consists of only "Anglo Saxon" music, for example. So it's a serious limitation.

    opened by geofstro 7
  • Upload the file keeping the original creation date

    Upload the file keeping the original creation date

    Tell me please. I am uploading files from phone to computer using the "uploadItem" function. Is it possible to somehow save the original modification date of the created file? Or might it be possible to change the date after the copy is complete? Thanks in advance.

    opened by Steady7go 0
  • can someone know how to fix this

    can someone know how to fix this

    Unable to install /Users//Desktop/insta_flutter/build/ios/iphonesimulator/Runner.app on DC348557-FE81-4F61-9158-ACD98C993260. This is sometimes caused by a malformed plist file: ProcessException: Process exited abnormally: An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22): Failed to install the requested application The application's Info.plist does not contain a valid CFBundleVersion. Ensure your bundle contains a valid CFBundleVersion. Command: xcrun simctl install DC348557-FE81-4F61-9158-ACD98C993260 /Users//Desktop/insta_flutter/build/ios/iphonesimulator/Runner.app Error launching application on iPhone 11 Pro.

    opened by naradd 0
  • SPM Support

    SPM Support

    First of all, I would like to thank you for making this library. It is really useful and user friendly 👍 Nevertheless, distribution with the library as a submodule seem to be a little tricky. It would be great if SPM support was on it's way, since I use SPM for other libraries in my project and I'm reluctant to mix dependency managers. Do you have an estimate when the SPM support will be available?

    Thanks again. Your effort is much appreciated.

    opened by Yoorque 1
Releases(2.7.1)
Owner
Amir Abbas Mousavian
A Swift lover based in Tehran
Amir Abbas Mousavian
Swift framework for zipping and unzipping files.

Zip A Swift framework for zipping and unzipping files. Simple and quick to use. Built on top of minizip. Usage Import Zip at the top of the Swift file

Roy Marmelstein 2.3k Dec 30, 2022
A micro-framework for observing file changes, both local and remote. Helpful in building developer tools.

KZFileWatchers Wouldn't it be great if we could adjust feeds and configurations of our native apps without having to sit back to Xcode, change code, r

Krzysztof Zabłocki 1k Dec 19, 2022
FileManager replacement for Local, iCloud and Remote (WebDAV/FTP/Dropbox/OneDrive) files -- Swift

This Swift library provide a swifty way to deal with local and remote files and directories in a unified way. This library provides implementaion of W

Amir Abbas Mousavian 890 Jan 6, 2023
Effortless path operations in Swift

PathKit Effortless path operations in Swift. Usage let path = Path("/usr/bin/swift") Joining paths let path = Path("/usr/bin") + Path("swift") Determi

Kyle Fuller 1.4k Jan 5, 2023
File management and path analysis for Swift

Pathos offers cross-platform virtual file system APIs for Swift. Pathos is implement from ground-up with on each OS's native API. It has zero dependen

Daniel Duan 104 Nov 19, 2022
Effortless ZIP Handling in Swift

ZIP Foundation is a library to create, read and modify ZIP archive files. It is written in Swift and based on Apple's libcompression for high performa

Thomas Zoechling 1.9k Dec 27, 2022
Finder-style iOS file browser written in Swift

FileBrowser iOS Finder-style file browser in Swift 4.0 with search, file previews and 3D touch. Simple and quick to use. Features ✨ Features ?? Browse

Roy Marmelstein 1.5k Dec 16, 2022
Xcode-developer-disk-image-all-platforms - A repo which shares all developer disk images for iOS, tvOS, watchOS

Disclaimer: The available resources and files from this repo are uploaded from many contributors. The files are unverified, untested, and could have n

Hai K 253 Dec 21, 2022
TheraForge's Client REST API framework to connect to TheraForge's secure CloudBox Backend-as-a-Service (BaaS)

OTFCloudClientAPI TheraForge's Client REST API Framework to Connect to TheraForg

TheraForge 0 Dec 23, 2021
This is swift project example to connect VNPTSmartCA SDK using Swift Language.

Example source code to integrate with VNPTSmartCA iOS SDK To run the example project, clone repository, and run pod install Requirements Installation

null 1 Feb 14, 2022
The Swift-est way to build native mobile apps that connect to Salesforce.

Swiftly Salesforce is the Swift-est way to build native mobile apps that connect to Salesforce: Written entirely in Swift. Very easy to install and up

Michael Epstein 131 Nov 23, 2022
The Waterwheel Swift SDK provides classes to natively connect iOS, macOS, tvOS, and watchOS applications to Drupal 7 and 8.

Waterwheel Swift SDK for Drupal Waterwheel makes using Drupal as a backend with iOS, macOS, tvOS, or watchOS enjoyable by combining the most used feat

Kyle Browning 414 Jul 26, 2022
The swiftest way to build iOS apps that connect to Salesforce

Build iOS apps fast on the Salesforce Platform with Swiftly Salesforce: Written entirely in Swift. Uses Swift's Combine framework to simplify complex,

Michael Epstein 131 Nov 23, 2022
This is a simple mobile app which is connect to the Twitter API

Project 3 - My Twitter My Twitter is a basic twitter app to read your tweets. Time spent on two parts: 8.5 hours spent in total Twitter - Part II This

Alem 1 Dec 14, 2022
Native iOS port of KDE Connect

Welcome to KDE Connect iOS 2021's Testing Repository! This project is inteded to be the iOS version of the group of applications called KDE Connect, w

KDE GitHub Mirror 292 Dec 27, 2022
This is a simple app, which scans for BLE Peripherials and connect to them. The example works with NORDIC_UART_SERVICE.

BLE Serial IOs Example This is a simple app, which scans for BLE Peripherials and connect to them. The example works with NORDIC_UART_SERVICE. UUIDS H

Muhammad Hammad 4 May 10, 2022
Elegantly connect to a JSON api. (Alamofire + Promises + JSON Parsing)

⚠ Important Notice: Farewell ws... hello Networking ! Networking is the next generation of the ws project. Think of it as ws 2.0 built for iOS13. It u

Fresh 351 Oct 2, 2022
iTunes Connect Library inspired by FastLane

Mothership iTunes Connect Library inspired by FastLane I wrote MotherShip for two reasons. love FastLane, but I am not proficient in Ruby. I wanted to

thecb4 74 Nov 3, 2022
A simple educational application for the game Connect Four for two players

Connect4Game A simple educational application for the game Connect Four for two players. The algorithm checks the match of 4 tiles horizontally, verti

NIKOLAY NIKITIN 0 Oct 20, 2022
A Simple App That Find and connect with classmates

Study With Me Find and connect with classmates! Search View Controller: My Courses View Controller: Profile View Controller: A View of Students in a C

Ben Wu 0 Dec 4, 2021