sambatech / player_sdk_ios

MIT License
6 stars 7 forks source link

Interface incompleta na versão 2.1.0 #86

Closed marquesm91 closed 5 years ago

marquesm91 commented 5 years ago

Após a atualização para a versão 2.1.0 o Xcode começou a acusar problema na interface do SambaPlayer.

Observei que o arquivo SambaPlayer-Swift.h está bastante incompleto. Métodos básicos do player como play e stop nem foram declarados.

Acredito que houve um erro nessa versão na hora de gerar o novo Build.

Apesar da correção para o Swift 4.2.0 ter sido feita, e sou muito grato por isso, ainda ficou faltando acertar o build final.

rangelvitor commented 5 years ago

Olá, você chegou a atualizar o Carthage também para a versão atual? Limpe também por favor todos os caches possíveis (aplicação, Xcode, Carthage)

Já aplicamos a versão 2.1.0 em um aplicativo nosso e funcionou normalmente

marquesm91 commented 5 years ago

@rangelvitor Nós limpamos todos os caches como disse, mas acredito que o problema é que a implementação do Player escrevendo com Objective-C está faltando alguma coisa.

Na versão atual temos esse trecho de código no arquivo SambaPlayer-Swift.h.

/// Responsible for managing media playback
SWIFT_CLASS("_TtC11SambaPlayer11SambaPlayer")
@interface SambaPlayer : UIViewController <SambaCastDelegate>
- (void)onCastConnected;
- (void)onCastResumed;
- (void)onCastDisconnected;
- (void)onCastProgressWithPosition:(long)position duration:(long)duration;
/// Default initializer
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)aDecoder OBJC_DESIGNATED_INITIALIZER;
@property (nonatomic, readonly) UIInterfaceOrientationMask supportedInterfaceOrientations;
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id <UIViewControllerTransitionCoordinator> _Nonnull)coordinator;
- (void)viewDidAppear:(BOOL)animated;
- (void)viewWillDisappear:(BOOL)animated;
- (nonnull instancetype)initWithNibName:(NSString * _Nullable)nibNameOrNil bundle:(NSBundle * _Nullable)nibBundleOrNil SWIFT_UNAVAILABLE;
@end

Peguei a versão 0.9.9 como exemplo. O mesmo trecho de código apresenta mais declarações de método.

/// Responsible for managing media playback
SWIFT_CLASS("_TtC11SambaPlayer11SambaPlayer")
@interface SambaPlayer : UIViewController
/// Stores the delegated methods for the player events
@property (nonatomic, strong) id <SambaPlayerDelegate> _Nonnull delegate;
- (void)unsubscribeDelegate:(id <SambaPlayerDelegate> _Nonnull)delegate;
/// Current media time
@property (nonatomic, readonly) float currentTime;
/// Current media duration
@property (nonatomic, readonly) float duration;
/// Current media
@property (nonatomic, strong) SambaMedia * _Nonnull media;
/// Whether media is playing or not
@property (nonatomic, readonly) BOOL isPlaying;
/// Whether controls should be visible or not
@property (nonatomic) BOOL controlsVisible;
/// Whether player shoud be fullscreen or not
@property (nonatomic) BOOL fullscreen;
/// Sets playback speed (values can vary from -1 to 2)
@property (nonatomic) float rate;
/// Default initializer
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
/// Convenience initializer
/// \param parentViewController The view-controller in which the player view-controller and view should be embedded
///
- (nonnull instancetype)initWithParentViewController:(UIViewController * _Nonnull)parentViewController;
/// Convenience initializer
/// \param parentViewController The view-controller in which the player view-controller should be embedded
///
/// \param parentView The view in which the player view should be embedded
///
- (nonnull instancetype)initWithParentViewController:(UIViewController * _Nonnull)parentViewController andParentView:(UIView * _Nonnull)parentView;
- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)aDecoder OBJC_DESIGNATED_INITIALIZER;
/// Plays the media
- (void)play;
/// Pauses the media
- (void)pause;
/// Stops the media returning it to its initial time
- (void)stop;
/// Moves the media to a given time
/// \code
/// player.seek(20)
///
/// \endcode\param pos Time in seconds
///
- (void)seek:(float)pos;
/// Changes the current output
/// \code
/// player.switchOutput(1)
///
/// \endcode\param value Index of the output, -1 for auto switch.
///
- (void)switchOutput:(NSInteger)value;
/// Changes the current caption
/// \code
/// player.changeCaption(1)
///
/// \endcode\param value Index of the caption
///
- (void)changeCaption:(NSInteger)value;
/// Destroys the player instance
/// \code
/// player.destroy()
///
/// \endcode\param error (optional) Error type to show
///
- (void)destroyWithError:(SambaPlayerError * _Nullable)error;
@property (nonatomic, readonly) UIInterfaceOrientationMask supportedInterfaceOrientations;
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id <UIViewControllerTransitionCoordinator> _Nonnull)coordinator;
- (void)viewDidAppear:(BOOL)animated;
- (void)viewWillDisappear:(BOOL)animated;
- (nonnull instancetype)initWithNibName:(NSString * _Nullable)nibNameOrNil bundle:(NSBundle * _Nullable)nibBundleOrNil SWIFT_UNAVAILABLE;
@end

Por conta disso, fica acusando esses problemas no Xcode (veja imagem abaixo). Acredito que o problema seja os métodos não existerem na declaração da interface da classe (e.g. play, pause) . Eu até substitui o arquivo .h da versão antiga colocando na nova e o projeto compilou normalmente. Porém, acontecem erros de execução (métodos são declarados, mas não definidos talvez?).

foto com error

Por mais que vocês tenham testado tudo ai, a minha implementação foi escrita em ObjC e sempre funcionou com o SDK de vocês. Foi apenas nessa última versão que estou enfrentando esses erros.

Technical Infos

Carthage v0.33.0 SambaPlayer v2.1.0 Xcode v10.2.0 Cartfile github "sambatech/player_sdk_ios" ~> 2.1.0

rangelvitor commented 5 years ago

Uma nova release foi liberada com alguns ajustes para funcionamento com Objetive-C: https://github.com/sambatech/player_sdk_ios/releases/tag/2.1.1

Mas recomendamos fortemente a utilização de Swift ao invés de Objetive-C