I'm trying to access the RSSI values of several APs around me using an iPod Touch 4G with iOS6.1 and Xcode 4.6.3 with a valid Provisioning Profile. I've read some discussions about this topic and the best way to do this seems to be using the private Framework MobileWifi. Since this project is for private usage only I'm ok with that.
According to this website I need a special entitlement in order to access the MobileWiFi functions. I've never worked with entitlements before, but according to some examples my .entitlement file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)com.apple.wifi.manager-access</string>
</array>
</dict>
</plist>
I also did a jailbreak and installed AppSync in order to get rid of errors according to invalid entitlements. I am able to run the app on my iPod, but every time i want to check for networks or devices the app crashes. Here is my code so far:
WiFiManagerRef manager = WiFiManagerClientCreate(kCFAllocatorDefault, 0);
if (!manager)
NSLog(@"ERROR: Couldn't create WiFiManagerClient!");
CFArrayRef devices = WiFiManagerClientCopyDevices(manager);
if (!devices)
NSLog(@"ERROR: devices is NULL");
CFArrayRef networks = WiFiManagerClientCopyNetworks(manager);
if (!networks)
NSLog(@"ERROR: networks is NULL");
NSLog(@"manager: %@", manager);
NSLog(@"%d devices: %@", (int)CFArrayGetCount(devices), devices);
NSLog(@"%d networks: %@",(int)CFArrayGetCount(networks), networks);
It seems that the WiFiManagerClientCopyDevices
and WiFiManagerClientCopyNetworks
methods return some bad values, if I set some checkpoint to check their addresses they're 0x00000000 after calling these methods and the app crashes due to EXC_BAD_ACCESS when returning their array count.
I've read that the MobileWifi functions won't work if I won't use the correct entitlements. Some others wrote that instead of a .entitlement file one should use a entitlement.xml file and use ldid
to code sign the app and transfer it onto the device, but I don't like to do this manually since I prefer using Xcode's debugger and console while coding.
I spent a whole day trying to get rid of these problems but I didn't find any solutions, so I would be really glad if someone could help me out with this!
To me it looks like your entitlements file is incorrect.
You have replaced your bundle id with the wifi.manager-access entitlement. You need to leave the keychain-access-group as it was and add the wifi.manager-access entitlement at the end of the file as new key/value pair.
Generate a new entitlement file in Xcode and add the following key/value pair.
Your custom entitlements file should finally look something like that: