草庐IT

Delegate

全部标签

ios - UIDocumentPickerViewController 委托(delegate) : startAccessingSecurityScopedResource always returns NO

知道为什么startAccessingSecurityScopedResource在以下UIDocumentPickerViewController回调中总是返回NO:-(void)documentPicker:(UIDocumentPickerViewController*)in_documentPickerViewControllerdidPickDocumentAtURL:(NSURL*)in_pickedDocumentAtURL{BOOLl_bStartAccessingWorked=[in_pickedDocumentAtURLstartAccessingSecurityS

ios - 警告 : Application delegate received call to

我正在实现本地通知方法,但我收到了该警告Warning:Applicationdelegatereceivedcallto-application:handleActionWithIdentifier:forLocalNotification:withResponseInfo:completionHandler:butthecompletionhandlerwasnevercalled.这是我在didfinishlaunchmethod中的代码if([applicationrespondsToSelector:@selector(registerUserNotificationSett

ios - 永远不应触发嵌套优化。这可能是由于自动布局工作发生在 NSISVariable 委托(delegate)回调中

应用程序崩溃,日志给了我这条消息:“永远不应触发嵌套优化。这可能是由于自动布局工作发生在NSISVariable委托(delegate)回调中,这是不允许的。”如何解决这个问题? 最佳答案 以为我是在后台线程中更新UI。尝试放置:if([NSThreadisMainThread]){NSLog(@"isMainThread");}else{NSLog(@"isNotMainThread");在UI更新行旁边,以便在后台线程中找到UI更新。例子:if([NSThreadisMainThread]){NSLog(@"isMainThre

ios - UIDocumentPickerViewController - 未调用委托(delegate)方法

我正在使用UIDocumentPickerViewController从文件中选择文档并将其上传到服务器。我能够成功访问文件,但在单击文件后不会调用委托(delegate)方法。我使用了以下代码来调用文档选择器:classUploads:UIViewController{overridefuncviewDidLoad(){super.viewDidLoad()//Doanyadditionalsetupafterloadingtheview.}overridefuncdidReceiveMemoryWarning(){super.didReceiveMemoryWarning()//D

iPhone:模态视图和委托(delegate)中的僵尸对象

我的应用程序有时会发生崩溃,我在启用僵尸的情况下进行了测试,发现此方法是僵尸,此方法通常可以正常工作,但在某些情况下,例如在某些时候来回导航很多,它会崩溃。我在@property中保留了datepickerView,在deaaloc中释放了它。 最佳答案 在dealloc中将datePickerDelegate设置为nil。如果它在第一次实例化后有一个保留属性,委托(delegate)中可能会有一个死引用,并且会在启用Zombies时随机导致创建和崩溃。崩溃的发生是因为保留属性释放了以前的值,如果它是死引用,崩溃就会随之而来——随机

ios - NSStream 委托(delegate) NSStreamEventHasBytesAvailable 未被调用

我正在编写一个使用NSStream与用Python编写的服务器通信的消息传递应用程序。该服务器与配套的Python客户端完美配合。但是当我用NSStream连接到它时,NSInputStream似乎没有得到任何数据。然而,NSOutputStream工作得很好。我像这样打开字符串:-(void)openStream{CFReadStreamRefreadStream;CFWriteStreamRefwriteStream;CFStreamCreatePairWithSocketToHost(NULL,(CFStringRef)@"tihmstar.dyndns.org",80,&rea

ios - 更好的是,委托(delegate)或单例在 View Controller 之间传递数据 - Objective-C

关闭。这个问题是opinion-based.它目前不接受答案。想要改进这个问题?更新问题,以便editingthispost可以用事实和引用来回答它.关闭8年前。Improvethisquestion我一直在练习使用不同的方法在ViewController之间传递数据,到目前为止我已经尝试过委托(delegate)和单例。在尝试了这两种模式之后,我开始怀疑是一种比另一种更好,还是仅仅是一种品味。在我看来,单例模式似乎非常直接和简单,它似乎也符合MVC,因为它将模型与Controller完全分离。1-一种模式比另一种更好吗?2-你用什么方法?3-为什么你更喜欢一个而不是另一个?抱歉,如果

ios - 将 UITableView 委托(delegate)和数据源与 tableViewController 分离

由于委托(delegate)和数据源方法以及我有多个UITableViewCells子类和每个子类的不同单元格布局这一事实,我的tableViewController变得越来越大。我在看thispost但它实际上只是讨论了如何在dataSource/delegate类中实现方法,而不是如何将它连接到您的ViewController。因此,我创建了一个符合tableView委托(delegate)和数据源协议(protocol)的类,添加了一个tableView属性用作对tableView的引用,以及一个posts属性用作数据源数组。@interfaceSPPostsDataSouceA

ios - 未调用 UITableView ScrollView 委托(delegate)

我在UIViewController中设置了一个tableview@property(strong,nonatomic)IBOutletUITableView*tableView;在viewDidLoad中设置委托(delegate)self.tableView.delegate=self;self.tableView.dataSource=self;永远不会调用以下方法:-(void)scrollViewDidEndDecelerating:(UIScrollView*)scrollView;-(void)scrollViewDidScroll:(UIScrollView*)scro

ios - Chartboost 委托(delegate)集成警告

我刚刚升级到ChartboostSDK5.0。它工作正常并显示广告,但出于某种原因我收到此警告:ChartboostIntegrationWarning:startWithAppId:appSignature:delegatemustbecalledbefore+[ChartboostcacheInterstitial:]知道为什么吗?我在-(void)applicationDidBecomeActive:下的AppDelegate中调用startWithAppId,然后我使用[ChartboostcacheInterstitial:CBLocationMainMenu]将插页式广告缓