Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ArtOfWarfare

macrumors G3
Original poster
Nov 26, 2007
9,544
6,042
I got an email from a customer complaining that they're unable to use my app because any time they click on the status item icon, an error pops up telling them "There was a problem connecting to the server 'rms'." The customer says that the error pops up once an hour and when they click on the icon, which is exactly when the code I've posted below runs:

Code:
- (void)updateMenu
{
    NSLog(@"Updating.");
    
    if (updateTimer && [updateTimer isValid])
    {
        [updateTimer invalidate];
    }
    
    [statusMenu removeAllItems];
    
    updateTimer = [NSTimer scheduledTimerWithTimeInterval:3600 target:self selector:@selector(updateMenu) userInfo:nil repeats:NO];
    
    //Get the list of devices attached.
    mach_port_t     masterPort;
    kern_return_t   kr;
    io_iterator_t   ite;
    io_object_t     obj = 0;
    CFMutableDictionaryRef  properties;
    
    kr = IOMasterPort(bootstrap_port, &masterPort);
    if (kr != KERN_SUCCESS)
        printf("IOMasterPort() failed: %x\n", kr);
    
    kr = IORegistryCreateIterator(masterPort,
                                  kIOServicePlane,
                                  true,              /*recursive */
                                  &ite);
    
    while ((obj = IOIteratorNext(ite)))
    {
        kr = IORegistryEntryCreateCFProperties(obj,
                                               &properties,
                                               kCFAllocatorDefault,
                                               kNilOptions);
        
        if ((kr != KERN_SUCCESS) || !properties)
        {
            printf("IORegistryEntryCreateCFProperties error %x\n", kr);
        }
        
        else
        {
            CFNumberRef percent = (CFNumberRef) CFDictionaryGetValue(properties, CFSTR("BatteryPercent"));
            if (percent)
            {
                //A lot of code that I don't think is relevant omitted.
            }
            
            else
            {
                //The device being checked didn't have "BatteryPercent" as a property.
            }
        }
    }
    //A lot more code that I don't think is relevant omitted... it just creates and adds NSMenuItems.
}

I suspected "kIOServicePlane" might have been the issue, so I replaced it with "kIOPowerPlane", made a special build just for the user, told them to delete the version they have and install the special build in its place, but they say the error continues to occur.

Any suggestions as to what is causing the problem? Is there some way I can update my app to still access battery information without causing this error window to show up? If not, suggestions as to how to handle the customer? Should I tell them that I'm sorry, there's no way for me to fix the issue, and they should seek a refund through Apple?
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
It sounds like a local problem on their computer. I googled "There was a problem connecting to the server" and it's a general OS X error about connecting to a server, most likely because some app is still holding a reference to a server.

What is "rms"? You could ask them if they know what it is.

https://discussions.apple.com/thread/3712265 suggests it's related to their anti-virus.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.