protocols

No known instance method for selector--delegate issue?

我的梦境 提交于 2019-12-13 07:03:41
问题 I'm getting the above error, and I don't know why. The line where the error is flagged is: - (IBAction)cancelButton:(UIBarButtonItem *)sender { [self.delegate addActivityViewControllerDidCancel:self.thisActivity]; } I'm confused because there seems to be no problem with this method, immediately preceding: - (IBAction)saveButton:(UIBarButtonItem *)sender ... [self.delegate addViewControllerDidSave]; } ... } My protocol is declared like this in the associated header file: @protocol

Is it possible to listen only debugger directed to a certain debugport?

你离开我真会死。 提交于 2019-12-13 06:55:12
问题 I'm trying to connect to the VMWare's pipe; what is in fact simulated serial port where I've redirected debug output from the virtual OS. I used this article to redirect debug output from the virtual OS to the named pipe on my client OS through the VMWare. It works perfectly when I use the WinDbg as decribed in that article but I want to create my own application to catch this debug output - only to catch, nothing else. When I'm only listening from the pipe (that simulated serial port) I'm

@protocol implementation in @interface in Objective-C

纵然是瞬间 提交于 2019-12-13 06:41:38
问题 I need to develop an application which has a interface which implements methods of 3 protocols. Assume protocol A extends protocol B and protocol C, and interface implements protocol A. This is how my code looks, // This is in MyClass.h file #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #import "protocol_A" @interface MyClass : NSObject <protocol_A> { } @end //This is MyClass.m file #import "MyClass.h" @implementation myClass -(void)methodinA { NSLog(@"I'm in protocol_A"); } } -

Objective-C protocol property compiler warning

旧城冷巷雨未停 提交于 2019-12-13 05:54:35
问题 I can't get rid of compiler warning when I define property inside protocol. Strange thing is that I have two properties defined, and I only get warnings for the second one (which is object type, while the first property is value type). Here is screenshot: Can anyone tell me how to get rid of this warning, and why it is generated? The code is working normally, it is just this warning that annoys me :) 回答1: Your issue is that the compiler cannot find an implementation for the properties you

What does DBMSSOCN stand for?

北战南征 提交于 2019-12-13 04:36:12
问题 I know what it is, which is the Winsock TCP/IP protocol for database connections, just not what it is an acronym for. Perhaps something like: Data Base Micro Soft SOCket Network? Seems a bit clunky. I was working with a SQL trainee today, and realized I didn't actually know what it stood for. Searching only turned up an explanation of the protocol and how it works. Any ideas? 回答1: Being Microsoft and all, we can't really know for sure ;) That being said, by looking at other similar libraries

Type variable in protocol - Swift 2

a 夏天 提交于 2019-12-13 02:52:14
问题 So I have a protocol, and in it I want a variable that is a class type. That way I can init that class from the variable. Keep in mind that there will be many different classes. I made a quick example. I get the error "type 'CashRegister' does not conform to protocol 'RegisterProtocol'" This example isn't exactly what I'm doing, but it gets the point across. Thanks for the help. protocol RegisterProtocol { var currentBill: DollarBillProtocol {get set} func makeNewBill()->DollarBillProtocol }

HMHomeManager didAddHome not returned

一世执手 提交于 2019-12-13 01:15:15
问题 I am having a problem with adding homes with HMHomeManager. I can call the function add well, but HMHomeManager does not return func homeManager(manager: HMHomeManager!, didAddHome home: HMHome!) { println("\(__FUNCTION__)") } I am sure I already assigned the delegate of homeManager. Below is my code: class ViewController: UIViewController, HMHomeManagerDelegate { var manager: HMHomeManager required init(coder aDecoder: NSCoder) { manager = HMHomeManager() super.init(coder: aDecoder) }

All Classes Conforming to Protocol Inherit Default Implementation

…衆ロ難τιáo~ 提交于 2019-12-12 19:06:19
问题 I've added a method to all my UIViewController subclasses that allows me to instantiate it from the class and the storyboard it's inside. All the methods follow this format: class func instantiateFromStoryboard() -> CameraViewController? { let storyboard = UIStoryboard(name: "Camera", bundle: nil) let initial = storyboard.instantiateInitialViewController() guard let controller = initial as? CameraViewController else { return nil } return controller } Instead , I would like to make a protocol,

Do protocols have an effect on the retain count?

可紊 提交于 2019-12-12 16:33:08
问题 I have a very simple code. I’m PURPOSELY creating a memory cycle with a delegate. Trying to observe and learn how to use Xcode's Memory Graph. What I don’t get is why in the connections sections, Xcode says there are 3 connections. There should only be 2. If I create a memory cycle with with closures, then it will show 2 connections. My code for leaking with delegate: protocol SomeDelegate { func didFinishSomething() } class Something { var delegate: SomeDelegate? } class ViewController:

How to efficiently define End-of-Transmission for XML-based text protocol?

孤人 提交于 2019-12-12 16:25:15
问题 I want to develop a text protocol based on XML and transmitted via TCP/IP sockets. Let's say I have a simple request/response mechanism to be send over a persistent TCP/IP connection between client and server like this: <?xml version="1.0" encoding="UTF-8"?> <request id="1" command="get.answer"> <value type="string">Answer to the Ultimate Question of Life, the Universe, and Everything</value> </request> <?xml version="1.0" encoding="UTF-8"?> <response id="1" command="get.answer"> <value type=