OSX Entitlement For "system-socket" Responsible for CWInterface Notifications? - objective-c

When I register for CoreWLAN notifications (with a retained interface) like this:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(recieveNetworkNotificationAndRedirectToMainThread:)
name:CWSSIDDidChangeNotification
object:nil];
I receive the notification only when I have all entitlements disabled. None of the default entitlements allow me to receive this (or other CoreWLAN) notification.
Any ideas?
10.7.4
Edit 1:
The Entitlements Reference page did not provide any assistance.
Edit 2:
Faking the notification works fine:
[[NSNotificationCenter defaultCenter]
postNotificationName:CWSSIDDidChangeNotification
object:self];
And none of the other CoreWLAN notifications are received either.
I am sure that this is a simple entitlement that I'm missing... Here is the entitlement file with the temp exception for Growl (removing the temp exception has no effect either):
<?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>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.device.usb</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
<key>com.apple.security.temporary-exception.apple-events</key>
<string>com.Growl.GrowlHelperApp</string>
<key>com.apple.security.temporary-exception.mach-lookup.global-name</key>
<string>GrowlApplicationBridgePathway</string>
</dict>
</plist>
Edit 3:
Compiling for 10.6 using the old k-prefixed notification names has no effect either.
Edit 4:
More information from the logs:
AppName (39009) deny system-socket
Process: AppName [39009] Path:
/Users/username/Library/Developer/Xcode/DerivedData/AppName-fnxrpqnodsouovcaxgiocvnfpqor/Build/Products/Release/AppName/Contents/MacOS/AppName
Load Address: 0x10d23f000 Identifier: AppName Version:
??? (???) Code Type: X86-64 (Native) Parent Process:
debugserver [39007]
Date/Time: 2012-07-20 13:17:11.851 -0700 OS Version: Mac OS
X 10.7.4 (11E2705) Report Version: 7
Backtrace: 0 libsystem_kernel.dylib 0x00007fff98704e76
socket + 10 1 CoreWLAN 0x00007fff951f4a6f
Apple80211EventMonitoringInit2 + 53 2 CoreWLAN
0x00007fff951e6dc4 -[CWInterface initWithInterfaceName:] + 1358 3
CoreWLAN 0x00007fff951e412d +[CWInterface
interfaceWithName:] + 52 4 CoreWLAN
0x00007fff951e41a8 +[CWInterface interface] + 98
Edit 5:
Found this reference to deny system-socket in sandboxd, but no help yet.

I am able to get SSID changes and updates with my app sandboxed using the networknotifier code in hardwaregrowler - I think because its looking for specific notifications.
http://code.google.com/p/growl/source/browse/Extras/HardwareGrowler/?name=default
Once I am notified of a change:
if(wif==nil){
wif = [CWInterface interface];
[wif retain];
}
if(!wif.serviceActive){
skip=TRUE;
}
if(wif.ssid==nil){
skip=TRUE;
}
if(!skip)
if(wif){
NSLog(#"We are on the WiFi network: %#",wif.ssid);
}

Related

unable to open url: tel xxx by Linking.openURL(jumpUrl) in ios 10

When I code in my xxx.tsx file with the below content:
const jumpUrl = "tel:" + mobileNumber;
Linking.openURL(jumpUrl);
After then, In our crash monitor website, I found that the MRN crash occurred in iOS 10.3.3 device:
Unable to open URL: tel:xxx, so I want to know how to fix it

OS X Server & NSAppTransportSecurity HTTP load failed

I'm using OS X Server 4.1.3 and an iPhone 6 with iOS9 Beta-4.
When I try to connect to the OS X Server ("skw.local") with
let urlPath: String = "https://skw.local/"
let url: NSURL = NSURL(string: urlPath)!
let request: NSMutableURLRequest = NSMutableURLRequest(URL: url)
let sessionConfig = NSURLSessionConfiguration.defaultSessionConfiguration()
let sesh = NSURLSession(configuration: sessionConfig)
let task = sesh.dataTaskWithRequest(request) {(data, response, error) -> Void in
if error == nil {
print("Response: \(response)")
}
else {
print(error, appendNewline: true)
}
}
task.resume()
I get the following error:
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)
You might be connecting to a server that is pretending to be “skw.local” which could put your confidential information at risk."
I have tried bypassing the NSAppTransportSecurity requirements by adding the following to my Info.plist:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key><true/>
</dict>
but I get the same errors.
Anyone else having similar trouble?
edit: I also posted this over on apple's dev forum

Alamofire: Timeout happening sometimes without any particular reason

