- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想制作一个 iOS7 设计,以使用 3G/4G/LTE(非 WiFi)从后台将其位置上传到服务器,频率低于每 5 到 10 分钟一次,或者当它的位置发生变化时。
我已经尝试过的是这样的:
1.后台获取- (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler
叫得这么不规律,不可控。
2.远程通知(非静音推送)- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
仅在 WiFi 连接中调用。
3.CLLocationManager
我把上传者放在 - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
但仅在 WiFi 上时调用。
我想实现一个像“Find Your Friends”这样的应用程序,它是 iOS8 中的 Apple 原生应用程序。有什么想法吗?
感谢您的帮助。
更新
我试过NSURLSession upload
由 CLLocationManager didUpdateToLocation
触发如下所示,但它仍然只在 WiFi 上上传。
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
[[NSUserDefaults standardUserDefaults] setFloat:newLocation.coordinate.latitude forKey:@"lat"];
[[NSUserDefaults standardUserDefaults] setFloat:newLocation.coordinate.longitude forKey:@"lon"];
[[NSUserDefaults standardUserDefaults] synchronize];
[self update];
}
- (void)update
{
NSURL *url = [NSURL URLWithString:@"http://.../updater.php"];
NSString *identifier = [NSDate date].description;
NSURLSessionConfiguration *configration = [NSURLSessionConfiguration backgroundSessionConfiguration:identifier];
configuration.networkServiceType = NSURLNetworkServiceTypeBackground;
configuration.discretionary = NO;
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"PUT";
NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration
delegate:self
delegateQueue:[NSOperationQueue mainQueue]];
float lat = [[NSUserDefaults standardUserDefaults] floatForKey:@"lat"];
float lon = [[NSUserDefaults standardUserDefaults] floatForKey:@"lon"];
NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithFloat:lat], @"lat",
[NSNumber numberWithFloat:lon], @"lon", nil];
NSData *data = [NSJSONSerialization dataWithJSONObject:dictionary options:NSJSONWritingPrettyPrinted error:nil];
NSString *path = [[self applicationDocumentsDirectory].path stringByAppendingPathComponent:@"json.data"];
[data writeToFile:path atomically:YES];
NSURLSessionUploadTask *task = [session uploadTaskWithRequest:request fromFile:[NSURL fileURLWithPath:path]];
[task resume];
}
- (NSURL *)applicationDocumentsDirectory
{
// The directory the application uses to store the Core Data store file. This code uses a directory named "jp.skyElements.NNZ" in the application's documents directory.
return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
}
最佳答案
您有后台位置更新模式,可让您的应用收到有关位置更改的通知。在 Background Modes
中阅读更多信息iOS 的 Xcode 文档中的部分。
现在我从未尝试在后台位置更新期间执行任何网络请求,但我会尝试以下内容:NSURLSession
有后台配置。 POST 到服务器并将所有负担委托(delegate)给 iOS 本身。 QoS、网络节流、电源效率和其他好处由此而来。
关于ios - 有什么方法可以经常使用 3G/4G/LTE 从后台上传位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27459528/
在Android SDK中,有一个网络类型入口: https://developer.android.com/reference/android/telephony/TelephonyManager.
如果我们查看规范 23.402 v10.8 第 5.2 节和第 6.2.1 节,BBERF(SGW/受信任的非 3GPP 访问)会在向 PGW 发送代理绑定(bind)更新消息以实现 QoS 之前创建
您好,我正在尝试植入 mongodb lte 功能 http://docs.mongodb.org/manual/reference/operator/query/lte/ 但它似乎不起作用:s我的路
我(为了好玩?)尝试在 Idris 中完成所有如何证明。我需要的属性之一是整数的全排序。 idris 已经有了data.ZZ提供基于归纳的整数的模块。我需要添加类似于 Nat 的 LTE 的类型。我似
我的应用程序的某些用户(在特定运营商上,使用 4g)无法加载照片。 并且可达性测试也失败了。但我可以毫无问题地访问我的一些后端 API。 但当我使用 WiFi 测试我的应用时,这种情况从未发生过。 什
我在管理端使用管理 LTE 模板。当我转到其他页面时,该页面的按钮将不会处于事件状态。我观察到激活该按钮的方式是必须的,也是必须的里面的 li我怎样才能使用 jquery 做到这一点
我已经为我的 Visual Basic 元素合并了 AdminLTE 模板。我想要与演示相同的效果: https://almsaeedstudio.com/themes/AdminLTE/index.
通知图片: 从上图中可以清楚地看出,通知面板没有包装消息的内容。内容中的实际文本很长,即 saurabh 先养 请求审查任务 'ABCDE 2017 年 11 月' 分配 ID 为“Qg9hBNSTo
几天以来,我一直在使用 Admin LTE(管理模板),但令我惊讶的是图标无法离线工作。那么,有没有什么办法可以离线运行所有图标。在下面的图片中显示了它是如何在没有互联网连接的情况下出现的。 ente
我正在尝试编写一个小部件,这样我就可以在我的 Verizon Galaxy Nexus 上启用/禁用 LTE,而无需深入到设置菜单中进行操作。但是,我还没有弄清楚如何确定 LTE 是否真的打开了。我可
我正在使用 ffmpeg 3.3.6 版开发一个在 Android 上显示 IP 摄像机图像的应用程序。 处理接收视频的代码就完成了。迄今为止的开发环境与相机处于相同的wifi环境中。 但是,如果您尝
我试图了解 LTE 和 UMTS/HSPA+ 如何从全功率状态过渡,以及当移动设备的 radio 全功率运行时,塔上占用了哪些资源。 我看过 Ch. High Performance Browser
我有架构 { summaries: [ { type: 'temp', min: 10, max: 40 }, { type: 'humi
我正在尝试弄清楚如何使用从日期时间中提取的日期来过滤 QuerySet。 我使用 Django-filter 并且如果不迭代 QuerySet 就无法编写这样的查找,这是非常低效的。 我试过 date
LTE 支持以 QCI 为代表的各种 QoS 级别。例如我们有用于 VOIP 通话的 QCI 2、用于视频通话的 4、用于在线游戏的 3 等。android 应用程序在连接到网络时将如何表达其 QOS
当我连接到 wifi 时,我使用可达性来检查互联网连接,它工作正常。但是当它连接到 LTE 网络时,它给我没有连接错误,即使它已连接,我也可以使用 LTE 完美浏览互联网。我还在 info.plist
我刚刚意识到 IE7/8 don't support背景大小属性。 我很常用: .image{ background-size:100% auto; /* in case browser do
有没有办法在Android平台上从LTE网络访问NAS消息?我拥有所有需要的解码软件,但无法获取实际消息。 最佳答案 NAS 消息存在于基带日志(调制解调器)中。因此,您必须捕获调制解调器日志才能检查
这是我的示例文档: { updated: [ 1461062102, 1461062316 ], name: "test1", etc: "etc" } { updated: [
我正在研究 LTE-EPC 软件应用程序并遇到一个基于理论的问题。 有一个 UE 和一个 PDN。 它们之间通过 P-GW/S-GW/eNB 建立默认方式连接。 UE 发送额外资源分配请求,PCEF/
我是一名优秀的程序员,十分优秀!