am I DECLAREing wrong?
Posted: Sat Apr 17, 2010 11:41 am
I want to initialize a data instance from an URL an am trying so, by declaring some support methods. The class and instance methods are directly taken from Apple's class references.
When trying to compile this code the compiler throws an error:
What am I doing wrong?
Thanks for your answer
Udo
- Code: Select all
Declare Function "NSData" - (id)initWithContentsOfURL:(NSURL *)aURL
Declare Function "NSData" + (id)data
Declare Function "NSData" + (id)dataWithContentsOfURL:(NSURL *)aURL
Declare Function "NSData" + (id)dataWithData:(NSData *)aData
Declare Class "NSURL"
Declare Function "NSURL" + (NSURL *)URLWithString:(NSString *)URLString
Declare Function "NSURL" - (BOOL)isFileURL
Declare Function "NSURL" - (NSString *)relativePath
Declare Function "NSURL" - (NSArray *)pathComponents
Event AwakeFromNib()
Dim myURL As NSURL
Dim myData As NSData
Dim myData2 As NSData
Dim myArray As Array
Log("AwakeFromNib")
' myURL stuff compiles and works like expected
myURL = NSURL.URLWithString("http://www.heise.de/")
Log(myURL)
Log(myURL.isFileURL())
Log(myURL.relativePath())
myArray=myURL.pathComponents()
' myData=NSData.data() ' <- this works (compiles and runs correctly)
myData=NSData.dataWithContentsOfURL(myURL) ' <- this fails (doesn't even compile)
myData2=NSData.dataWithData(myData) ' <- this works, when using myData=NSData.data() (see above)
Log(myData)
Log(myData2)
Log(myArray)
End Event
When trying to compile this code the compiler throws an error:
What am I doing wrong?
Thanks for your answer
Udo