Re: Test for typeName failing
Re: Test for typeName failing
- Subject: Re: Test for typeName failing
- From: "Stephen J. Butler" <email@hidden>
- Date: Mon, 19 Jan 2009 18:12:37 -0600
On Mon, Jan 19, 2009 at 6:01 PM, Walker Argendeli
<email@hidden> wrote:
> In my readFromURL:ofType:error: method, I'm testing to see if typeName is
> equal to a string representing zip, and then taking action based off of
> that. The problem is that even when I load a zip, the statement fails. I
> logged tpeName to the console to get what it was for zip, so I don't
> understand why, when I test for that, it fails. What's going on?
> Here's the code:
> if (typeName == @"public.zip-archive")
> [task setLaunchPath:@"/usr/bin/zipinfo"];
Objective-C, just like C, does not have overloaded operators. You are
comparing the POINTER of typeName to the POINTER of the NSString
constant. Not going to work. What you want to do is this:
[typeName isEqualToString:@"public.zip-archive"]
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden