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

Similar Threads
thread Thread Starter Forum Replies Last Post
Strange ...Top Menu Bar doesn't load! harleymhs MacBook Pro 1 May 30, 2014 12:02 PM
Using a Hyphen In A URL vs. Using A URL with .us TLD steiney Web Design and Development 32 Jul 12, 2013 02:30 PM
http URL load problem larswik Mac Programming 7 May 16, 2013 01:44 PM
Website Load Problem w/ Firefox OS X kbxx Web Design and Development 4 Oct 5, 2012 09:16 PM
URL Not Loading in UIWebView (Redirection Problem) rajanbalana iPhone/iPad Programming 0 Sep 8, 2012 09:56 AM

Forum Jump

All times are GMT -5. The time now is 11:21 AM.

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

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