草庐IT

task_completion_source

全部标签

iphone - GCD Dispatch Sources 和 select() 有什么区别?

我一直在编写一些代码来替换一些现有的代码:while(runEventLoop){if(select(openSockets,readFDS,writeFDS,errFDS,timeout)>0){//checkfiledescriptorsforactivityanddispatcheventsbasedonsame}}套接字读取代码。我想将其更改为使用GCD队列,这样我就可以使用dispatch_async将事件弹出到队列中,而不是维护“必须在下一次迭代中调用”数组。我也已经在使用GCD队列来/包含/这个特定的操作,因此想将其下放到更自然的GCD调度形式。(不是独占串行队列的whi

objective-c - UIView animateWithDuration : duration: animations: completion: seems to have a default transition?

在我的程序中,我想创建一个以恒定速度移动的动画。看起来动画开始缓慢,加速然后缓慢结束。有什么办法可以改变吗? 最佳答案 您可以使用animateWithDuration:delay:options:animations:completion:选项更改此设置。为选项参数发送一个UIViewAnimationOption掩码。这些是您感兴趣的选项:UIViewAnimationOptionCurveEaseInOutUIViewAnimationOptionCurveEaseInUIViewAnimationOptionCurveEas

objective-c - dismissViewControllerAnimated :completion: Push to another ViewController

我只是想知道是否有可能在我解雇一个ViewController之后立即将其推送到一个ViewController。我一直在尝试:-(void)dismiss{//sendinformationtodatabasehere[selfdismissViewControllerAnimated:YEScompletion:^{NSLog(@"Dismisscompleted");[selfpushtoSingle:post_id];}];}-(void)pushtoSingle:(int)post_id{Single1ViewController*svc=[self.storyboardin

ios - 使用 segueWithIdentifier :source:destination:performHandler: 自定义 UIStoryboardSegue

我正在尝试使用自定义UIStoryboardSegue来实现两个ViewController之间的转换。我可以通过子类化UIStoryboardSegue来做到这一点,然后在IB中设置此类。但是,我正在查看文档,上面写着:Ifyourseguedoesnotneedtostoreadditionalinformationorprovideanythingotherthanaperformmethod,considerusingthesegueWithIdentifier:source:destination:performHandler:methodinstead.暗示您不需要创建自定

iphone - 暂停计时器上的 dispatch_source_cancel 导致 EXC_BAD_INSTRUCTION

我试图取消然后释放暂停的计时器,但是当我对其调用“dispatch_release”时,我立即收到EXC_BAD_INSTRUCTION。这不是对计时器采取的一组有效操作吗?定时器的创建和暂停:@interfaceSomeClass:NSObject{}@property(nonatomic,assign)dispatch_source_ttimer;@end//Classimplementation@implementationSomeClass@synthesizetimer=_timer;-(void)startTimer{dispatch_queue_tglobalQ=disp

ios - AVAudioSessionManager availableInputs "Unknown selected data source for port iPhone Microphone"

一段时间以来,我一直在控制台日志中注意到这个错误。虽然它不影响我的应用程序的执行,但我觉得它真的很烦人。于是,我开始追查这个错误是从哪里来的。结果是当我调用availableInputsNSArray*inputs=[[AVAudioSessionsharedInstance]availableInputs];它将给我日志消息:ERROR:[0x3d61318c]AVAudioSessionPortImpl.mm:50:ValidateRequiredFields:UnknownselecteddatasourceforPortiPhoneMicrophone(type:Microph

ios - 'sd_setImage(with:placeholderImage:completed:)' 与 Swift 3 的不明确使用

我在我的imageView上使用SDWebImage进行以下调用,它在Swift2上运行良好,但在上出错XCode8beta5使用Swift3编译:imageView.sd_setImage(with:url,placeholderImage:placeholder,completed:{(image:UIImage?,error:Error?,cacheType:SDImageCacheType,imageURL:URL?)in...});错误是:Ambiguoususeof'sd_setImage(with:placeholderImage:completed:)'我怀疑已完成的处

ios - TestFlight iOS App get-task-allow 问题

我在testflight中有一个名为MapItTrackIt的应用程序。一切都运行良好。我刚刚更新到xcode5.1。我以与以往完全相同的方式构建应用程序。相同的配置文件和临时证书。这一次,当我尝试上传我的IPA文件时,我收到“无效配置文件:开发人员构建授权必须将get-task-allow设置为true”。错误。我根本没有更改任何配置或其他内容。我刚刚向该应用程序添加了更多功能并修改了版本。我现在该怎么办?我该如何解决?我的老板想要立即部署它,但我不能。 最佳答案 同样的问题今天持续了大约4个小时-重启Xcode似乎是令人沮丧的解

ios - 使用 presentViewController :animated:completion: in iOS 8 时 presentingViewController 为 nil

想知道最近是否有其他人遇到过这个问题......对于我的一个ViewController,仅在iOS8上,在调用presentViewController:animated:completion:之后,呈现的ViewController将self.presentingController设为nil。在iOS7上没问题,在另一个ViewController上也不会发生。documentation说应该设置它,只要呈现的ViewController是模态呈现的。鉴于它适用于iOS7,这可能是iOS8的错误吗?我已经能够使用View容器包含方法绕过它,但如果有人以前见过这个并且知道触发此行为

iphone - 正确使用 transitionFromViewController :toViewController:duration:options:animations:completion:

我似乎找不到关于如何正确使用transitionFromViewController:toViewController:duration:options:animations:completion:的好例子。这是正确的吗?(假设我想用另一个VC交换)//AssumefromVCandtoVCviewcontrollersaredefinedandfromVCisalreadyaddedasachildviewcontroller[selfaddChildViewController:toVC];[selftransitionFromViewController:fromVCtoView