Posts

Post marked as solved
4 Replies
1.8k Views
I am having trouble on iOS 14.4 creating a symbolic link. This is prompted by the fact that I cannot get a image pointing to a file with spaces in its name to work even if I urlencode the path. I will post about that in a separate request. My work around for the above is to create a symbolic link to a file in the application support directory that is added dynamically as part of normal app function. I tried the URL and the path version of createSymbolicLinkAt<URL,PATH> path=/var/mobile/Containers/Data/Application/6AFD230E-EC7A-4E50-80A5-38E0DB0B1F07/Library/Application Support/1612401575.M10168/Iridium Portal Icons-Address Book.png symlinkPath=/var/mobile/Containers/Data/Application/6AFD230E-EC7A-4E50-80A5-38E0DB0B1F07/Library/Application Support/1612401575.M10168/Iridium-Portal-Icons-Address-Book.png NSFileManager* fm = NSFileManager.defaultManager; NSString* path = [NSString stringWithFormat:@"%@/%@", dir, filename]; NSString *symlinkPath; NSError *simError; NSError *urlsimError; symlinkPath=[path stringByReplacingOccurrencesOfString:@" " withString:@"-"]; [fm createSymbolicLinkAtPath:symlinkPath toPath:path error:&simError]; [fm createSymbolicLinkAtURL:[NSURL fileURLWithPath:symlinkPath] withDestinationURL:[NSURL fileURLWithPath:path] error:&urlsimError]; 								 NSLog(@"%@ %@",@"path = ",path); NSLog(@"%@ %@",@"symlink path = ",symlinkPath); NSLog(@"%@ %@",@"by path error = ",simError); NSLog(@"%@ %@",@"by url error = ",urlsimError); This is the output of my log message. 2021-02-03 21:06:18.968374-0500 APP[1873:455544] path =	/var/mobile/Containers/Data/Application/0B4CC298-CEE8-4114-95D0-16F9F526207C/Library/Application Support/1612404374.M43687/Iridium Portal Icons-Address Book.png 2021-02-03 21:06:18.968570-0500 APP[1873:455544] symlink path =	/var/mobile/Containers/Data/Application/0B4CC298-CEE8-4114-95D0-16F9F526207C/Library/Application-Support/1612404374.M43687/Iridium-Portal-Icons-Address-Book.png 2021-02-03 21:06:18.977731-0500 APP[1873:455544] by path error =	Error Domain=NSCocoaErrorDomain Code=260 "The file “Iridium-Portal-Icons-Address-Book.png” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/var/mobile/Containers/Data/Application/0B4CC298-CEE8-4114-95D0-16F9F526207C/Library/Application-Support/1612404374.M43687/Iridium-Portal-Icons-Address-Book.png, NSUnderlyingError=0x282fbb3f0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}} 2021-02-03 21:06:18.980470-0500 APP[1873:455544] by url error =	Error Domain=NSCocoaErrorDomain Code=4 "The file “Iridium-Portal-Icons-Address-Book.png” doesn’t exist." UserInfo={NSFilePath=/var/mobile/Containers/Data/Application/0B4CC298-CEE8-4114-95D0-16F9F526207C/Library/Application-Support/1612404374.M43687/Iridium-Portal-Icons-Address-Book.png, NSUnderlyingError=0x282fbb420 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}} I do not understand why I am receiving this message. Obviously the file does not exist to be opened at the symbolic link path. That is what I am trying to create so I do not expect it to exist. Any help is appreciated here.
Posted Last updated
.