苹果手机锁屏关机了怎么关

苹果iOS8.1系统怎么关闭手机QQ锁屏消息
自从将手中的iPhone5s升级iOS8.1系统后,经常会在iOS8.1锁屏界面下弹出QQ消息、QQ群消息等内容提示,这些信息都不是小编所关注的,而且经在锁屏界面弹出QQ消息,严重减低了iPhone5s的续航。那么iOS8.1手机QQ锁屏消息怎么关闭?下面小编将自己的经验方法分享给大家。
iOS8.1手机QQ锁屏消息怎么关闭?
一、在iOS8.1设备桌面中,点击进入【设置】,然后再进入【通知】设置,如下图所示。
二、然后在通知设置中,点击【QQ】应用程序通知设置,之后将【允许通知】或【在锁定屏幕上显示】开关,关闭即可,如下图所示。
通过以上简单两步设置,我们就可以轻松关闭烦人的iOS8.1手机QQ锁屏通知消息了,有类似烦恼的朋友,快去试试吧。
顶一下(0) 踩一下(0)
热门标签:iPhone6 Plus如何实现关闭屏幕但不锁屏?_iphone6吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:1,179,459贴子:
iPhone6 Plus如何实现关闭屏幕但不锁屏?收藏
在下载视频,比如优酷,奇艺,115网盘缓存时,如果锁屏,那么wifi就会断开,下载也会停止,如果设置为永不锁屏,那么屏幕就会一直亮着,浪费电也损耗屏幕的使用寿命,有没有一种方法让iPhone6 Plus如何实现关闭屏幕但不锁屏?PS:iPad 就可以通过休眠套子来实现,但是iPhone就没有休眠套;大家在用iPhone 下载时,是如何做的?比如下一部1G多的电影,就让iPhone一直不锁屏?屏幕一直亮着?
有知道的吗?
登录百度帐号推荐应用
为兴趣而生,贴吧更懂你。或您的举报已经提交成功,我们将尽快处理,谢谢!
你说的锁屏是手机顶部的电源按钮吧?如果出现这总情况,可能是物理电源里面已经损坏了,不能正常弹起或者里面导电介质出问题了,导致系统认为你一直按着这个按钮呢。及时送...
去找个手机维修的 100足够了 不要去售后 估计价格超300
大家还关注
(window.slotbydup=window.slotbydup || []).push({
id: '2081942',
container: s,
size: '1000,60',
display: 'inlay-fix'iPhone锁屏网络连接关闭有关问题(iphone锁屏打开时请求网络失败) - Iphone当前位置:& &&&iPhone锁屏网络连接关闭有关问题(iphone锁屏打开时iPhone锁屏网络连接关闭有关问题(iphone锁屏打开时请求网络失败)&&网友分享于:&&浏览:42次iPhone锁屏网络连接关闭问题(iphone锁屏打开时请求网络失败)
一.问题描述
在开发的iPhone APP中,有个设计是:当APP从后台(Background)返回到前台(Foreground)时,会进行一些网络连接获取新的数据,网络请求是使用ASIHTTPRequest完成的。但是在测试中发现一个问题:在运行APP时进入锁屏状态,当解锁后显示时,APP会从Background状态进入到Froeground状态,按照设计此时会进行网络连接更新数据,但是ASIHTTPRequest请求却返回了错误,如下
Error Domain=ASIHTTPRequestErrorDomain Code=1 "A connection failure occurred" UserInfo=0x69f400 {NSUnderlyingError=0x6e9fc0 "The operation couldn’t be completed. Broken pipe", NSLocalizedDescription=A connection failure occurred}
返回的错误是“Broken pipe”,这个错误的意思是对端(服务器端)将连接关闭了,而客户端不知道,仍然使用了已经关闭的连接。
二.错误信息分析
通过跟踪错误产生的位置研究了下ASIHTTPRequest的代码,发现对于每一个ASIHTTPRequest请求并不是每次都新建一个连接,其内部有连接池存储之前的连接。见ASIHTTPRequest.m
// An array of connectionInfo dictionaries.
// When attempting a persistent connection, we look here to try to find an existing connection to the same server that is currently not in use
static NSMutableArray *persistentConnectionsPool =
HTTP中有个持久连接(persistent connection)的技术,也叫做HTTP keep-alive或者HTTP connection reuse,其意思时,在同一个TCP连接上,进行多次的HTTP请求/回复的发送和接收,相对于每个HTTP请求/回复都新建一个连接,这种方式可以减少系统消耗。
ASIHTTPRequest中也使用了这种技术,如果当前HTTP连接属于持久连接,则会将TCP连接保存到持久连接池(persistentConnectionsPool)中,如果之后的HTTP请求请求的是同一个服务器,则会复用连接池中的连接发送HTTP请求以及接收HTTP回复,见ASIHTTPRequest帮助文档中的Configuring persistent connections节。
By default, ASIHTTPRequest will attempt to keep connections to a server open so that they can be reused by other requests to the same server (this generally results in significant speed boost, especially if you have many small requests). Persistent connections will be used automatically when connecting to an HTTP 1.1 server, or when the server sends a keep-alive header. Persistent connections are not used if the server explicitly sends a ‘Connection: close’ header. Additionally, ASIHTTPRequest will not use persistent connections for requests that include a body (eg POST/PUT) by default (as of v1.8.1). You can force the use of persistent connections for these request by manually setting the request method, then turning persistent connections back on:
[request setRequestMethod:@"PUT"];
[request setShouldAttemptPersistentConnection:YES];
如果服务器未指定当前连接的超时时间的话,则ASIHTTPRequest则默认为60s,在+expirePersistentConnections方法中会将超时的连接从连接池中删掉。
Many servers do not provide any information in response headers on how long to keep a connection open, and may close the connection at any time after a request is finished. If the server does not send any information about how long the connection should be used, ASIHTTPRequest will keep connections to a server open for 60 seconds after any request has finished using them. Depending on your server configuration, this may be too long, or too short.
如果假定的超时时间太短,则持久连接会在仍然可用的时候被关掉,下一次HTTP请求就得再新建一个连接,只是影响性能,但不影响使用;如果假定的超时时间太长,则在持久连接已经关闭的时候其仍然在连接池中,这时候使用此连接进行HTTP请求就会出现错误,如果错误为连接已关闭的话,ASIHTTPRequest会使用其他连接重试一次此请求。
If this timeout is too long, the server may close the connection before the next request gets a chance to use it. When ASIHTTPRequest encounters an error that appears to be a closed connection, it will retry the request on a new connection.
If this timeout is too short, and the server may be happy to keep the connection open for longer, but ASIHTTPRequest will needlessly open a new connection, which will incur a performance penalty.
ASIHTTPRequest根据错误码判断该错误是否是由连接已关闭引起的,这三个错误码为POSIX socket的ENOTCONN,EPIPE错误和CFNetwork的kCFURLErrorNetworkConnectionLost(-1005)错误,见ASIHttpRequest.m中的-handleStreamError方法。
// First, check for a 'socket not connected', 'broken pipe' or 'connection lost' error
// This may occur when we've attempted to reuse a connection that should have been closed
// If we get this, we need to retry the request
// We'll only do this once - if it happens again on retry, we'll give up
// -1005 = kCFURLErrorNetworkConnectionLost - this doesn't seem to be declared on Mac OS 10.5
if (([[underlyingError domain] isEqualToString:NSPOSIXErrorDomain] && ([underlyingError code] == ENOTCONN || [underlyingError code] == EPIPE))
|| ([[underlyingError domain] isEqualToString:(NSString *)kCFErrorDomainCFNetwork] && [underlyingError code] == -1005)) {
if ([self retryUsingNewConnection]) {
而我们在锁屏恢复时收到的错误是”Broken pipe”,也就是EPIPE错误,ASIHTTPRequest在第一次收到这个错误时会重试另一个连接,既然错误到我们这了,说明使用的两个连接全都被关闭了。
&3&三.测试验证
为了查清楚这个问题,我们需要抓取网络数据包,可以根据使用Mac抓取iPhone数据包中的描述建立抓包环境,在Mac电脑上使用WireShark抓包。在ASIHTTPRequestConfig.h中有持久连接的调试开关,我们可以将其打开,以观察持久连接的使用情况。
// When set to 1, ASIHTTPRequests will print information about persistent connections to the console
#ifndef DEBUG_PERSISTENT_CONNECTIONS
#define DEBUG_PERSISTENT_CONNECTIONS 1
在抓包中发现,当我们进行锁屏操作时,所有的网络连接的通过FIN/ACK的流程正常关闭了,如下当前有4个与服务器的连接,而4个连接在锁屏时都通过了FIN/ACK的流程关闭了,但此时在ASIHttpRequest的连接池(persistentConnectionsPool)中应该仍然存在这4个连接,那么在锁屏恢复进入Foreground时仍然会去尝试使用这4个已经关闭的连接。那么在锁屏恢复时,可以看到如下打印
[CONNECTION] Request #15 will use connection #4
[CONNECTION] Request #16 will use connection #3
[CONNECTION] Request attempted to use connection #4, but it has been closed - will retry with a new connection
[CONNECTION] Request #15 will use connection #2
[CONNECTION] Request attempted to use connection #3, but it has been closed - will retry with a new connection
[CONNECTION] Request #16 will use connection #1
[CONNECTION] Request attempted to use connection #2, but it has been closed - we have already retried with a new connection, so we must give up
[CONNECTION] Request #15 failed and will invalidate connection #2
[CONNECTION] Request attempted to use connection #1, but it has been closed - we have already retried with a new connection, so we must give up
[CONNECTION] Request #16 failed and will invalidate connection #1
从上述打印可以看出Request #15尝试使用connection #4,connection #2都失败了,Request #16尝试使用connection #3,connection #1也都失败了,两次失败则不会重试,直接将错误返回给我们。
那么为什么会这样呢,在网络上搜索到了下面的信息iphone app network connection disconnect after screen locking with new ios sdk 5.0Locking iPhone disconnects sockets on iOS 5 only从链接中的信息可知,在iOS5.0+的版本中锁屏会导致网络连接断开,而之前的版本不会,但并没有找到Apple的官方文档对此改变的说明。
四.解决方案
那么怎么解决这个问题呢,问题的简单描述为锁屏操作会关闭所有网络连接,并进入Background模式,而ASIHttpRequst中的连接池没有随着网络连接的关闭而更新,导致恢复到Foreground时复用网络连接时出现错误。那么解决方法就是在锁屏关闭网络连接时同时将ASIHttpRequst持久连接池中的连接清掉。但我们在APP中并没有办法得知是否发生了锁屏,而只知道何时进入Background。锁屏必然进入Background模式,而进入Background模式并不一定是因为锁屏,还可以是手动按Home键,被电话、短信等中断引起的。这样我们可以在进入Background时手工将ASIHttpRequst中的连接池中的连接清掉,虽然在不是因为锁屏进入Background的情况下会影响性能,但保证了锁屏情况下的正确性,所以还是值得的。ASIHttpRequst中只有清除过期持久连接的方法,而没有清除所有持久连接的方法,所有我们要仿照+expirePersistentConnections方法自己写一个
清除过期持久连接方法为
+ (void)expirePersistentConnections
[connectionsLock lock];
for (i=0; i&[persistentConnectionsPool count]; i++) {
NSDictionary *existingConnection = [persistentConnectionsPool objectAtIndex:i];
if (![existingConnection objectForKey:@"request"] && [[existingConnection objectForKey:@"expires"] timeIntervalSinceNow] &= 0) {
#if DEBUG_PERSISTENT_CONNECTIONS
ASI_DEBUG_LOG(@"[CONNECTION] Closing connection #%i because it has expired",[[existingConnection objectForKey:@"id"] intValue]);
NSInputStream *stream = [existingConnection objectForKey:@"stream"];
if (stream) {
[stream close];
[persistentConnectionsPool removeObject:existingConnection];
[connectionsLock unlock];
自己写的清除所有持久连接方法为
+ (void)clearPersistentConnections
[connectionsLock lock];
for (i=0; i&[persistentConnectionsPool count]; i++) {
NSDictionary *existingConnection = [persistentConnectionsPool objectAtIndex:i];
if (![existingConnection objectForKey:@"request"]) {
#if DEBUG_PERSISTENT_CONNECTIONS
ASI_DEBUG_LOG(@"[CONNECTION] Closing connection #%i manualy",[[existingConnection objectForKey:@"id"] intValue]);
NSInputStream *stream = [existingConnection objectForKey:@"stream"];
if (stream) {
[stream close];
[persistentConnectionsPool removeObject:existingConnection];
[connectionsLock unlock];
在进入Background模式时,即AppDelegate的-applicationDidEnterBackground:方法中清空连接池
- (void)applicationDidEnterBackground:(UIApplication *)application {
[ASIHTTPRequest clearPersistentConnections];
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
参考:ASIHTTPRequest documentationHTTP persistent connectioniphone app network connection disconnect after screen locking with new ios sdk 5.0Locking iPhone disconnects sockets on iOS 5 only
本文出自 清风徐来,水波不兴 的博客,转载时请注明出处及相应链接。(感谢分享)
本文永久链接: //iphone_screenlock_network_disconnection
12345678910
12345678910
12345678910 上一篇:下一篇:文章评论相关解决方案 12345678910 Copyright & &&版权所有您所在的位置: &
iphone怎么取消自动锁屏 iphone关闭锁屏办法
时间: 11:13:19
编辑:xwgod
来源:下载吧
苹果手机的用户越来越多,但是苹果手机的功能也难住了很多用户,下面小编给大家讲一下iphone怎么取消自动锁屏。1、首先点击设置,找到通用,点击进去。2、找到自动锁定。3、选择永不,那么iphone就永远不会自动锁屏了。很简单。
分享给朋友:
iphone相关教程
iphone相关新闻
下载1812次
下载1851次
下载1906次
下载1578次
下载1677次
下载1966次
下载1895次
下载1939次
下载1502次
下载1413次
热门关键字
扫红码得红包5亿红包100%中奖

我要回帖

更多关于 苹果手机锁屏密码破解 的文章

 

随机推荐