小编Dan*_*Dan的帖子

Firebase可以在iOS 7的后台发送和接收吗?

我在iOS 7上的Objective C应用程序在后台从startUpdatingsignificantLocationChanges或startUpdatingLocation委托获取位置更新(哪一个取决于应用程序所处的模式,但我认为不重要).

在委托中,我收集位置信息,将其写入字典,然后将字典写入Firebase.

// this code is in the location update delegate routine

// the code that gathers the various elements that go into the dictionary
// are omitted for clarity, I don't think that they matter

// we may be running in the background on iOS 7 when we are called!

NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:
   [[NSNumber numberWithFloat:newLocation.coordinate.latitude] stringValue], @"Latitude",
   [[NSNumber numberWithFloat:newLocation.coordinate.longitude] stringValue], @"Longitude",
   [[NSNumber numberWithFloat:newLocation.horizontalAccuracy] stringValue], @"Accuracy",
   formattedDateString, @"TimeNow",
   [dateFormatter stringFromDate:newLocation.timestamp], @"TimeStamp",
   [[NSNumber numberWithDouble:interval] stringValue], @"Date",
   self.mode, …
Run Code Online (Sandbox Code Playgroud)

objective-c background-process ios firebase ios7

8
推荐指数
1
解决办法
851
查看次数

标签 统计

background-process ×1

firebase ×1

ios ×1

ios7 ×1

objective-c ×1