FROM : Frederick Cheung
DATE : Tue Apr 05 19:28:55 2005
On 5 Apr 2005, at 18:36, John C. Warner wrote:
>
> Here are the declares of the NSString's in the header file:
>
> NSString * cLastTrack;
> NSString * cTrackTitle;
>
> And here's the code where the error is being caused:
>
> - (void)poll
> {
> iTunesOpen = [self isiTunesOpen];
> if (!iTunesOpen) return;
> playerState = [self PlayerState];
> [self Volume];
> if (playerState == 0) return;
> [self TrackTitle];
>>
>> if (![cTrackTitle isEqualToString:cLastTrack]) { // <<-- This line
>> here is causing it
>> [self TrackArtist];
>> //[cLastTrack release];
>> cLastTrack = cTrackTitle;
>> }
>> }
>
> Where are you actually initializing and assigning anything to the
> strings? You should probably change the string comparison to something
> like
>
> if (![[self trackTitle] isEqualToString:[self lastTrack]]) {...
>
>
Also, if you declare the NSStrings in the header file, each file
including the header file has its own copy of those variables,
depending on what you are doing you may be initializing one file's copy
and using anothers.
Fred
DATE : Tue Apr 05 19:28:55 2005
On 5 Apr 2005, at 18:36, John C. Warner wrote:
>
> Here are the declares of the NSString's in the header file:
>
> NSString * cLastTrack;
> NSString * cTrackTitle;
>
> And here's the code where the error is being caused:
>
> - (void)poll
> {
> iTunesOpen = [self isiTunesOpen];
> if (!iTunesOpen) return;
> playerState = [self PlayerState];
> [self Volume];
> if (playerState == 0) return;
> [self TrackTitle];
>>
>> if (![cTrackTitle isEqualToString:cLastTrack]) { // <<-- This line
>> here is causing it
>> [self TrackArtist];
>> //[cLastTrack release];
>> cLastTrack = cTrackTitle;
>> }
>> }
>
> Where are you actually initializing and assigning anything to the
> strings? You should probably change the string comparison to something
> like
>
> if (![[self trackTitle] isEqualToString:[self lastTrack]]) {...
>
>
Also, if you declare the NSStrings in the header file, each file
including the header file has its own copy of those variables,
depending on what you are doing you may be initializing one file's copy
and using anothers.
Fred
| Related mails | Author | Date |
|---|---|---|
| Tom Hancocks | Apr 5, 18:26 | |
| John C. Warner | Apr 5, 18:36 | |
| Frederick Cheung | Apr 5, 19:28 |






Cocoa mail archive

