card-io / card.io-iOS-source

The open-source code for the card.io-iOS-SDK: provides fast, easy credit card scanning in mobile apps
Other
686 stars 372 forks source link

Compiler errors on Xcode 8 #69

Closed reidmain closed 8 years ago

reidmain commented 8 years ago

card.io is failing to compile on Xcode 8 on line https://github.com/card-io/card.io-iOS-source/blob/master/Classes/CardIOVideoStream.mm#L267

The problem is that the the cardIOPaymentViewControllerForResponder: method is defined as + (CardIOPaymentViewController *)cardIOPaymentViewControllerForResponder:(UIResponder *)responder. So it is expecting a UIResponder * as the parameter.

https://github.com/card-io/card.io-iOS-source/blob/master/Classes/CardIOVideoStream.mm#L267 is calling CardIOPaymentViewController *vc = [CardIOPaymentViewController cardIOPaymentViewControllerForResponder:self.delegate]; and self.delegate is defined as @property(nonatomic, weak, readwrite) id<CardIOVideoStreamDelegate> delegate; so it is not guaranteed to be a UIResponder *.

I honestly have no idea how this currently compiles on Xcode 7 but apparently the compiler has been updated for Xcode 8 and is now catching this.

I think you can just update CardIOVideoStream.h to be @property(nonatomic, weak, readwrite) UIResponder<CardIOVideoStreamDelegate> *delegate; and then this compiler error will go away. It looks like the CardIOCameraView is the only thing that uses CardIOVideoStream and it is a subclass of UIView which is a UIResponder.

josharian commented 8 years ago

Thanks. Send a PR?

reidmain commented 8 years ago

Sure, I'll try to get some up now.

reidmain commented 8 years ago

Fixed by merging in https://github.com/card-io/card.io-iOS-source/pull/70