protocols

net::ERR_CERT_AUTHORITY_INVALID when trying to locally call to API

落花浮王杯 提交于 2020-01-14 03:46:06
问题 I have an AngularJS served at http://localhost:4200 and an apache server api located at https://localhost. Both of these separately work just fine. but, when trying to request from my AngularJS app which is sitting in a non-SSL protocol and on a different port to my API sitting on SSL protocol and on a different port, I get this error net::ERR_CERT_AUTHORITY_INVALID on my chrome devTools network tab. Do I need to change my SSL configuration? Should I enable or disable an option in chrome?

Objective-c multicasting delegates

陌路散爱 提交于 2020-01-13 18:20:07
问题 I create new tabbed view project in xcode, in appdelegate I created a protocol .h file @protocol myProtocol <NSObject> -(void)myProtocolMethodOne; @end . . . @property (weak) id<myProtocol> mypDelegate; .m file @synthesize mypDelegate; . . . //Inside didFinishLaunchingWithOptions [mypDelegate myProtocolMethodOne]; In firstViewController & secondViewController (both are displayed as two different tab) I did this in both AppDelegate *ad = (AppDelegate*)[[UIApplication sharedApplication]delegate

How can I make my Objective-C class conform to Swift's `Equatable` protocol?

独自空忆成欢 提交于 2020-01-13 10:37:31
问题 I have an Objective-C class (that happens to be a button, but that is not important), and at another part of my (mixed language) project, I have an array of these buttons and I'd like to get the index of a button using the find() method. Like so: func doSomethingWithThisButtonIndex(index:Int) { let buttons = [firstButton, secondButton, thirdButton] if index == find(buttons, firstButton) { // we've selected the first button } } but I'm getting the Type 'ImplicitlyUnwrappedOptional' does not

objective-c protocol delegates

只愿长相守 提交于 2020-01-13 07:24:51
问题 I'm understanding how delegates work, had gone trough some examples, but now with a basic app for testing, it seems i haven't yet got it, here my code: Class defining protocol > *.h #import <Foundation/Foundation.h> @protocol protoPerra <NSObject> -(void) dimeTuNombre:(NSString *) s; @end @interface MyClassic : NSObject { id<protoPerra> _delegate; } @property (assign) id<protoPerra> delegate; @end Class implementing protocol> *.m #import "MyClassic.h" @implementation MyClassic @synthesize

How to use multiple protocols in Swift with same protocol variables?

元气小坏坏 提交于 2020-01-13 01:40:08
问题 In swift I'm implementing two protocols, GADCustomEventInterstitial and GADCustomEventBanner . Both of these protocols require a property called delegate . delegate is a different type in each protocol, and thus a conflict arises. class ChartBoostAdapter : NSObject, GADCustomEventInterstitial, GADCustomEventBanner, ChartboostDelegate{ var delegate:GADCustomEventInterstitialDelegate?; // Name conflict var delegate:GADCustomEventBannerDelegate?; // Name conflict override init(){ } ... } 回答1:

How to conform to a self-made protocol?

我与影子孤独终老i 提交于 2020-01-12 06:14:26
问题 I have a class with an delegate property. Anyone who wants to be a delegate must conform to a protocol. I defined everything like this: #import <UIKit/UIKit.h> @protocol TheDelegateProtocol; @interface MyClass : UIView { id<TheDelegateProtocol> theDelegate; } @property (nonatomic, assign) id<TheDelegateProtocol> theDelegate; @end @protocol TheDelegateProtocol<NSObject> @required - (void)fooBarWithFoo:(CGFloat)foo; @end Now the crazy thing is: I have another class that wants to be the delegate

How to conform to a self-made protocol?

[亡魂溺海] 提交于 2020-01-12 06:14:14
问题 I have a class with an delegate property. Anyone who wants to be a delegate must conform to a protocol. I defined everything like this: #import <UIKit/UIKit.h> @protocol TheDelegateProtocol; @interface MyClass : UIView { id<TheDelegateProtocol> theDelegate; } @property (nonatomic, assign) id<TheDelegateProtocol> theDelegate; @end @protocol TheDelegateProtocol<NSObject> @required - (void)fooBarWithFoo:(CGFloat)foo; @end Now the crazy thing is: I have another class that wants to be the delegate

H.323, How to make a simple ring without media. This script was following Q.931 setup but still not working

☆樱花仙子☆ 提交于 2020-01-11 13:55:11
问题 Can anyone please help me to solve this? When i send this request i have seen in wireshark that packets are going to SJPhone in 1720 tcp port. But still SJPhone does not ring. I want to make it ring (no matter for media). I would really appreciate your support. I must be missing the message protocol details to implement this. Please show me some positive pointers. FYI: i have used this trace: http://www.vconsole.com/usermanuals/sample_isdn_trace.pdf import java.io.*; import java.net.*; public

swift program to interface

时间秒杀一切 提交于 2020-01-11 12:51:49
问题 class Car and Truck are written here as an example but they could be unknown to the program at compile time. there could be more kinds of cars not yet known for instance there could be a special class called Ferrari, Lamborghini, that may come down the road not known to the system. our objective is to program to interface, not to a specific implemenation we need to do similar to the following create an instance var vehicle: IDrive = Vehicle() vehicle.drive() we tried some techniques and

Pseudo Random Generator with same output

时光毁灭记忆、已成空白 提交于 2020-01-11 09:36:28
问题 I came across an article about Car remote entry system at http://auto.howstuffworks.com/remote-entry2.htm In the third bullet, author says, Both the transmitter and the receiver use the same pseudo-random number generator. When the transmitter sends a 40-bit code, it uses the pseudo-random number generator to pick a new code, which it stores in memory. On the other end, when the receiver receives a valid code, it uses the same pseudo-random number generator to pick a new one. In this way, the