Re: Linking to MLMediaSourcePhotosIdentifier
Re: Linking to MLMediaSourcePhotosIdentifier
- Subject: Re: Linking to MLMediaSourcePhotosIdentifier
- From: Roland King <email@hidden>
- Date: Thu, 23 Apr 2015 14:06:47 +0800
> On 23 Apr 2015, at 13:50, Graham Cox <email@hidden> wrote:
>
>
>> On 23 Apr 2015, at 3:40 pm, Roland King <email@hidden> wrote:
>>
>> That’s because you didn’t read properly. Check if THE ADDRESS OF THE STRING CONSTANT is NULL.
>>
>> The address of the string constant is &MLMediaSourcePhotosIdentifier
>
>
> I read fine.
>
> I may be confused, but my understanding is that extern NSString* const <blah> IS an address.
>
> Also, adding the explicit & confuses the compiler - it then marks that code as dead, stating it will never be executed. I’m not sure how it comes to that conclusion exactly, but it tends to suggest that taking the address of an extern string constant is not a sensible operation.
>
> —Graham
>
>
#import <Foundation/Foundation.h>
#import <MediaLibrary/MediaLibrary.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSString * const *test = &MLMediaSourcePhotosIdentifier;
if( test == NULL )
{
NSLog( @"The string appears to be missing - sad faces all around" );
}
else
{
NSLog( @"Holy halleujia we have a string and it is %@ or even %@", *test, MLMediaSourcePhotosIdentifier );
}
}
return 0;
}
Works for me - in the positive case at least as I don’t have a 10.9 machine to test it on.
_______________________________________________
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