NSHTTPCookieStorage again

Discussion in 'Mac Programming' started by BollywooD, Apr 28, 2009.

  1. BollywooD macrumors 6502

    BollywooD

    Joined:
    Apr 27, 2005
    Location:
    Surfers Paradise
    #1
    I found this code, online - and it seems like it would do what I want. that is clear the NSHTTPCookieStorage immediately. However it wont compile?

    It gives me the error:
    Code:
    error Ivar undeclared, error ivar undeclared
    heres the code:

    Code:
    Ivar    ivar;
    void*   internal = NULL;
    ivar = object_getInstanceVariable(storage, "_internal", &internal);
    if (internal) {
    	void*   diskStorage = NULL;
    	ivar = object_getInstanceVariable((id)internal, "storage", &diskStorage);
    	if (diskStorage) {
    		objc_msgSend(diskStorage, @selector(_saveCookies));
    		}
    	}
    Im still learning cocoa, and I cant get my head around this, does anyone know what going wrong here?

    I am compiling for Leopard
    thanks in advance
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    To fix the compile error add #import <objc/objc-class.h>

    That code may work for 10.4, but not for 10.5. What it's doing is equivalent to
    [storage->_internal _saveCookies] but _saveCookies is no longer defined as a method on the _internal object (which really is NSHTTPCookieStorageInternal), and so it will no longer work on Leopard.
     
  3. BollywooD thread starter macrumors 6502

    BollywooD

    Joined:
    Apr 27, 2005
    Location:
    Surfers Paradise
    #3
    thanks, kainjow

    ill figure out some other way.
     
  4. BollywooD thread starter macrumors 6502

    BollywooD

    Joined:
    Apr 27, 2005
    Location:
    Surfers Paradise
    #4
    Does anyone know of a way to make this work on Leopard?
    :confused:
     

Share This Page