Pebble App SDK 및 C에 대해 더 잘 알기 위해 수정하는 테스트 앱에 문제가 있습니다. 임은 내 코드가 함수를 실행하도록 시도 inbox_received_callback(DictionaryIterator *iterator, void *context)
하지만 어떤 이유로 든 C는 코드를 건너 뛰고 다른 기능을 계속 실행합니다. 예제에서 미리 작성된 다른 모든 기능은 문제없이 실행됩니다.
C가이 함수를 건너 뛰기로 결정한 이유는 무엇이며이 코드를 건너 뛰지 않도록하려면 어떻게해야합니까?
weather_app_data.c
...other functions listed
void inbox_received_callback(DictionaryIterator *iterator, void *context) {
// Store incoming information
strcpy(city, "test");
static char temperature_buffer[8];
static char conditions_buffer[32];
static char weather_layer_buffer[32];
// Read first item
Tuple *t = dict_read_first(iterator);
// For all items
while(t != NULL) {
// Which key was received?
switch(t->key) {
case KEY_0:
snprintf(temperature_buffer, sizeof(temperature_buffer), "%dC", (int)t->value->int32);
break;
case KEY_1:
snprintf(conditions_buffer, sizeof(conditions_buffer), "%s", t->value->cstring);
break;
default:
APP_LOG(APP_LOG_LEVEL_ERROR, "Key %d not recognized!", (int)t->key);
break;
}
// Look for next item
t = dict_read_next(iterator);
}
}
}
static WeatherAppDataPoint s_data_points[] = {
{
.city = city, //This value is left blank by C even though defined in function that isn't running
.description = "Light Rain.",
.icon = WEATHER_APP_ICON_LIGHT_RAIN,
.current = 68,
.high = 70,
.low = 60,
},
...other items
};
weather_app_data.h
... other functions all listed
void inbox_received_callback(DictionaryIterator *iterator, void *context);
void inbox_dropped_callback(AppMessageResult reason, void *context);
void outbox_failed_callback(DictionaryIterator *iterator, AppMessageResult reason, void *context);
특정 답변을 제공 할 수있는 충분한 코드를 제공하지 않으 셨지만 보여 주신 내용에 따라 @Peter가 머리에 못 박힌 것 같습니다.
을 호출하는 코드를 표시하지 않습니다 inbox_received_callback
. 컴파일러 최적화 플래그에 따라 적어도 두 가지 다른 것을 볼 수 있습니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다