> On 23 Apr 2015, at 13:50, Graham Cox <[email protected]> wrote:
>
>
>> On 23 Apr 2015, at 3:40 pm, Roland King <[email protected]> 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 protected])
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]