YTPlayerView not found issue - objective-c

Currently i have kinda strange issue with YTPLayerView. I already have a project that contains both Objective-C and Swift codes. So, I need to use Youtube Player in Objective-c. The problem is that when i declare my Objective-c View Controller in Bridging-Header my Objective-C header file fives an error "'YTPlayerView.h' file not found", but this error do not occurs when my Bridging header is empty. Maybe i forgot something to include idk. Can someone help me?
This is my Bridging Header code:
#import "CameraViewController.h";
This is my CameraViewController.h file:
#import UIKit;
#import "YTPlayerView.h"
#interface CameraViewController : UIViewController<YTPlayerViewDelegate>
#property(nonatomic, strong) IBOutlet YTPlayerView *playerView;
#end
I have already installed the podfile for youtube player:
use_frameworks!
target 'MyApp' do
pod 'youtube-ios-player-helper', '~> 0.1.4'
end
Thank you in advance!

Try to do:
#import <youtube_ios_player_helper/YTPlayerView.h>

Related

Where is NSTextField?

I'm brand new to Mac OS X development. Primarily a Java and C# developer.
I'm reading this book and trying a few examples from the book.
In my AppController class, I'm trying to add an IBOutlet as follows :
IBOutlet NSTextField *textField;
It gives me an error saying "Unknown type name 'NSTextField'.
I have imported Foundation/Foundation.h
Please help.
#import <Cocoa/Cocoa.h>
Import this in your AppController header file

Cannot access UIImage class without importing UIKit.h in Xcode 6?

#import <Foundation/Foundation.h>
#interface FaceObject : NSObject
#property (strong, nonatomic) UIImage *image;
#end
Xcode gives an error saying "unknown type name 'UIImage' unless I import UIKit.h, but in Xcode 5 i would have not gotten this error and did not need to import UIKit -- is there any explanation for this? Am I doing something wrong? Thanks!
In 2015 -- still getting this error. I always forget to include
#import <UIKit/UIKit.h>
That should take care of it.
Xcode 6 no longer includes a .pch file by default. In previous versions, that file included the UIKit import (more info here - Why isn't ProjectName-Prefix.pch created automatically in Xcode 6?).

Why is Core Plot delegate protocol not found?

I try to use Rays tutorial of Core plot for my iPad App
I use a SplitViewController
And I want to have a scatter plot in my DetailViewController
I change my Code to:
#interface GWDetailViewController : UIViewController <UISplitViewControllerDelegate,CPTPlotDataSource>
and now I get this error:
Cannot find protocol declaration for 'CPTPlotDataSource'
to add frameworks and librarys was no problem
What is wrong?
Make sure that the .h file for your view controller contains the following import statement:
#import "CorePlot-CocoaTouch.h"
If you dont want to import header file every time, you can Import it in .pch file for once.
In your scenario ,Open .pch file(usually placed in supporting file folder ) and add following code.
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "CorePlot-CocoaTouch.h"
#import "CPDConstants.h"
#import "CPDStockPriceStore.h"

Strange Delegate Protocol Declaration error?

So in a header file I have the following code:
#import <AudioToolbox/AudioToolbox.h>
#interface alertController:UIViewController <AVAudioPlayerDelegate>
{
AVAudioPlayer *player;
}
I have both the framework linked and It works just fine in another file within the same project, but I am getting the error that it cannot find the protocol declaration for "AVAudioPlayerDelegate", nor does it recognize the line AVAudioPlayer * audioPlayer because it is an unknown type name. Any ideas why this isn't working despite my import statement, including the framework, and the fact that it's working fine in another file?
AVAudioPlayer (and its delegate) come from AVFoundation, not AudioToolbox. Your other project probably imports <AVFoundation/AVFoundation.h> either through a separate included header file or through your PCH. You should replace that #import with
#import <AVFoundation/AVFoundation.h>

Declaring a subclass in ObjC fails

Here's what I'm trying to do:
I want to put away some methods into separate .h and .m files for a better overview of my code.
So basically I have the myViewController which I want to extend with the method myReactionOnAnimationDidEnd: as a category.
So I declared in "myCustomClasses.h" the following to extend it with my desired method:
#import "myViewController.h"
#interface myViewController (myReactionOnAnimationDidEnd)
- (void)myReactionOnAnimationDidEnd:(NSNotification *)aNotification;
#end
The implementation in "myCustomClasses.m" is:
#import "myCustomClasses.h"
#import "myViewController.h"
#implementation myViewController (myReactionOnAnimationDidEnd)
- (void)myReactionOnAnimationDidEnd:(NSNotification *)aNotification {
self.myLabel1.text = #"Test";
}
#end
The Compiler throws a build failed error "Cannot find interface declaration for 'myViewController'"
So here's my questions:
The first weird thing is, that everything works fine if I do exactly the same for UIViewController instead of myViewController. But since myViewController is a subclass of UIViewController, why shouldn't it work for myViewController as well(#interface iSnahViewController : UIViewController)?
The other weird thing is that the #implementation in "myCustomClasses.m" works just fine if I skip on the #declaration completely. Now how can that be??
Thank you guys!
Any help much appreciated!!
Hans
Now, the funny thing is, that this very same building error comes up even if I create the category with the New File -> ObjC - Category Template. It basically creates the following two files:
in the header file:
#import "myViewController.h"
#interface myViewController (myCategories) //<-- "Cannot find interface declaration for 'myViewController'"
#end
and with the .m file
#import "myViewController+myCategories.h"
#implementation myViewController (myCategories)
#end
And that's already enough to bring up the error from above.
myCustomClasses.m should probably include myCustomClasses.h and not myViewController.h, so the compiler sees the category declaration. Since myCustomClasses.h already includes myViewController.h, the compiler should have all necessary declarations.
I finally got it working!
As the building error occured, I was importing the Category-.h File into the primery Class's .h file:
#import "myViewController+myCategories.h" //<-- in the "myViewController.h"
which lead to the building error from above. This seems to be wrong! So don't do that.
I still don't fully understand how the "myViewController" Class gets to know about it's categories without even having their .h files imported, but as this appears to be a working way of how this is done, I wanted to share with you.
Thanks everybody for helping!!