Hello,

I've found several examples of getting the computer Name but some give warnings about making a pointer from an integer and they all fail with signal EXC_BAD_ACCESS here

    objc_msgSend_vtable5
    _NSDescriptionWithLocaleFunc
    _CFStringAppendFormatAndArgumentsAux
    _CFStringCreateWithFormatAndArgumentsAux
    _CFLogvEx
    NSLogv
    NSLog

Here are three examples I've tried:

1.  CFStringRef temp = SCDynamicStoreCopyComputerName (NULL, NULL);
    NSString * name = [NSString stringWithString: temp];
    return name;

2.  CFStringEncoding encoding = kCFStringEncodingUTF8;
    CFStringRef name = SCDynamicStoreCopyComputerName (NULL, &encoding);
    return name;

3.  #import <SystemConfiguration/SCDynamicStore.h>

    SCDynamicStoreContext context = {0, NULL, NULL, NULL};
    SCDynamicStoreRef store = SCDynamicStoreCreate (kCFAllocatorDefault,
                                                    CFSTR("testStrings"),
                                                    NULL,
                                                    &context);
    NSLog(@"SCDynamicStoreCopyLocalHostName() = %@",
            SCDynamicStoreCopyLocalHostName(store));

According to the docs CFStringRef is toll-free-bridged with NSString and so interchangeable. The authors of the examples cite no issues. Could I have done something to my project to break toll-free bridging? I confess, I haven't thought about toll-free bridging since the WebObjects days.

Thanks for any ideas,

Steve

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to