Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old May 8, 2013, 09:27 PM   #1
larswik
macrumors 65816
 
Join Date: Sep 2006
Strange URL load problem

I wrote a Mac program that I can select a local image, resized it and pass to a PHP file to save to my server, which works fine. The other part of the program loads the file from the server back in to the program which I have the problem with.

I have 6 images named "photo0.jpg", "photo1.jpg" and so on. So if a photo exists it over writes it in the PHP code, which it does, and I varified that. But in my objective C code it is loading the old image file still?

Code:
    int photoNum = [photos intValue]; // gets the count for the num of photos.
    for (int i = 0; i <  photoNum; i++) {
        NSString *photoImagePath = [NSString stringWithFormat:@"%@%@",folderPath,[fileNameArray objectAtIndex:i]];
        NSImage *photoImage = [[NSImage alloc]initWithContentsOfURL:[NSURL URLWithString:photoImagePath]];
        NSImageView *photoView = [photoObjectArray objectAtIndex:i];
        photoView.image = photoImage;

    }
When I check the paths manually using FireFox it show the correct image, or the new one that was replaced. But when I load it from with in my program the correct path displays the old image that should have been overwritten?

I even stop the app, quit out of xcode, re launch and reload the images and the same thing? The program works without error, it is just retrieving the file that should have been over written. Is something buffered that needs cleaning out?

Any ideas?
__________________
I know more than yesterday.
Lars
larswik is offline   0 Reply With Quote
Old May 9, 2013, 05:05 PM   #2
larswik
Thread Starter
macrumors 65816
 
Join Date: Sep 2006
After about 20 hours of debugging the problem was with with GCD. Background threads are tricky if you are expecting it to return data by the time the main thread needs it.

It was difficult to go line by line when you have a number of threads happening at the same time.
__________________
I know more than yesterday.
Lars
larswik is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 12:13 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC