mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-26 04:57:54 +00:00
Add XPC service for local message port
This should work under 10.12 (beta) environment now when sandboxed.
This commit is contained in:
1 parent
911f2150f9
commit
061e99995f
14 files changed
+519
-106
No files matched your search
@@ -0,0 +1,31 @@
|
||||
<?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>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2016 Sparkle Project. All rights reserved.</string>
|
||||
<key>XPCService</key>
|
||||
<dict>
|
||||
<key>ServiceType</key>
|
||||
<string>Application</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// main.m
|
||||
// LocalMessagePort
|
||||
//
|
||||
// Created by Mayur Pawashe on 6/14/16.
|
||||
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SULocalMessagePort.h"
|
||||
#import "SULocalMessagePortDelegate.h"
|
||||
|
||||
@interface ServiceDelegate : NSObject <NSXPCListenerDelegate>
|
||||
@end
|
||||
|
||||
@implementation ServiceDelegate
|
||||
|
||||
- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection {
|
||||
// This method is where the NSXPCListener configures, accepts, and resumes a new incoming NSXPCConnection.
|
||||
|
||||
// Configure the connection.
|
||||
newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SULocalMessagePortProtocol)];
|
||||
newConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SULocalMessagePortDelegate)];
|
||||
|
||||
newConnection.exportedObject = [[SULocalMessagePort alloc] initWithDelegate:newConnection.remoteObjectProxy];
|
||||
|
||||
// Resuming the connection allows the system to deliver more incoming messages.
|
||||
[newConnection resume];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
// Create the delegate for the service.
|
||||
ServiceDelegate *delegate = [ServiceDelegate new];
|
||||
|
||||
// Set up the one NSXPCListener for this service. It will handle all incoming connections.
|
||||
NSXPCListener *listener = [NSXPCListener serviceListener];
|
||||
listener.delegate = delegate;
|
||||
|
||||
// Resuming the serviceListener starts this service. This method does not return.
|
||||
[listener resume];
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user