• 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
Re: Null result from NSArray objectAtIndex
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Null result from NSArray objectAtIndex


  • Subject: Re: Null result from NSArray objectAtIndex
  • From: Will Mason <email@hidden>
  • Date: Wed, 23 Mar 2005 14:15:25 -0800 (PST)
  • Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys

If your palImage is coming up nil for a set of the desired images, then
according to the NSImage docs no image by that name could be found in
the app's main bundle. Are you sure you've got all the images there?
Also, I don't understand your reference to "3 of the 6 'pal' images",
as you only seem to deal with three in the code given.

Could you clarify? Thanks,
Will

--- "A.Sleep" <email@hidden> wrote:
> I'm having an issue with this little app I'm porting/rewriting... The
>
> code is available for review @ http://www.asleep.net/hacking/
> OSXPal_1.0-ALPHA.zip. The primary issue is in OSXPal.m in the
> changeDockIcon method.
>
> This is a port of my app wmpal a Window Maker dockapp available @ the
>
> same site but hacking/wmpal/.
>
> Users can choose a "pal" which will determine the appicon in the doc.
>
> Every X seconds (by timer) the appicon is changed to an icon in the
> group of 3 belonging to each of the "pals". I've got NSLog messages
> in the current OSXPal.m file and watching the application run one can
>
> see 3 of the 6 "pal" images work as expected, however the other 3
> come up as (null) and I'm _very_ confused as to why.
>
> If anyone could take the time to review this for me and point me in
> the right direction I'd be grateful. I'm starting to pull my hair out
>
> (and that doesn't feel very good since I shave my head).
>
> Method from described OSXPal.h below:
>
> - (void)changeDockIcon:(NSTimer *)timer
> {
>      NSString *palImageSetting = [[NSUserDefaults
> standardUserDefaults] stringForKey:@"palImage"];
>
>      NSLog(@"palImageSetting: %s", [palImageSetting cString]);
>
>      if (!palImageSetting) {
>          palImageSetting = @"Dino";
>      }
>
>      NSString *icnsOneSuffix     = @"1.icns";
>      NSString *icnsTwoSuffix     = @"2.icns";
>      NSString *icnsThreeSuffix   = @"3.icns";
>      NSMutableString *ImageOne   = [NSMutableString stringWithFormat:
>
> @"%@ %@", palImageSetting, icnsOneSuffix];
>      NSMutableString *ImageTwo   = [NSMutableString stringWithFormat:
>
> @"%@ %@", palImageSetting, icnsTwoSuffix];
>      NSMutableString *ImageThree = [NSMutableString stringWithFormat:
>
> @"%@ %@", palImageSetting, icnsThreeSuffix];
>      NSArray *palImages          = [[NSArray alloc]
> initWithObjects:ImageOne,ImageTwo,ImageThree,nil];
>
>      time_t t;
>      int waitTime;
>
>      srand(time(&t));
>      waitTime = rand() % maxWait +1;
>
>      timer = [NSTimer scheduledTimerWithTimeInterval:waitTime
> target:self selector:@selector(changeDockIcon:) userInfo:nil
> repeats:NO];
>
>      NSLog(@"Grabbing object at position %i.", position);
>
>      NSImage *palImage = [NSImage imageNamed:[palImages
> objectAtIndex:position]];
>
>      NSLog(@"Setting application icon to %s and setting timer for %i
>
> seconds...", [[palImage name] cString], waitTime);
>
>      [NSApp setApplicationIconImage:palImage];
>
>      if (position >= 2) {
>          position = 0;
>      }
>      else {
>          position++;
>      }
>
> }
>
> ---
> A.Sleep - Jeraimee Hughes
> Email: email@hidden
> Cell: 954.854.3155
>
>  _______________________________________________
> 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
>
 _______________________________________________
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: Null result from NSArray objectAtIndex (Solved)
      • From: "A.Sleep" <email@hidden>
  • Prev by Date: Re: Null result from NSArray objectAtIndex
  • Next by Date: Re: create a server listening on a specific port
  • Previous by thread: Re: Null result from NSArray objectAtIndex
  • Next by thread: Re: Null result from NSArray objectAtIndex (Solved)
  • Index(es):
    • Date
    • Thread