问题
Is it possible to get the BLE devices and connect to it using Watch Kit extension.In iPhone CoreBluetooth framework is used,what is the framework for iWatch
I am new to Watckit.Please help me with some solutions..
回答1:
Core Bluetooth is not currently available on watchOS 2.
I'm not sure if this would work for your application, but you could "daisy chain" your connection. You would use core bluetooth to connect your device to your iPhone, and then you could interact with your iPhone using WCSession from your apple watch.
回答2:
In iphone
if([WCSession isSuported])
{
WCSession *session=[WCSession defaultSession];
session.delegate=self;
[session activateSession];
}
NSError *error;
[session updateApplicationContext:@"DATA TO BE SEND" error:&error];
In iWatch repeat the session support check and add this code
-(void)session :(nonnull WCSession *)didRecieveApplicationContext:(nonull NSDictionary<NSString *,ud>*)applicationContext{
NSLog(@"recieved %@",applicationContext);
}
来源:https://stackoverflow.com/questions/35568770/objective-c-is-it-possible-to-connect-to-ble-devices-from-iwatch