protocols

ios Swift - API GoogleMaps - not conform protocol GSMAutocompleteViewControllerDelegate

谁都会走 提交于 2020-01-07 03:05:09
问题 I'm trying to use API GoogleMaps in an ios app to make an auto-completion, but I can't get my hand on the problem, I search for it but it seems I'm the only one to have it. MyViewController doesn't conform to protocol GSMAutocompleteViewControllerDelegate class MyViewController: UIViewController { @IBAction func onLaunchClicked(sender: AnyObject) { let acController = GMSAutocompleteViewController() acController.delegate = self self.presentViewController(acController, animated: true,

Go to the next Page programmatically within a UIPageViewController

£可爱£侵袭症+ 提交于 2020-01-06 19:50:38
问题 I have a rootViewController which is basically my pageViewController which implements all the page controller protocol functions. I have already successfully implemented the whole pageViewController with a pageControl that correctly shows the current Page number. On the first page contained within the rootViewController, I have a viewController in which there are multiple textFields which have to be filled in with a pickerView. I have also created an inputAccessory toolBar which accompanies

Method cannot be a member of an @objc protocol while using Dictionary

那年仲夏 提交于 2020-01-06 14:38:52
问题 I am coding in swift. I have written a protocol @objc protocol ServerDelegate { optional func onDownloadDataComplete (downloadedData data : [Dictionary<String,Any>],result : ResultType,error : String) } First I received "Method cannot be a member of an @objc protocol because the type of the parameter 2 cannot be represented in Objective-C" for my enum but I fixed it by adding @objc. Now I am receiving this for Array of Dictionary. How to fix it? 回答1: As @originaluser2 said Any cannot be

Connect through HTTPS instead of HTTP

眉间皱痕 提交于 2020-01-06 07:46:07
问题 I want to use a simple API and i want to do it in the secure way. It is currently using sockets and port 80. As far as I know port 80 is open and it doesn't seem such a secure connection. As the data to send contains user and password i want to use HTTPS instead of HTTP to make it secure. I was wondering if it is so simple as just changing this line; $headers = "POST /api/api.php HTTP/1.0\r\n"; For this other line $headers = "POST /api/api.php HTTPS/1.0\r\n"; And changing the port to 443 Here

Protocol reported as having 'Self or associated type requirements', when it doesn't have any

微笑、不失礼 提交于 2020-01-06 03:30:47
问题 I have the following code: protocol LanguageType: Hashable { var description: String { get } } extension LanguageType { var description: String { return "(Self.self)" } var hashValue: Int { return "(Self.self)".hashValue } } func ==<T: LanguageType, U: LanguageType>(left: T, right: U) -> Bool { return left.hashValue == right.hashValue } struct English: LanguageType { } When I do the following: let english: LanguageType = English() I get the following error: Where is the associated type

How to adhere to protocol method with a Raw type in method argument?

纵然是瞬间 提交于 2020-01-05 18:54:43
问题 protocol Measurement { mutating func convert(#toUnit: String) } enum MassUnit : String { case Milligram = "mg" } enum VolumeUnit : String { case Milliliter = "ml" } struct Mass : Measurement { mutating func convert(#toUnit: MassUnit) // Build error: Does not adhere to 'Measurement' } struct Volume : Measurement { mutating func convert(#toUnit: VolumeUnit) // Build error: Does not adhere to 'Measurement' } func +<T: Measurement> (left:T, right:T) -> Measurement { let newRightValue = right

Browser plugin which can register its own protocol

被刻印的时光 ゝ 提交于 2020-01-05 17:37:23
问题 I need to implement a browser plugin which can register its own protocol (like someprotocol://someurl) and be able to handle calls to this protocol (like user clicking on 'someprotocol' link calls function inside my plugin). As far as I understand, Skype does something similar, except I need to handle links within page context and not in a separate app. Any advice on how this can be done? Can this be done without installing my own plugin, with the help of flash/java? 回答1: Things are going to

Browser plugin which can register its own protocol

别等时光非礼了梦想. 提交于 2020-01-05 17:37:10
问题 I need to implement a browser plugin which can register its own protocol (like someprotocol://someurl) and be able to handle calls to this protocol (like user clicking on 'someprotocol' link calls function inside my plugin). As far as I understand, Skype does something similar, except I need to handle links within page context and not in a separate app. Any advice on how this can be done? Can this be done without installing my own plugin, with the help of flash/java? 回答1: Things are going to

Objective-C: Class versus Protocol [duplicate]

≯℡__Kan透↙ 提交于 2020-01-05 07:16:15
问题 This question already has answers here : What is the point of Protocols? (3 answers) Closed 3 years ago . I'm reading up on protocols (and thinking I might be able to rewrite some code using them) but I seem to be getting stuck on what exactly makes it different than a class? For example, if I have a class ColorController: #import <Foundation/Foundation.h> @interface ColorController : NSObject { UIColor* colorToReturn; } - (UIColor* ) setColor : (float) red : (float) green : (float) blue;

Client server protocol with XML messages

ⅰ亾dé卋堺 提交于 2020-01-05 06:32:10
问题 I have to implement client server protocol over socket in java, and sending the data as XML messages, so i implement one by my self, but i want to know is there any standard API, or standard way to do this in java. 回答1: Yes, SOAP is the standard. Example Java implementations are Apache CXF, JAX-WS and Spring-WS. For something a bit simpler, you might want to look at Burlap, but that's very much not a standard, or XMPP. 来源: https://stackoverflow.com/questions/3182464/client-server-protocol