Your crash is happening because you're releasing something you shouldn't be. The CGImage you're getting from the UIImage was not accessed through a Create* or Copy* function and therefore you are not responsible for it and have no need to call the CGImageRelease function.

______
Ashley

On Nov 1, 2008, at 12:26 PM, Jeshua Lacock <[EMAIL PROTECTED]> wrote:


On Oct 31, 2008, at 12:13 PM, John Harper wrote:

I described how to do this using a CAKeyframeAnimation in a previous thread:

http://www.cocoabuilder.com/archive/message/cocoa/2008/8/3/214715

I am trying to adapt this technique for the iPhone SDK, but attempting to add the images NSArray to the KeyFrame animation causes my program to crash.

I heard that last week an iPhone dev list was created at Apple, but I have not been able to find it. I hope this is similar enough to be on-topic here, as I am using the same classes for the most part.

I can't find any examples that specify an image or array of images for the 'setValues' property.

NSArray *redExplode;
NSMutableArray *images;
images = [NSMutableArray array];
CGImageRef im;
UIImage *thisImg;
int p;

//frames ommitted for brevity
redExplode = [[NSArray arrayWithObjects:
  [UIImage imageNamed:@"redExlode.00000.png"],
  [UIImage imageNamed:@"redExlode.00001.png"],
  nil] retain];

for(p = 0;p<[redExplode count];p++)
{
   thisImg = [redExplode objectAtIndex: p];
   im = thisImg.CGImage;
   [images addObject:(id)im];
   CGImageRelease (im);
}

[anim setKeyPath:@"contents"];
[anim setValues:images];
[anim setCalculationMode:@"discrete"];
[anim setRepeatCount:HUGE_VAL];

[[UIAnimator sharedAnimator] addAnimation:anim withDuration:1.5 start:YES];


A backtrace reveals:

#0  0x950886ec in objc_msgSend ()
#1  0x9539d57f in NSPopAutoreleasePool ()
#2  0x953d6974 in __NSFireDelayedPerform ()
#3  0x96c10b45 in CFRunLoopRunSpecific ()
#4  0x96c10cf8 in CFRunLoopRunInMode ()
#5  0x31699d38 in GSEventRunModal ()
#6  0x31699dfd in GSEventRun ()
#7  0x30a5dadb in -[UIApplication _run] ()
#8  0x30a68ce4 in UIApplicationMain ()
#9 0x00002d3c in main (argc=1, argv=0xbfffef68) at /Developer-3.1.0/ Examples/iPhone/MoveMe/main.m:53

The assembly that is crashing is:

0x950886ec  <+0028>  mov    0x0(%edi),%esi


If I comment out the line "[anim setValues:images];", the program does not crash.

Any ideas?


Thanks,

Jeshua Lacock
Founder/Programmer
3DTOPO Incorporated
<http://3DTOPO.com>
Phone: 877.240.1364

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/aclark%40ghoti.org

This email sent to [EMAIL PROTECTED]

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to