Hi,
I've set the C++ language dialect in my project to c++2a.
Than it failed on compiling .mm file which has the following line
@import AppKit;
But if replace it with the following line and link with framework from project build phases, than it works.
#import <AppKit/AppKit.h>
My .mm file is including for adapter swift header file (*-Swift.h) which is auto generated and has this @import directive.
is it a known issue, should I file a bug ?
Post
Replies
Boosts
Views
Activity
I've got the following code that I use to communicate with a remote server. However, when the response contain a large enough file, the callback block never called, the only thing that trigger the callback, is when I explicitly invoke the cancel method after some timeout from the NSURLSession task (_dataTask).
notice that using tcpdump I did observe that the response was properly received on the client side.
NSURLSessionConfiguration* config = [NSURLSessionConfiguration defaultSessionConfiguration];
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
queue.maxConcurrentOperationCount = 1;
NSURLSession* session = [NSURLSession sessionWithConfiguration:config delegate:nil delegateQueue:queue];
_dataTask = [session dataTaskWithRequest:req completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
if ([error code] == NSURLErrorCancelled) {
writeLog(LOG_ERROR, "NSURLErrorCancelled");
} else {
<my completion callback>
}
}];
[_dataTask resume]
I'd like to know if using dataTask has response size limit (because it's working for small files on response body)
and if there is such a limit, so which other method should I use in order to overcome it. I saw that there's an alternative method in NSUrlsession dedicated for downloading files called downloadTaskWithRequest but it doesn't have an async completion block.
Hi,
I've got an object from type NSURLSessionWebSocketTask from which I create webSocket.
However, currently it can only receive responses as can be seen here:
NSURLSessionWebSocketMessage * msg = [[NSURLSessionWebSocketMessage alloc] initWithString:myStringBody;
[socketConnection sendMessage:msg completionHandler: ^(NSError * e) {
if (e == nil) {
[socketConnection receiveMessageWithCompletionHandler:^(NSURLSessionWebSocketMessage * _Nullable message, NSError * _Nullable error) {
NSLog(@"got message = %@", message.string);
}];
}];
I'd like to be able to receive messages from server that wasn't triggered from client request (messages that initiated by the server).
Ideally, i wish to get them in some sort of queue (maybe NSOperationQueue or dispatch queue). But the bottomline should be that some listener would work in the background.
Perhaps there's some delegate to implement this requirement ?
Hi,
I'd like to establish connection between my application and a remote server. Ideally it would be using webSocket since the communication is bi-directional and asynchronous.
However, In case the webSocket isn't established properly or failing sometime after it was created (due to firewall, proxy servers, network switching or any other reason), than I'd like to switch to using periodical simple HTTPS POST requests (keep alive messages) where the server-to-client data transferred on the responses. The server should also support both communication methods.
The following code should reflect my approach. Please advise if this could work or perhaps there are built-in solutions in the framework.
NSURL * reqUrl = [NSURL URLWithString:@"wss://mydomain.com"];
NSURLSession* session = [NSURLSession sessionWithConfiguration:
[NSURLSessionConfiguration defaultSessionConfiguration]];
NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:reqUrl];
webSocketTaskWithURL * socketConnection = [URLSession webSocketTaskWithURL:url];
socketConnection.resume()
[socketConnection sendMessage:message completionHandler: ^(NSError * e) {
if (e != nil) {
// fallback to https
[req setHTTPBody:[message dataUsingEncoding:NSUTF8StringEncoding]]
NSURLSessionDataTask *data_task_http = [session dataTaskWithRequest:req];
completionHandler:
^(NSData * _Nullable data,
NSURLResponse * _Nullable
response,
NSError * _Nullable error) { /*blabla*/}];
[data_task resume];
}
Hi,
I've created persistent task from type launchDaemon based on bash script that should run one time upon first load.
These are the contents of the plist file :
<?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>Label</key>
<string>com.blabla.task</string>
<key>RunAtLoad</key>
<true/>
<key>LaunchOnlyOnce</key>
<true/>
<key>Program</key>
<string>/Library/Application\ Support/myComp /script.sh</string>
</dict>
</plist>
However, when i load the plist using launchCtl, nothing happens and no meaningful log appears...
However, when the Program location changes to /tmp/script.sh then everything is working great
So i conclude that there's permission issue to access Library/Application\ Support, although the file permission is allow for all -rwxrwxrwx.
But when I give back full disk access in privacy setting, it's working from the /Library.. path.
My question is why does bash launchd task that runs with privileges, also requires this privacy acknowledge in order to run the script?
Hi, I'd like to write a network extension for a vpn product, that also filter several types of packets before they arrive to the tunnel represeted by the tunnel virtual interface (utun0)
Is there anyway I can set the packet filtering to occur before the tunnel ? is it the default case ?
Can I use the same network extension for both NEPacketTunnelProvider and NEFilterPacketProvider / NEFilterDataProvider ?
thanks !