gpt4 book ai didi

ios - CloudPebble 模拟器 vs iOS pebble native 应用程序?

转载 作者:行者123 更新时间:2023-12-01 18:51:25 25 4
gpt4 key购买 nike

我想知道如何与 iOS pebble 原生应用程序进行通信。我可以使用云 pebble 创建 watch 应用程序,但我不知道如何在云模拟器和 iOS pebble 原生应用程序之间建立连接。

任何帮助链接或任何事情将不胜感激。谢谢

最佳答案

最后我找到了我自己。感谢@dustin @kirby

默认情况下,pebble iOS 应用程序没有选项 启用开发者选项模式
要启用选项,您需要使用蓝牙将您的 pebble watch 与 pebble iOS 应用程序连接。

启用后,pebble iOS 应用程序将从云 pebble 监听您的 pebble watch 安装。(我正在使用云 pebble)。

有两种方法可以启用它。

1.从云卵石的编译选项卡中选择您的设备。
2.手动输入IP地址(但我认为它已从最新版本的pebble sdk中删除)。

你应该用你的 Mac 电脑插入你的设备。
您应该将您的卵石 watch 与您的 iPhone 设备配对。

如果您使用 c 代码创建卵石 watch (我的建议使用 cloud pebble)

如果您想与您的 iPhone 设备和 pebble watch 进行通信。

Follow here .

示例代码: C语言

从 iPhone 应用程序接收数据以观看:

static void inbox_received_callback(DictionaryIterator *iterator, void *context) {
APP_LOG(APP_LOG_LEVEL_INFO, "Message received!");
Tuple *t = dict_read_first(iterator);

while (t != NULL) {
// Long lived buffer
static char s_buffer[64];
APP_LOG(APP_LOG_LEVEL_INFO, "Message ready to get!");
snprintf(s_buffer, sizeof(s_buffer), "'%s'", t->value->cstring);
text_layer_set_text(hello_text_layer, s_buffer);
// Get next pair, if any
t = dict_read_next(iterator);
}
}

从 watch 接收数据到 iPhone 应用程序:
- (IBAction)send:(id)sender {

[self.watch appMessagesLaunch:^(PBWatch *watch, NSError *error) {
if (!error) {
NSLog(@"Successfully launched app.");
}
else {
NSLog(@"Error launching app - Error: %@", error);
}
}
];
// Register to receive events
[[PBPebbleCentral defaultCentral] setDelegate:self];
// Set UUID
//UUID is must which is available in watch application.
uuid_t myAppUUIDbytes;
NSUUID *myAppUUID = [[NSUUID alloc] initWithUUIDString:@"3c74cf8f-74e5-4975-8ad5-e4b25beea86f"];
[myAppUUID getUUIDBytes:myAppUUIDbytes];
[[PBPebbleCentral defaultCentral] setAppUUID:[NSData dataWithBytes:myAppUUIDbytes length:16]];

NSDictionary *message = @{@(0):@"optisol",
};
NSLog(@"%@",message);

//sending code
[self.watch appMessagesPushUpdate:message onSent:^(PBWatch *watch, NSDictionary *update, NSError *error) {
NSLog(@"getting called");
if (!error) {
NSLog(@"Message sent!!!!!!!!");
}
else
{
NSLog(@"Message not sent!!!!!!!!\n\n%@",error.localizedDescription);

}


}];
//receving code
[self.watch appMessagesAddReceiveUpdateHandler:^BOOL(PBWatch *watch, NSDictionary *update) {
// Process incoming messages
NSLog(@"%@",update);
NSLog(@"received called");

return YES;
}];
}

应该是:
1.移动设备和电脑要在同一个网络
2.应该配对
3.可选(我使用的是chrome浏览器和firefox)。

您可以下载示例项目..

Source

要启用开发人员连接:

Here

编写移动应用程序:

Here

如果您对此有疑问,只需重新启动所有设备并重试。

关于ios - CloudPebble 模拟器 vs iOS pebble native 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30726290/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com