两个脑仁疼的error:error in __connection_block_invoke_2: Connection interrupted

本文探讨了iOS开发中调用相机产生的警告信息,并提供了解决思路。同时,还分析了后台任务中断导致的错误及其可能的影响。

最近遇到的两个问题,是在iOS真机调试的时候遇到的

翻遍了stackoverflow和百度google。仍然没找到解决方案!!!!先挖个坑,找到答案再填上。。

error1:调用相机出现的bug

Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.


1,有人说:IOS8多了一个样式UIModalPresentationOverCurrentContext,IOS8中presentViewController时请将控制器的modalPresentationStyle设置为UIModalPresentationOverCurrentContext,但是问题并没有解决。。

2,还有其他的方法,比如延时调用:

You should initialize your Camera in your UIViewController, only after the view has Loaded and with a timeout:

- (void)viewDidAppear:(BOOL)animated 
{
    [super viewDidAppear:animated];
    //show camera...
    if (!hasLoadedCamera)
        [self performSelector:@selector(showcamera) withObject:nil afterDelay:0.3];
}
3,把 imagePicker 存成全局变量……

最后!!!查了半天。。有些程序猿负责任地告诉我, 这只是个 warning,不影响正常使用,某大公司的 app 也会报这个 warning。直接忽略掉它就可以…………………………

我用了大半天查的问题!!!忽略即可TVT

直接忽略就是了,没有任何影响,貌似是IOS 8的一个bug



erro2:

error in __connection_block_invoke_2: Connection interrupted


只找到了以下: 不过也没看懂=  =

iOS9锁屏控制台会打印警告

加入运行如下示例代码:

1
2
3
4
5
6
7
8
9
10
- (void)viewDidLoad {
    [super viewDidLoad];
    dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
    dispatch_async(queue, ^(void) {
        //在这个10秒内锁屏
         NSLog(@"准备休眠");
        sleep(10);
        NSLog(@"打印成功");
    });
}

应用运行过程中锁屏,总是会出现以下提示:

1
2
3
4
5
6
** -[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:completion:] ** unhandled action ->{
    handler = remote;
    info ={
        (1) = 5;
    };
}

当应用处于空闲状态时(无网络请求)锁屏对于用户而言并无较大影响,但是当应用在执行某个异步任务时(比如下拉刷新一下列表)锁屏,重新解锁进入就可能会发现异步任务失败,控制台也会提示 Error 信息:

1
2
3
4
5
6
7
** -[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:completion:] ** unhandled action ->{
    handler = remote;
    info ={
        (1) = 5;
    };
}
error in __connection_block_invoke_2: Connection interrupted




----------- JobThread toStop, stopReason:block strategy effect:Cover Early 2025-09-04 00:05:00 [com.xxl.job.core.thread.JobThread#run]-[204]-[xxl-job, JobThread-602-1756915500012] ----------- JobThread Exception:java.lang.reflect.InvocationTargetException at jdk.internal.reflect.GeneratedMethodAccessor176.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:569) at com.xxl.job.core.handler.impl.MethodJobHandler.execute(MethodJobHandler.java:31) at com.xxl.job.core.thread.JobThread.run(JobThread.java:166) Caused by: org.springframework.data.redis.connection.RedisPipelineException: Pipeline contained one or more invalid commands at org.springframework.data.redis.connection.lettuce.LettuceConnection.closePipeline(LettuceConnection.java:651) at jdk.internal.reflect.GeneratedMethodAccessor161.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:569) at org.springframework.data.redis.core.CloseSuppressingInvocationHandler.invoke(CloseSuppressingInvocationHandler.java:61) at jdk.proxy2/jdk.proxy2.$Proxy496.closePipeline(Unknown Source) at org.springframework.data.redis.core.RedisTemplate.lambda$executePipelined$1(RedisTemplate.java:495) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:411) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:378) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:365) at org.springframework.data.redis.core.RedisTemplate.executePipelined(RedisTemplate.java:486) at org.springframework.data.redis.core.RedisTemplate.executePipelined(RedisTemplate.java:480) at com.qctc.uap.core.common.cache.redis.RedisService.addHashBatch(RedisService.java:565) at com.qctc.eboss.service.rec.push.service.impl.NewPowerDayLineHanlderServiceIml.sendOfflineDeviceNotice(NewPowerDayLineHanlderServiceIml.java:188) at com.qctc.eboss.service.rec.push.service.impl.NewPowerDayLineHanlderServiceIml.checkMeterOnlineStatus(NewPowerDayLineHanlderServiceIml.java:179) at com.qctc.eboss.service.rec.job.RepairCacheDataHandler.execute(RepairCacheDataHandler.java:41) ... 5 more Caused by: io.lettuce.core.RedisCommandInterruptedException: Command interrupted at io.lettuce.core.internal.Exceptions.bubble(Exceptions.java:53) at io.lettuce.core.internal.Exceptions.fromSynchronization(Exceptions.java:94) at io.lettuce.core.internal.Futures.awaitAll(Futures.java:213) at io.lettuce.core.LettuceFutures.awaitAll(LettuceFutures.java:44) at org.springframework.data.redis.connection.lettuce.LettuceConnection.closePipeline(LettuceConnection.java:591) ... 20 more Caused by: java.lang.InterruptedException at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:386) at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096) at io.lettuce.core.internal.Futures.awaitAll(Futures.java:201) ... 22 more 什么问题
最新发布
09-05
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值