I want to capture Bluetooth "Classic" device notifications on both Mac and iOS platforms primarily when:
Bluetooth is turned on/off
When a device gets connected/disconnected to Bluetooth
On Mac:
I used the IOBluetooth framework in Mac for this by registering for two notifications:
registerForConnectNotifications
registerForDisconnectNotifications
However, the issue with this is that notifications get triggered even when a connect request happens with the device. (For ex: I pressed connect for connecting with headphones and a notification is received even though it failed to connect to the device for whatever reason).
I need the notification to be received only when the device is successfully connected with the system.
On iOS:
I am not sure which framework to go with - whether CoreBluetooth or External Accessory. I did read that CoreBluetooth supports classic devices but not every device. I would appreciate any insight or help on this topic.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
We have NSWorkspaceWillPowerOffNotification raised when a mac system is about to shutdown.
Is there a counterpart of it for iOS device? Can we register to something similar to get notified when the device is about to be powered off?
Hello,
We created a sample app delegate to test whether applicationDidFinishLaunching runs as expected or not (code as follows). The observed behavior was that the executable
prints both applicationWillFinishLaunching and applicationDidFinishLaunching in the case when we're using an RDP connection to the mac
prints only applicationWillFinishLaunching in case of ssh connection to the mac
Why is this behavior different and how can I ensure it runs correctly with ssh? Kindly help.
#include <unistd.h>
#include <sys/types.h>
#include <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <SystemConfiguration/SCDynamicStore.h>
@interface TWAppKitAppDelegate : NSObject <NSApplicationDelegate>
@end
@implementation TWAppKitAppDelegate
// Launching Applications
- (void)
applicationWillFinishLaunching: (NSNotification *) pNotification
{
NSLog(@"applicationWillFinishLaunching");
}
- (void)
applicationDidFinishLaunching: (NSNotification *) pNotification
{
NSLog(@"applicationDidFinishLaunching");
}
// Managing Active Status
- (void)
applicationWillBecomeActive: (NSNotification *) pNotification
{
}
- (void)
applicationDidBecomeActive: (NSNotification *) pNotification
{
}
- (void)
applicationWillResignActive: (NSNotification *) pNotification
{
}
- (void)
applicationDidResignActive: (NSNotification *) pNotification
{
}
// Terminating Applications
#if 0
- (NSApplicationTerminateReply)
applicationShouldTerminate:(NSNotification *) pNotification
{
return NSApplicationTerminateReply::NSTerminateNow;
}
#endif
- (BOOL)
applicationShouldTerminateAfterLastWindowClosed:(NSNotification *) pNotification
{
return NO;
}
- (void)
applicationWillTerminate:(NSNotification *) pNotification
{
}
- (BOOL)
application:(NSApplication *) pSender
openFile: (NSString *) pFileName
{
return YES;
}
- (void)
application:(NSApplication *) pSender
openFiles: (NSArray<NSString *> *) pFileNames
{
}
@end
int
main (int pArgc, char ** pArgv)
{
NSApplication * app;
TWAppKitAppDelegate * appdelegate;
app = [NSApplication sharedApplication];
appdelegate = [[TWAppKitAppDelegate alloc] init];
[app setDelegate:appdelegate];
[NSApp run]; //NOTE: Apple never 'returns' from here
NSLog(@"Function main called \n");
return 0;
}
While using NSSearchPathForDirectoriesInDomains on an iOS simulator with NSLocalDomainMask, we get directory paths which are same with respect to the device the simulator is running on.
Is this expected behavior because in the apple docs it says NSLocalDomainMask is supported in iOS 2.0+? How will the output on the device be different from that seen in the simulator?
Hi,
I am using NSNotificationCenter to capture the date change event in the following way:
- (void) RegisterForOSNotification
{
NSNotificationCenter * nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self
selector:@selector(OSNotificationCallback:)
name:NSSystemClockDidChangeNotification
object:nil];
}
And this is the callback function:
- (void) OSNotificationCallback: (NSNotification *) pNotification
{
// Time was changed. Log a value here.
}
How can I pass an int value to the callback function from the RegisterForOSNotification function so that I can log the same or use it further for some processing? Is this possible?
Hello,
We're developing an executable that will generate a file or folder in a shared place that all OS users may access.
Given that our executable may be launched by any Mac OS user, we were unable to locate a single directory with write rights for all OS users in which our executable might create a file or folder.
According to the documentation, /Library/ appears to be the location where application-specific (or system-specific) resources should be stored. However, when we looked at the folder's permissions, we saw that they don't have 766 rights for others. The number of rights was 755 (rwxt-xr-x). We can't use /users/ because we don't want to associate these files with a specific OS user.
https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html#//apple_ref/doc/uid/TP40010672-CH2-SW1
Question:-
(1) Is there a directory on the MAC with 766 rights (other than /tmp or /var/tmp/ or /users/os user>/public) so that all os users may access to read and write files and folders?
(2) Why is the behaviour of /Library/ on the Mac different from the documentation?