Sometimes when starting the app, all requests will timeout with these logs :
| request: <NSMutableURLRequest: 0x170006aa0> { URL: http://#host#/api/settings?version=1428591014 }
| response: nil
| json: nil
| error: Optional(Error Domain=NSURLErrorDomain Code=-1001 "La requête a expiré." UserInfo=0x1740f0380 {NSUnderlyingError=0x174056440 "L’opération n’a pas pu s’achever. (kCFErrorDomainCFNetwork erreur -1001.)", NSErrorFailingURLStringKey=http://#host#/api/settings?version=1428591014, NSErrorFailingURLKey=http://#host#/api/settings?version=1428591014, NSLocalizedDescription=La requête a expiré.})
and here is an example of code responsible for the request call:
Alamofire.request(AppRouter.Settings.RetrieveAppSettings(Settings.sharedInstance.version))
.validate(contentType: ["application/json"])
.validate(statusCode: [200])
.responseJSON { (req, res, json, error) in
if error != nil {
// log error to local file
}
else {
// do something with data
}
}
When it happens, all the requests will fail with the same logs. One have to kill the app manually (home button) and restart it again and then all requests will succeed…
Anyone have some ideas plz ?
I had this same problem as far as I remember. It's a question of http connections not being allowed per default with newer versions of Xcode. I experienced the problem when switching to the Xcode-beta 7.0, but might have been earlier versions as well.
Try adding the following to your info.plist:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>--- YOUR DOMAIN NAME HERE - EXAMPLE: example.com ---</key>
<dict>
<key>NSIncludeSubdomains</key>
<true/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
This allows http connections to the domain you want. Add as many domains you want as key dict pairs in the dict corresponding to NSExceptionDomains.
To insert this as XML, right click info.plist and click "Open as" -> "Source code".
Then add the above XML just before the tags at the end of the document.
Hope this works out for you :)

ios - Sparrow mail app crashes on 5.0.1 - want to build a fix, mobile substrate help needed

yesterday, I downloaded the Sparrow mail app, which is crashing instant after startup.
Following crash log is generated:
Incident Identifier: [TODO]
CrashReporter Key: [TODO]
Hardware Model: iPhone4,1
Process: Sparrow [64701]
Path: /var/mobile/Applications/2D0B2A21-4BE0-4A1E-9119-B16FAA3A1572/Sparrow.app/Sparrow
Identifier: com.sparrowmailapp.iphoneapp
Version: 507.54
Code Type: ARM
Parent Process: launchd [1]
Date/Time: 2013-01-14 23:57:46 +0000
OS Version: iPhone OS 5.0.1 (9A406)
Report Version: 104
Exception Type: SIGABRT
Exception Codes: #0 at 0x305e132c
Crashed Thread: 0
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '-[UINavigationBar setShadowImage:]: unrecognized selector sent to instance 0x9b1e70'
The problem is the property "shadowImage" in UINavigationBar, which doesn't exist on iOS 5.
Now i´m trying to build a mobile substrate addon to avoid the crash, adding the missing property to UINavigationBar with overwrite and following code:
#import <Foundation/Foundation.h>
#interface UINavigationBar(MyNavigationBar)
#property(nonatomic,retain) UIImage *shadowImage NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR;
#end
%hook UINavigationBar
- (void)setShadowImage:(UIImage *)shadowImage forToolbarPosition:(id)topOrBottom {
%log;
//%orig;
}
- (void)setShadowImage:(UIImage *)shadowImage {
%log;
//%orig;
}
%end;
I have no idea, to set the shadowImage or UI_APPEARANCE_SELECTOR correctly.
Any ideas? Thanks
Oh god, these methods should be normal setter/getter of the shadowImage.
Problem resolved.

Open SCO Audio Connection with IOBluetoothAddSCOAudioDevice

I am trying to emulate a HandsFree device from Mac OS X.
I advertise correctly my SDP service as Handsfree
I can pair my Android phone to my computer which is seen as "HandsFree" device
I can send a couple of AT Commands (AT+BRST, CIND, CMER) to establish a service level connection
I then install an Audio Driver to route all incoming/outgoing sound to/from the device
Unfortunately, it seems that the SCO channel is never opened. My android phone still emits sound (i.e.: when pressing dial pad) on its own speaker.
When going in the sound preferences of Mac OS X, I can see my device as an input/output device but the sound level never change.
Here is my code :
(void)rfcommChannelData:(IOBluetoothRFCOMMChannel*)rfcommChannel data:(void *)dataPointer length:(size_t)dataLength
{
... STATE MACHINE GOES HERE and SEND AT COMMANDS ...
... AT CMER OK RECEIVED ...
ret = IOBluetoothAddSCOAudioDevice([[rfcommChannel getDevice] getDeviceRef], NULL);
if (ret != kIOReturnSuccess ){
IOBluetoothRemoveSCOAudioDevice([[rfcommChannel getDevice] getDeviceRef]);
NSLog(#"%#", #"Deleting previously audio device");
ret = IOBluetoothAddSCOAudioDevice([[rfcommChannel getDevice] getDeviceRef], NULL);
if (ret != kIOReturnSuccess) {
NSLog(#"%#", #"Can't install Audio Driver");
}
}
Any idea on why the Audio Driver is installed and reported by the system but can't open an SCO connection ?