macOS FTP app using NSURLSession for dataTask is not working - macos

I'm using the following code to get a directory listing for an ftp app. It works as expected in iOS, but in macOS, I get no results - data.length is always 0 - and no errors. I've also tried using Session and Task delegates, but get the same results.
Any suggestions?
The format of the ftpURL is "ftp://server.host.net/Public"
Note that I can use the CFFTP methods to get a directory listing, and they do work, but... they are deprecated. Also, the NSURLSession download tasks are working just fine.
- (void)directoryListing:(NSURL *)ftpURL
{
NSLog(#"Directory listing for:\n%#", ftpURL.absoluteString);
NSURLSessionDataTask *dataTask = [[NSURLSession sharedSession] dataTaskWithURL:ftpURL completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error != nil) {
NSLog(#"Client-Error:%#",error.localizedDescription);
} else {
NSString *results = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(#"Data length: %ld, [%#]", data.length, results);
}
}];
[dataTask resume];
}

I'm really surprised it works in iOS. FTP is basically ultra-deprecated at this point, and is only officially supported for file downloads. Retrieving a list of files (LIST command) uses an entirely different command from downloading a file (RETR command), and there's no real standard for how the results of the latter should be provided by the Foundation networking APIs.
My guess is that you're accidentally getting data from that call because of some quirk in the way Safari on iOS was written (e.g. Safari not using CFNetwork calls directly on iOS), combined with some subtle difference in the way the foundation networking code underneath ties into the CFNetwork layer. In other words, it's a fluke that it works.
I would probably recommend using an FTP library that's actually supported, e.g. libcurl. You'll also have the advantage of being able to support TLS, which AFAIK the Apple FTP code has never supported at all.

Related

dismissGrantingAccessToURL of UIDocumentPickerExtensionViewController is not working

I am working on document provider extension for import mode.
URL of file is sitting inside the shared container shared by both extension & container app.
I got assertion failure saying that it should sit inside shared container/File Provider Storage directory.
So I copied file from original directory to File Provider Storage directory.
I have a file in original location & I got a file in new copied location also. I checked for data length of the file also, Its proper ,
But when I call [self dismissGrantingAccessToURL:toUrl];
Its not dismissing UIDocumentPickerExtensionViewController,
I am not facing any exceptions , but it wont dismiss and initiate the transfer, So user can still access the extension.
Below is my code, If anyone came across the same thing please leave your reply.
- (void)userChoosesEntityOfUrl:(NSURL *)url
{
NSURL *toUrl = [self.documentStorageURL URLByAppendingPathComponent:[url lastPathComponent]];
if ([[NSFileManager defaultManager] fileExistsAtPath:[toUrl path]]) {
[[NSFileManager defaultManager] removeItemAtPath:[toUrl path] error:nil];
}
if ([[NSFileManager defaultManager] copyItemAtURL:url toURL:toUrl error:nil]) {
NSLog(#"%#", [toUrl path]);
}
if (![[NSFileManager defaultManager] fileExistsAtPath:[toUrl path]]) {
NSLog(#"File Doesn't exists at this path");
return;
}
NSLog(#"Data Length %i",[[NSData dataWithContentsOfFile:[toUrl path]] length]);
[self dismissGrantingAccessToURL:toUrl];
}
When debugging your implementation of NSFileProviderExtension, you usually end up stopping/killing it using Xcode. After this, iOS often has problems restarting your file extension. This results in your document picker not being dismissed after calling dismissGrantingAccessToURL:. This bug also affects your subclass of UIDocumentPickerExtensionViewController which sometimes won't start (you only see the navigation bar of the document picker but not the content).
The workaround is to reboot your device.
This will occur if you have a backing File Provider extension that has not been fully implemented. Remove the File Provider target from your embedded extension phase, set your document extension only support import/export modes in the Info.plist, and do a product -> Clean before building and running your extension.

Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost."

I have an application which works fine on Xcode6-Beta1 and Xcode6-Beta2 with both iOS7 and iOS8. But with Xcode6-Beta3, Beta4, Beta5 I'm facing network issues with iOS8 but everything works fine on iOS7. I get the error "The network connection was lost.". The error is as follows:
Error: Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo=0x7ba8e5b0 {NSErrorFailingURLStringKey=, _kCFStreamErrorCodeKey=57, NSErrorFailingURLKey=, NSLocalizedDescription=The network connection was lost., _kCFStreamErrorDomainKey=1, NSUnderlyingError=0x7a6957e0 "The network connection was lost."}
I use AFNetworking 2.x and the following code snippet to make the network call:
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager setSecurityPolicy:policy];
manager.requestSerializer = [AFHTTPRequestSerializer serializer];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
[manager POST:<example-url>
parameters:<parameteres>
success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(#“Success: %#", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(#"Error: %#", error);
}];
I tried NSURLSession but still receive the same error.
Restarting the simulator fixed the issue for me.
We had this exact error and it turned out to be an issue with the underlying HTTP implementation of NSURLRequest:
As far as we can tell, when iOS 8/9/10/11 receive an HTTP response with a Keep-Alive header, it keeps this connection to re-use later (as it should), but it keeps it for more than the timeout parameter of the Keep-Alive header (it seems to always keep the connection alive for 30 seconds.)
Then when a second request is sent by the app less than 30 seconds later, it tries to re-use a connection that might have been dropped by the server (if more than the real Keep-Alive has elapsed).
Here are the solutions we have found so far:
Increase the timeout parameter of the server above 30 seconds. It looks like iOS is always behaving as if the server will keep the connection open for 30 seconds regardless of the value provided in the Keep-Alive header. (This can be done for Apache by setting the KeepAliveTimeout option.
You can simply disable the keep alive mechanism for iOS clients based on the User-Agent of your app (e.g. for Apache: BrowserMatch "iOS 8\." nokeepalive in the mod file setenvif.conf)
If you don't have access to the server, you can try sending your requests with a Connection: close header: this will tell the server to drop the connection immediately and to respond without any keep alive headers. BUT at the moment, NSURLSession seems to override the Connection header when the requests are sent (we didn't test this solution extensively as we can tweak the Apache configuration)
For mine, Resetting content and settings of Simulator works.
To reset the simulator follow the steps:
iOS Simulator -> Reset Content and Settings -> Press Reset (on the
warning which will come)
The iOS 8.0 simulator runtime has a bug whereby if your network configuration changes while the simulated device is booted, higher level APIs (eg: CFNetwork) in the simulated runtime will think that it has lost network connectivity. Currently, the advised workaround is to simply reboot the simulated device when your network configuration changes.
If you are impacted by this issue, please file additional duplicate radars at http://bugreport.apple.com to get it increased priority.
If you see this issue without having changed network configurations, then that is not a known bug, and you should definitely file a radar, indicating that the issue is not the known network-configuration-changed bug.
Also have a problem with beta 5 and AFNetworking 1.3 when running on iOS 8 simulator that results in a connection error:
Domain=NSURLErrorDomain Code=-1005 "The network connection was lost."
The same code works fine on iOS 7 and 7.1 simulators and my debugging proxy shows that the failure occurs before a connection is actually attempted (i.e. no requests logged).
I have tracked the failure to NSURLConnection and reported bug to Apple. See line 5 in attached image:
.
Changing to use https allows connection from iOS 8 simulators albeit with intermittent errors.
Problem is still present in Xcode 6.01 (gm).
I was experiencing this problem while using Alamofire. My mistake was that I was sending an empty dictionary [:] for the parameters on a GET request, rather than sending nil parameters.
Hope this helps!
Opening Charles resolved the issue for me, which seems very strange...
Charles is an HTTP proxy / HTTP monitor / Reverse Proxy that enables a developer to view all of the HTTP and SSL / HTTPS traffic between their machine and the Internet. This includes requests, responses and the HTTP headers (which contain the cookies and caching information).
what solved the problem for me was to restart simulator ,and reset content and settings.
See pjebs comment on Jan 5 on Github.
Method1 :
if (error.code == -1005)
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
dispatch_group_t downloadGroup = dispatch_group_create();
dispatch_group_enter(downloadGroup);
dispatch_group_wait(downloadGroup, dispatch_time(DISPATCH_TIME_NOW, 5000000000)); // Wait 5 seconds before trying again.
dispatch_group_leave(downloadGroup);
dispatch_async(dispatch_get_main_queue(), ^{
//Main Queue stuff here
[self redoRequest]; //Redo the function that made the Request.
});
});
return;
}
Also some suggests to re-connect to the site,
i.e. Firing the POST request TWICE
Solution: Use a method to do connection to the site, return (id), if the network connection was lost, return to use the same method.
Method 2
-(id) connectionSitePost:(NSString *) postSender Url:(NSString *) URL {
// here set NSMutableURLRequest => Request
NSHTTPURLResponse *UrlResponse = nil;
NSData *ResponseData = [[NSData alloc] init];
ResponseData = [NSURLConnection sendSynchronousRequest:Request returningResponse:&UrlResponse error:&ErrorReturn];
if ([UrlResponse statusCode] != 200) {
if ([UrlResponse statusCode] == 0) {
/**** here re-use method ****/
return [self connectionSitePost: postSender Url: URL];
}
} else {
return ResponseData;
}
}
On 2017-01-25 Apple released a technical Q&A regarding this error:
Apple Technical Q&A QA1941
Handling “The network connection was lost” Errors
A: NSURLErrorNetworkConnectionLost is error -1005 in the NSURLErrorDomain error domain, and is displayed to users as “The network connection was lost”. This error means that the underlying TCP connection that’s carrying the HTTP request disconnected while the HTTP request was in progress (see below for more information about this). In some circumstances NSURLSession may retry such requests automatically (specifically, if the request is idempotent) but in other circumstances that’s not allowed by the HTTP standards.
https://developer.apple.com/library/archive/qa/qa1941/_index.html#//apple_ref/doc/uid/DTS40017602
I was getting this error as well, but on actual devices rather than the simulator. We noticed the error when accessing our heroku backend on HTTPS (gunicorn server), and doing POSTS with large bodys (anything over 64Kb). We use HTTP Basic Auth for authentication, and noticed the error was resolved by NOT using the didReceiveChallenge: delegate method on NSURLSession, but rather baking in the Authentication into the original request header via adding Authentiation: Basic <Base64Encoded UserName:Password>. This prevents the necessary 401 to trigger the didReceiveChallenge: delegate message, and the subsequent network connection lost.
I had the same problem. I don't know how AFNetworking implements https request, but the reason for me is the NSURLSession's cache problem.
After my application tracking back from safari and then post a http request, "http load failed 1005" error will appear.
If I stop using "[NSURLSession sharedSession]", but to use a configurable NSURLSession instance to call "dataTaskWithRequest:" method as follow, the problem is solved.
NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];
config.requestCachePolicy = NSURLRequestReloadIgnoringLocalCacheData;
config.URLCache = nil;
self.session = [NSURLSession sessionWithConfiguration:config];
Just remember to set config.URLCache = nil;.
I have this issue also, running on an iOS 8 device.
It is detailed some more here and seems to be a case of iOS trying to use connections that have already timed out.
My issue isn't the same as the Keep-Alive problem explained in that link, however it seems to be the same end result.
I have corrected my problem by running a recursive block whenever I receive an error -1005 and this makes the connection eventually get through even though sometimes the recursion can loop for 100+ times before the connection works, however it only adds a mere second onto run times and I bet that is just the time it takes the debugger to print the NSLog's for me.
Here's how I run a recursive block with AFNetworking:
Add this code to your connection class file
// From Mike Ash's recursive block fixed-point-combinator strategy https://gist.github.com/1254684
dispatch_block_t recursiveBlockVehicle(void (^block)(dispatch_block_t recurse))
{
// assuming ARC, so no explicit copy
return ^{ block(recursiveBlockVehicle(block)); };
}
typedef void (^OneParameterBlock)(id parameter);
OneParameterBlock recursiveOneParameterBlockVehicle(void (^block)(OneParameterBlock recurse, id parameter))
{
return ^(id parameter){ block(recursiveOneParameterBlockVehicle(block), parameter); };
}
Then use it likes this:
+ (void)runOperationWithURLPath:(NSString *)urlPath
andStringDataToSend:(NSString *)stringData
withTimeOut:(NSString *)timeOut
completionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
{
OneParameterBlock run = recursiveOneParameterBlockVehicle(^(OneParameterBlock recurse, id parameter) {
// Put the request operation here that you want to keep trying
NSNumber *offset = parameter;
NSLog(#"--------------- Attempt number: %# ---------------", offset);
MyAFHTTPRequestOperation *operation =
[[MyAFHTTPRequestOperation alloc] initWithURLPath:urlPath
andStringDataToSend:stringData
withTimeOut:timeOut];
[operation setCompletionBlockWithSuccess:
^(AFHTTPRequestOperation *operation, id responseObject) {
success(operation, responseObject);
}
failure:^(AFHTTPRequestOperation *operation2, NSError *error) {
if (error.code == -1005) {
if (offset.intValue >= numberOfRetryAttempts) {
// Tried too many times, so fail
NSLog(#"Error during connection: %#",error.description);
failure(operation2, error);
} else {
// Failed because of an iOS bug using timed out connections, so try again
recurse(#(offset.intValue+1));
}
} else {
NSLog(#"Error during connection: %#",error.description);
failure(operation2, error);
}
}];
[[NSOperationQueue mainQueue] addOperation:operation];
});
run(#0);
}
You'll see that I use a AFHTTPRequestOperation subclass but add your own request code. The important part is calling recurse(#offset.intValue+1)); to make the block be called again.
If the problem is occurring on a device, check if traffic is going through a proxy (Settings > Wi-Fi > (info) > HTTP Proxy). I had my device setup to use with Charles, but forgot about the proxy. Seems that without Charles actually running this error occurs.
I was connecting via a VPN. Disabling the VPN solved the problem.
I had same problem. Solution was simple, I've set HTTPBody, but haven't set HTTPMethod to POST. After fixing this, everything was fine.
I had to exit XCode, delete DerivedData folder contents (~/Library/Developer/Xcode/DerivedData or /Library/Developer/Xcode/DerivedData) and exit simulator to make this work.
If anyone is getting this error while uploading files to a backend server, make sure the receiving server has a maximum content size that is allowable for your media. In my case, NGINX required a higher client_max_body_size. NGINX would reject the request before the uploading was done so no error code came back.
I was hitting this error when passing an NSURLRequest to an NSURLSession without setting the request's HTTPMethod.
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:urlComponents.URL];
Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost."
Add the HTTPMethod, though, and the connection works fine
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:urlComponents.URL];
[request setHTTPMethod:#"PUT"];
I was facing the same issue,
I have enabled Network Link Conditioner for slow network testing for the app. That was creating this error some times,
When i have disabled it from Settings > Developer > Network Link Conditioner, it solved my problem.
Hope this help someone.
On top of all the answers i found one nice solution. Actually The issue related to network connection fail for iOS 12 onword is because there is a bug in the iOS 12.0 onword. And it Yet to resolved. I had gone through the git hub community for AFNetworking related issue when app came from background and tries to do network call and fails on connection establish. I spend 3 days on this and tries many things to get to the root cause for this and found nothing. Finally i got some light in the dark when i red this blog https://github.com/AFNetworking/AFNetworking/issues/4279
It is saying that there is a bug in the iOS 12. Basically you cannot expect a network call to ever complete if the app os not in foreground. And due to this bug the network calls get dropped and we get network fails in logs.
My best suggestion to you is provide some delay when your app are coming from background to foreground and there is network call. Make that network call in the dispatch async with some delay. You'll never get network call drop or connection loss.
Do not wait for Apple to let this issue solve for iOS 12 as its still yet to fix.
You may go with this workaround by providing some delay for your network request being its NSURLConnection, NSURLSession or AFNetworking or ALAMOFIRE. Cheers :)
I was having this issue for the following reason.
TLDR: Check if you are sending a GET request that should be sending the parameters on the url instead of on the NSURLRequest's HTTBody property.
==================================================
I had mounted a network abstraction on my app, and it was working pretty well for all my requests.
I added a new request to another web service (not my own) and it started throwing me this error.
I went to a playground and started from the ground up building a barebones request, and it worked. So I started moving closer to my abstraction until I found the cause.
My abstraction implementation had a bug:
I was sending a request that was supposed to send parameters encoded in the url and I was also filling the NSURLRequest's HTTBody property with the query parameters as well.
As soon as I removed the HTTPBody it worked.
Whenever got error -1005 then need to call API Again.
AFHTTPRequestOperationManager *manager =
[AFHTTPRequestOperationManager manager];
[manager setSecurityPolicy:policy];
manager.requestSerializer = [AFHTTPRequestSerializer serializer];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
[manager POST:<example-url>
parameters:<parameteres>
success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(#“Success: %#", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(#"Error: %#", error);
if (error.code == -1005) {
// Call method again...
}
}];
You need to Add your code to call function again. MakeSure that you were call method once otherwise its call recursive loop.
I faced the same issue while calling using my company's server from iOS 12 app with a physical device. The problem was that the server hard disk was full. Freeing space in the server solved the problem.
I found the same error in another situation I think due to a timeout not parametrizable through the standard Networking API provided by Apple (URLSession.timeoutIntervalForRequest and URLSession.timeoutIntervalForResource). Even there.. made server answer faster solved the problem
This might be a problem of the parameter that you are passing to request body. I was also facing the same issue. But then I came across CMash's answer here https://stackoverflow.com/a/34181221/5867445 and I changed my parameter and it works.
Issue in a parameter that I was passing is about String Encoding.
Hope this helps.
My problem was on the server. I was using Python's BaseHTTPRequestHandler class and I wasn't sending a body in the response. My problem was solved when I put an empty body like the following.
def do_POST(self):
content_len = int(self.headers.get('Content-Length'))
post_body = self.rfile.read(content_len)
msg_string = post_body.decode("utf-8")
msg_json = json.loads(msg_string)
self.send_response(200)
self.end_headers() #this and the following lines were missing
self.wfile.write(b'')
I had the same issue, the problem was bug of Alomofire and NSUrlSession. When you returning back to app from safari or email you need to wait nearly 2 seconds to do you network response via Alamofire
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
Your network response
}
Got the issue for months, and finally discovered that when we disable DNSSEC on our api domain, everything was ok.

Has there been a change to the way Mac OSX Mavericks handles CFBundleURLName "Custom url" launches for applications?

I created an app which is launched from a custom url in any OSX browser. This worked just fine by adding a standard CFBundleURLName entry to the app's plist.
My application works by reading by parsing some of the parameters on the custom url and then reacting to them.
So for example with a custom url of:
foobar://param1/param2/param3
When clicking on the above url in a browser, OSX would launch my app and pass the actual custom url itself as the first argument to the app. Therefore in the app I could read the first arg and get the url the opened the app, and parse it for params I need.
This works fine in OSX 10.5-10.8, but in 10.9 Mavericks it appears to work slightly differently. Namely that if the application is not already running, it still launches the app but does not pass the custom url as first argument - so the app thinks it's just been launched manually by the user (such as selecting it from launchpad) rather than directly from a browser.
Weirdly, if the application is already open, then clicking the custom url DOES send the url string over to the app as first argument and functionality within the app occurs as expected.
I've tested this across 10.6->10.9 with new and old versions of my app and all exhibit the same behaviour. All work fine on first launch with versions before 10.9 Mavericks, but in 10.9 they don't get the url passed as first arg but then work on 2nd click once already running.
If anyone could shed some light on this I would be very grateful.
Where do you set up your URL handler? It needs to happen early. If you currently have it in applicationDidFinishLaunching, try to move it to applicationWillFinishLaunching.
The following works for me and logs the URL at launch even when the app is not running before I open the URL in Safari, for example. When I change WillFinishLaunching to DidFinishLaunching, I see exactly the behavior you describe.
#implementation AppDelegate
- (void)applicationWillFinishLaunching:(NSNotification *)notification
{
NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager];
[appleEventManager setEventHandler:self andSelector:#selector(handleGetURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL];
}
- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
{
NSAppleEventDescriptor *obj = [event descriptorForKeyword:keyDirectObject];
DescType type = [obj descriptorType];
if (type == typeChar) {
NSData *data = [obj data];
if (data) {
NSString *urlString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSURL *url = [NSURL URLWithString:urlString];
NSLog(#"url: %#", url);
}
}
}
#end

checking app download completion from my own app

so what I'm trying to do here is the following: let's say the user has already installed my app, app "A", from the store. On certain conditions, app "A" will open an URL pointing to a specific app page,app "B", on the App Store passing a redemption code so the user of app A is able to download app "B" without paying any additional money. So here's what I'm doing:
NSString *urlBase = #"https://phobos.apple.com/WebObjects/MZFinance.woa/wa/freeProductCodeWizard?code=";
NSURL *urlRedemptionCode = [NSURL URLWithString:[urlBase stringByAppendingString:code]];
[[UIApplication sharedApplication] openURL:urlRedemptionCode];
This is working fine, so the question is: how do I know that the download of app "B" was completed correctly (or with errors) so I can take appropriate action in app "A"?
Thanks so much.
You could use NSURLConnection in combination with NSURLRequest and NSURLResponse instead of directly calling [[UIApplication sharedApplication] openURL:yourURL].
NSURLConnection will allow you to set a delegate that will be notified when:
Data is (partially) received
Connection failed
Download finished
etc.
Check Using NSURLConnection at the official documentation.

CoreData - Problem accessing database on another machine

I've got a problem with my CoreData, but I'm sure I'm doing something wrong conceptually.
I'm trying to access a CoreData sql file on one machine in my network from another machine. I'm trying to do this from a cluster-like application. Each machine has the same copy of the software and needs to point to the database on this one machine.
My model and context load fine for the machine that the database is on. The other machine, gives me error 13400 NSPersistentStoreInvalidTypeError
Here's the bit of code:
NSError *error = nil;
NSURL *mdlurl = [NSURL fileURLWithPath: [[NSBundle mainBundle] pathForResource:#"OsiriXDB_DataModel" ofType:#"mom"]];
_model = [[NSManagedObjectModel alloc] initWithContentsOfURL: url];
NSURL *dburl = [NSURL URLWithString:[NSString stringWithUTF8String:_DBPath.c_str()]];
// The dburl has a format like: file://192.168.0.2/Users/slate/Documents/OsiriX%20Data/Database.sql which addresses the machine the data sits on.
_storeCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel: _model];
_context = [[NSManagedObjectContext alloc] init];
[_context setPersistentStoreCoordinator: _storeCoordinator];
if (![_storeCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:dburl options:nil error:&error]) {
NSLog(#"Error loading store: %#", error); // Error Shows up Here
NSLog(#"MOM: %#",_model); // Model looks OK. Lots of print outs, with the correct names and stuff. (so technical).
}
I confess to not knowing a ton about CoreData. Is it because it's on a different machine? I read this online but I don't think that's my issue. If it is, I have no idea how to fix it because I can't find any .xml files in my ~/Library/Application\ Support/ directory relating to either MyApp or OsiriX which is the program that created the database.
Am I doing the wrong thing to load CoreData across a network?
If not, what should I be doing?
Thanks,
The error indicates that persistent store coordinator thinks that the file is not the proper format for a NSSQLiteStoreType. That suggest that the file was found. If it couldn't locate the file or access the directory you would get another error.
I'm not sure what you problem is specifically but I can tell you in general that Core Data is not intended as a concurrent database. It's not even really a database at all. It's actually a runtime object graph management system intended to manage an app's model layer with persistence tacked on the side as an option. There are no Core Data options for controlling multiple instances of an app simultaneously accessing the same store. You might be able to do so by setting the store as readonly but I don't know for sure.
It sounds like you need a real database running on your server.

Resources