• 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
Fwd: Developing for Tiger and Panther;
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: Developing for Tiger and Panther;


  • Subject: Fwd: Developing for Tiger and Panther;
  • From: "Matt Budd (Madentec)" <email@hidden>
  • Date: Wed, 27 Jul 2005 15:48:07 -0600

I am really stuck with this cross development when it comes to subclasses. I've boiled it down to the simplest example that I can not get to work.

1. Create a new Xcode 2.1 project on Tiger
2. Take off ZeroLink from the target's build settings
3. Add a new cocoa class called "untitled"
4. Change untitled.h to make it be a subclass of NSAnimation (instead of NSObject)
5. Run the application on Tiger...it works correctly
6. Copy the application bundle to a Panther machine and run it...it crashes with a crash log
7. Change untitled.h to instead of being a sublcass of NSAnimation having a NSAnimation ivar
8. Build and run the app on Tiger...it works correctly
9. Copy and run the app on Panther...it also works correctly



Basically, what do I have to do to make step #6 not crash when it runs on a Panther machine?


 - Matt


Begin forwarded message:

From: "Matt Budd (Madentec)" <email@hidden>
Date: July 27, 2005 2:39:16 PM MDT (CA)
To: j o a r <email@hidden>
Cc: Cocoa-Dev Apple <email@hidden>


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
  • Follow-Ups:
    • Re: Developing for Tiger and Panther;
      • From: j o a r <email@hidden>
    • Re: Developing for Tiger and Panther;
      • From: Brian Bergstrand <email@hidden>
  • Prev by Date: Re: NSThread, drawing and waiting
  • Next by Date: RE: Accessing instance method in nib
  • Previous by thread: Re: Developing for Tiger and Panther;
  • Next by thread: Re: Developing for Tiger and Panther;
  • Index(es):
    • Date
    • Thread