1

I need to access a shared file hosted on a mac shared folder, However when I directly pass the path to the NSFileManager it reports as file does not exist.

NSURL *fileURLPath = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@,%@",IP,PATH ]];

if ([[NSFileManager defaultManager] fileExistsAtPath:[fileURLPath path]])
{
}

I believe it's due to the authentication . How should handle or pass the credentials using the NSFileManager ?

0

1 Answer 1

1

It would be useful to see what your resulting URL looks like. If I understand your variable naming correctly, you're creating an invalid URL. If IP is @"127.0.0.1" and path is @"foo", the resulting URL will be file://127.0.0.1,foo, which isn't a valid URL. NSFileManager expects a file URL pointing to a descendant directory of the mount point. This implies that the share has to be mounted. Authentication is not required.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.