Objective C-Is it possible to connect to BLE devic

2019-08-12 22:45发布

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..

2条回答
做自己的国王
2楼-- · 2019-08-12 23:39

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.

查看更多
兄弟一词,经得起流年.
3楼-- · 2019-08-12 23:44

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);
}
查看更多
登录 后发表回答