amosavian / amsmb2 Goto Github PK
View Code? Open in Web Editor NEWSwift framework to connect SMB2/3 shares
License: GNU Lesser General Public License v2.1
Swift framework to connect SMB2/3 shares
License: GNU Lesser General Public License v2.1
Is there a way to detect the SMB connection version that was negotiated? I tried using SMBContext's Version but it's returning Any. That is fine before the connection is made, but after it connected reporting what was negotiated seems appropriate.
Hi,
Can I use AMSMB2 to connect to a share and mount it in a manner that allows me to access it via a shell script?
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.
I can't use it by this way
connectShare(name:"")
. It didn't work.
And this way too...
client.contentsOfDirectory(atPath: "",
completionHandler: {
I need get a list of current directory or root.
Hi, thank you for this library, really helpful to me.
However I encounter an issue when I want to download Item from my Shared Folder into my temporary directory in iOS using Swift 4.2 and XCode 10.2.
This is how I create the temp directory URL :
let tempURL = URL(fileURLWithPath:NSTemporaryDirectory()).appendingPathComponent(fileName)
The value of tempURL will be :
file:///Users/odin321/Library/Developer/CoreSimulator/Devices/F459303B-A4FD-494F-A437-F7EF57384FDD/data/Containers/Data/Application/21857A2A-9035-4856-9A12-6B78A79139A6/tmp/file%20Name.csv
Everything went well, I could download the item successfully, but when I use same tempURL with another fileName, often the process will fail with error :
Error Domain=NSPOSIXErrorDomain Code=20 "Not a directory" UserInfo={_kCFStreamErrorCodeKey=20, _kCFStreamErrorDomainKey=1}
or
Error Domain=NSPOSIXErrorDomain Code=21 "Is a directory" UserInfo={_kCFStreamErrorCodeKey=21, _kCFStreamErrorDomainKey=1}
At the moment I just drop the last path component from the URL using tempURL.deletingLastPathComponent()
if the error occured, and the item will be downloaded.
I'm not sure if this is correct approach , or was I writing the temp directory wrong ?
Thank you in advance.
Hi!
There is a path duplication if you try to get attributes of folder.
For example, If you try to get the attributes of the folder located "/folder", you will get:
attributes[.pathKey] == "/folder/folder"
How to moveItem
smb.moveItem(atPath: "22/2/1.PNG", toPath: "22/1.PNG") { (error) in
XCTAssertNil(error)
expectation.fulfill()
}
Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={NSLocalizedFailureReason=Error code 2: }
Hi Amosavian,
I downloaded your project, I ran your test cases, and for some smb servers the test cases all passed. But when I test it over a samba share from Synology NAS, write related cases raises "Inconsitency in writing to SMB file handle." error. You mentioned " Data saved in server maybe truncated when completion handler returns error." in the API. So you have any idea how to handle this?
Thanks
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
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,
Hey thanks for this library.
### Problem:
When I try to add this library using Swift Package, I get this error:
/Users/user/Documents/AMSMB2/Package.swift: package has unsupported layout; modulemap '/Users/user/Documents/AMSMB2/libsmb2/include/module.modulemap' should be inside the 'include' directory
Hi, I am using this library for one of my iOS app. How to get a notification when data changes happened in a particular directory in SMB Server?
Is there any way to detect what version a SMB Server is using/supporting as a client?
Just in general, doesn't have to do with iOS/Swift
It says [!] Unable to find a specification for "AMSMB2"
Hi,
We have used this pod today and seems it matches our requirements. But we worried about, Will AppStore approve or not?
Please let us know, How to link this library dynamically to our app for AppStore review?
Thank you for your efforts to make this great library.
Right now I'm trying to just list the directory and get this error:
Error Domain=NSPOSIXErrorDomain Code=5 "Input/output error" UserInfo={NSLocalizedFailureReason=Error code 5: Session setup failed with (0xc00000be) Unknown. }
I haven't put in a share name for my project because I don't know what I'm sharing and or how? I'm trying to build an app that can view files from my Mac or PC and download them to my app. What do I have to do to complete this process?
Thanks
There're issues with this library when run in Xcode 10 with Swift 4. Some of issues I could fix by myself, but there're issues I can't fix:
Header 'AMSMB2-Swift.h' not found
Do you have idea how to fix this issue?
Thank you for providing this library!
I've been looking through the implementation and didn't find a way to write to an already existing file. Using
write<DataType>(data: DataType, toPath path: String, progress: WriteProgressHandler, completionHandler: SimpleCompletionHandler)
throws
Optional(Error Domain=NSPOSIXErrorDomain Code=17 "File exists" UserInfo={NSLocalizedFailureReason=Error code 17: Open failed with (0xc0000035) STATUS_OBJECT_NAME_COLLISION.})
because it's trying to create a new file.
I use this method
open func contents(atPath path: String, offset: Int64 = 0, length: Int = -1, progress: SMB2ReadProgressHandler, completionHandler: @escaping (_ contents: Data?, _ error: Error?) -> Void) {
and get error as follow:
Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument" UserInfo={NSLocalizedFailureReason=Error code 22: }
My share directory is "/E", and the whole file path is "/E/Media/a.mp4", I pass path with "/Media/a.mp4", then get this error.
Hi, I am trying to connect to my Apple TC as below:
dispatch_queue.async {
let client = AMSMB2(url: URL(string: "smb://192.168.2.1"), credential: URLCredential(user: "user", password: "Password", persistence: .permanent))!
client.connectShare(name: "folder") { error in
handler(client, error)
}
}
but the handler can't be called, and I found it that smb2_connect_share has never responded.
Could you please give me any direction about it?
thank your very much.
Hi,
Thanks for making a wonderful library.
In the latest Xcode 11.4 with MacOS Catalina I am getting error as follows :
Could not find module 'AMSMB2' for target 'armv7-apple-ios'; found:arm64,arm64-apple-ios
Kindly help us to resolve the issue as soon as possible.
Also please integrate the current Library with SMB3 as macOS Catalina supports SMB3 version only
How can I download an entire directory with all files and subdirectory inside?
Change all 'private' coincidences by 'fileprivate' in AMSMB2.swift. It does not compile for the latest Swift version.
When I try to 'connectShare' from an iPhone, I get this error with the message: "Operation not permitted".
Is there anything I didn't understand or forget ?
Like TOSMBClient, I can find SMB devices by TONetBIOSNameService
. Can AMSMB2 do this?
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 :)
I'm having problems with file smaller of 14 bytes, the Data object contains all zeros.
Do I need to change any settings ?
when I test The file "AMSMB2Tests",I meet this Situation:
"Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" UserInfo={NSLocalizedFailureReason=Error code 1: }"
this is My Setting:
let smb = AMSMB2(url: URL(string: "smb://192.168.169.1/share")!, credential: URLCredential(user: "admin", password: "admin", persistence: .forSession))!
smb.listShares { result in ...
No more detail Info ,I can not go on with it.
In FileHandle
func lseek(offset: Int64, whence: SeekWhence) throws -> Int64 {
let handle = try self.handle.unwrap()
let result = smb2_lseek(context.unsafe, handle, offset, whence.rawValue, nil)
try POSIXError.throwIfError(Int32(result), description: context.error)
return result
}
On error, the result may be greater than INT_MAX, this will throw an exception
Therefore, here you need to check the value or not cast it to Int32.
Hi,
Thank you for your software and your response.
I have new problem and fixed code.
Depending on some server, the error message "Inconsitency in writing to SMB file handle." is thrown.
Line 1005 in d122db1
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.")
}
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,
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!
Line 796 in b1a7a2a
It's creation time, not modification time :)
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
Issue #33 is marked as Closed, but was it ever confirmed to be fixed?
Currently experiencing what appears to be the same error. Using AMSMB2 v2.6.0 connecting to Windows 10 Pro share. The method contentsOfDirectory() works, but the method downloadItem() fails with message "The operation couldn’t be completed. Error code 22: Open failed with (0xc000000d) STATUS_INVALID_PARAMETER.".
The code to reproduce is trivial, so hopefully no need to share it in order to reproduce.
I want to know, without filling in the IP and domain name, can find the LAN Shared equipment?
When choosing a Shared device, enter the user name and password. Is this feature provided?
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
My development environment is following.
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,
I can’t move the object, maybe I missed something?
Here is my code sample:
[self.client connectShareWithName:"shareName" completionHandler:^(NSError * _Nullable error) {
if (!error) {
[self.client moveItemAtPath:"testFolder1/testItem.txt"
toPath:"testFolder2/testItem.txt"
completionHandler:^(NSError * _Nullable error) {
if (error) {
[weakSelf alertError:error];
} else {
[weakSelf finish];
}
}];
} else {
[weakSelf alertError:error];
}
}];
As a result, I get an error
Error Domain=NSPOSIXErrorDomain Code=5 "Input/output error" UserInfo={NSLocalizedFailureReason=Error code 5: }
error: Unable to find a pod with name, author, summary, or description matching AMSMB2
I use listShares
to list all share directory, but I can't list all sub directory in one share directory.
I use this code, but didn't work.
self.smbClient.connectShare(name: name, completionHandler: { (error) in
print("smb2 con \(error)")
self.smbClient.contentsOfDirectory(atPath: ".", completionHandler: { (reses, error) in
print("smb2 \(reses) \(error)")
})
})
when I use iPad, can not "connectShareWithName"
"smb2_destroy_context(context)" problem
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?
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
Please help urgently...
Currently I’m facing an issue with downloadItem as follows:
I connect to server. 192.xxx.xxx.xxx
I connect to a share. shareName
List share Share1, share2, Share3
List directory for lets say share1. dir1, dir 2, dir3. “see the space in dir 2”
List of files are displayed file1, file 2, file 3
When I try to downloadItem using atPath: “dir 2/file1” an error is returned “No such file or directory”
While trying to do the same with a directory name that has no spaces works fine.
I tried the following for directory name:
Change dir 2 to dir\ 2 so the atPath would be dir\ 2/file1
Change dir 2 to dir%202 so the atPath would be dir%202/file1
Change dir 2 to “dir 2” so the atPath would be “dir 2”/file1 also tried “dir 2/file1”
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.