云卵石没有从iOS应用程序接收数据?

云卵石没有从iOS应用程序接收数据?,ios,pebble-watch,cloudpebble,Ios,Pebble Watch,Cloudpebble,一切都可以很好地获取手表信息,但当我将iOS应用程序的数据传输到手表应用程序时,当我的日志显示消息已成功发送时,我会出现错误。即使消息已发送,我的pebble手表也不会接收任何数据。它只是在我的pebble手表中变为空窗口 我正在为pebble watch应用程序和iOS版本8.3、xcode 6.3.1使用cloud pebble c代码: #include <pebble.h> static TextLayer *hello_text_layer; static void m

一切都可以很好地获取手表信息,但当我将iOS应用程序的数据传输到手表应用程序时,当我的日志显示消息已成功发送时,我会出现错误。即使消息已发送,我的pebble手表也不会接收任何数据。它只是在我的pebble手表中变为空窗口

我正在为pebble watch应用程序和iOS版本8.3、xcode 6.3.1使用cloud pebble

c代码:

#include <pebble.h>

static TextLayer *hello_text_layer;

static void message_received(DictionaryIterator *iterator, void *context) {

  char *message = dict_find(iterator, 0)->value->cstring;
  text_layer_set_text(hello_text_layer,message);
  text_layer_set_font(hello_text_layer, fonts_get_system_font(FONT_KEY_ROBOTO_BOLD_SUBSET_49));


}

int main(void) {
  app_message_register_inbox_received(message_received);
  app_message_open(app_message_inbox_size_maximum(), 0);

  Window *first_window = window_create();

  hello_text_layer = text_layer_create(GRect(10, 10, 124, 148));
  text_layer_set_text(hello_text_layer, "Welcome");
  layer_add_child(window_get_root_layer(first_window), text_layer_get_layer(hello_text_layer));

  window_stack_push(first_window, true);

  app_event_loop();

  text_layer_destroy(hello_text_layer);
  window_destroy(first_window);
}
有时我也会遇到这样的错误:

Error launching app - Error: Error Domain=com.pebble.iossdk.public Code=10 "The watch did not acknowledge the pushed update in time." UserInfo=0x166b9120 {NSLocalizedDescription=The watch did not acknowledge the pushed update in time.}

我终于找到了我问题的答案。。 解释得很好

我已经把我的c代码改成这样了

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);
  }
工作很好

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);
  }