Having a problem with applescript object c app.
Hi,
Just wondering if anyone can help me with this.
I am building a little application in xcode that basically attempts to get certain images by a designated url and then displays them within the app in an image well. If the images do not exists at the assisgned URL then it will display a question mark. here is an exampole of the main bit of code it uses;
on applicationrunthatshit_(sender)
------ error image
try
set imageurlerror to("http://content.answcdn.com/main/content/img/getty/5/2/CC000552.jpg")
set theURLerror to current application's NSURL's URLWithString_(imageURLerror)
set theImageerror to current application's NSImage's alloc's initWithContentsOfURL_(theURLerror)
end try
------ SWATCH
try
set imageurl to ("http://static.guim.co.uk/sys-images/Technology/Pix/pictures/2012/8/8/13444203329 67/Google-basketball-008.jpg")
set theURL to current application's NSURL's URLWithString_(imageURL)
set theImage to current application's NSImage's alloc's initWithContentsOfURL_(theURL)
theImage's setSize_({50, 50})
swatch_preview's setImage_(theImage)
on error
swatch_preview's setImage_(theImageerror)
end try
------ UNDERSCORE 1
try
set imageurl to ("http://static.guim.co.uk/sys-images/Technology/Pix/pictures/2012/8/8/13444203329 67/Google-basketball-008.jpg")
set theURL to current application's NSURL's URLWithString_(imageURL)
set theImage to current application's NSImage's alloc's initWithContentsOfURL_(theURL)
theImage's setSize_({50, 75})
underscore1_default_l's setImage_(theImage)
on error
underscore1_default_l's setImage_(theImageerror)
end try
end applicationrunthatshit_
The problem I am having is that every couple of uses the app will crash and the error code in xcode is :
objc[7543]: Object 0x100506980 of class __NSCFString autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug
When it works it does exactly what I wanted it to do, but it comes up with this error about 50% of the time. I'm not expert with xcode so If anyone could point me in the right direction that would be great!
Thanks in advance,
Mark
xcode-OTHER, Mac OS X (10.7.5)