• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
(no subject)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(no subject)


  • Subject: (no subject)
  • From: "Matt Budd (Madentec)" <email@hidden>
  • Date: Wed, 27 Jul 2005 14:39:16 -0600

Thanks for the link Joar, I looked into this a bit, and it seems that by default NSAnimation supports this weak linking. So I can create an executable that contains references to NSAnimation and it compiles/ links fine and then loads fine on both Panther and Tiger machines.

So this works when I am using an NSAnimation directly. I test the value of NSClassFromString(@"NSAnimation") to see if that class is available or not and if it doesn't (which means I am on Panther), then I use my Animation class that mimics NSAnimation.

However, the problem happens when I try to use a subclass of NSAnimation (the suggested way to use NSAnimation). The code still compiles/links okay, but crashes when I try to load it on Panther. See attached code:

------------------------------------------------------------------------ -
if (NSClassFromString(@"NSAnimation") != nil) {
_oAnimator = [[Animator alloc] init]; //Init a subclass of NSAnimation (Animator)
[_oAnimator setDelegate: self];
[_oAnimator setDuration: CF_ANIMATIONDURATION];
[_oAnimator setAnimationCurve: NSAnimationEaseInOut];
[_oAnimator setAnimationBlockingMode: NSAnimationNonblocking];
} else {
_oAnimator = nil; //We are running on Panther, so use my own panther animator later on
}
------------------------------------------------------------------------ -



It kind of makes sense why it crashes, because when it goes to load all the classes on my Panther machine, it then tries to load NSAnimation because Animator is a subclass of it. I never get a chance to test to see if NSAnimation is actually present before it tries to load it as a superclass. This is the error I get:


------------------------------------------------------------------------ -
Exception: EXC_BREAKPOINT (0x0006)
Code[0]: 0x00000001
Code[1]: 0x9086be80


Thread 0 Crashed:
0 libobjc.A.dylib 0x9086be80 _objc_trap + 0
1 libobjc.A.dylib 0x9086be14 _objc_fatal + 0x48
2 libobjc.A.dylib 0x90864b70 _objcInit + 0xf0
3 dyld 0x8fe09638 call_image_init_routines + 0x1f4
4 dyld 0x8fe14294 _dyld_make_delayed_module_initializer_calls + 0x5c
5 com.madentec.test 0x00002b90 _call_mod_init_funcs + 0x34 (crt.c:305)
6 com.madentec.test 0x00002980 _start + 0x9c (crt.c:226)
7 com.madentec.test 0x000028e0 start + 0x3c
------------------------------------------------------------------------ -


Any ideas?

 - Matt



--------------- Original Message ---------------
On 27 jul 2005, at 00.30, Matt Budd (Madentec) wrote:

I want to use the new NSAnimation in my code, but my app has to run in both Tiger and Panther. I've rolled my own Animation class that works similiar to NSAnimation (i.e. notifying the delgate when it hits a certain point in the animation), so I was hoping to be able to use my own class on Panther, and then the NSAnimation class (with bettter implementations) on Tiger.

What is the best way to do this in code. I would prefer one executable instead of having to create two different Targets in my Xcode project. Is there a run-time check to say whether I am running on 10.3 versus 10.4? I have my project set to "Cross- Develop using Target SDK: Mac OS X 10.3.9", since that is miminum requirement.

Thanks for any info...

<http://developer.apple.com/technotes/tn2002/tn2064.html>

j o a r
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Will this cause a leak?
  • Next by Date: Re: Accessing instance method in nib
  • Previous by thread: (no subject)
  • Next by thread: Problems subclassing NSTableView and NSOutlineView
  • Index(es):
    • Date
    • Thread