incompatible pointer types: UIImage and UIImageView - ios

Sprite *shipViewTemp = [[UIImageView alloc] initWithImage:(UIImage *) ship];
This is the only error in my code, can anyone help?
xcode says
incompatible pointer types

Check out the full error that Xcode is giving you. Generally, the error/warning will be telling you exactly what's wrong. In this case the full error is likely:
Incompatible pointer types initializing 'Sprite' with an expression of type 'UIImageView *'
In this case, it's telling you that you're trying to assign an instance of UIImageView to a variable that is expecting a Sprite. (In my screenshot below I used NSString, but you'd see something similar with Sprite.)

Related

Setting the line cap of a CAShapeLayer

I'm having a really weird error pop up when I try to run one line of code.
I have a subclass of CAShapeLayer, on which I am trying to set the line cap style. I want to use the round cap style, but when I add this code:
[self setLineCap: kCGLineCapRound];
The build fails and I get this error and warning:
Implicit conversion of 'int' to 'NSString *' is disallowed with ARC
Incompatible integer to pointer conversion sending 'int' to parameter of type 'NSString *'
But if I add this:
[self setLineCap: kCGLineCapButt];
It builds just fine. Why is it breaking on the other line cap type? Is this a problem/bug with Quartz?
Pertinent info.
iOS SDK 8.1
Xcode 6.1.1
Deployment Target iOS 7.0
CAShapeLayer uses kCALineCap*** which is a defined constant string in the CAShapeLayer.h file, and not a kCGLineCap*** which is part of an enum.

Calling a function in the active view's class from the app delegate

The code I have currently functions correctly, however, at present it throws a warning. As the app is to be shipped soon and this particular component is responsible for key functionality I figured it would be worth asking.
The code is as follows (modified slightly):
REC_AppAuthPage *thisView = ((UINavigationController*)self.window.rootViewController).visibleViewController;
[thisView receiveSomeString:someString];
'REC_AppAuthPage' is a UIViewController class.
The warning being thrown is:
"Incompatible pointer types initializing 'REC_AppAuthPage *' with an expression of type 'UIViewController *'"
My question is, is it okay to ignore the warning and release or does something need to be changed? If so what?
Cheers
Add a specific cast to the assignment:
REC_AppAuthPage *thisView = (REC_AppAuthPage *)((UINavigationController*)self.window.
rootViewController).visibleViewController;

Incompatible pointer types assigning to 'AVAssetReaderTrackOutput *' from 'AVAssetReaderOutput *'

I am getting a warning 'incompatible pointer types assigning to 'AVAssetReaderTrackOutput *' from 'AVAssetReaderOutput *'' while using GPUImage library. I have edited 'GPUImageMovie.m' so as to enable audio playback as suggested here.
Please help me to remove this warning.

No matching function for call to 'CGImageDestinationCreateWithURL'

My target links against the ImageIO framework, and in the file in which I use CGImageDestinationCreateWithURL, I #import <ImageIO/ImageIO.h>, and yet I still get said error. Any ideas?
The message in the error was Candidate function not viable: no known conversion from 'NSURL *' to CFURLRef' (aka qconst __CFURL *) for 1st argument.
I needed to cast the first argument, which was type NSURL, to a CFURLRef.
CGImageDestination objects, available in OS X v10.4 or later, abstract the
data-writing task. An image destination can represent a single image or
multiple images. It can contain thumbnail images as well as properties
for each image.
Apple document

xcode4 parameter of incompatible type

A project that runs fine on Xcode3, fails to compile on Xcode4 with this error:
file://localhost/users/Ishaq/Projects/game01/libs/cocos2d/CCLayer.m:
error: Semantic Issue: Sending 'ccColor4B' (aka 'struct _ccColor4B')
to parameter of incompatible type 'CIColor *'
the code that throws this error is below (from cocos2d-iphone CCLayer.m):
+ (id) layerWithColor:(ccColor4B)color
{
return [[[self alloc] initWithColor:color] autorelease];
}
Somehow Xcode thinks this code is calling - (id)initWithColor:(CIColor *)color; of CIImage (inside CIImage.h). How can I set Xcode's brain straight? ;-)
I've got the same problem. My resolution was to explicitly cast it proper type which helps the compiler to find the proper class. So the code looks like this:
return [[(CCColorLayer*)[self alloc] initWithColor:color] autorelease];
You could change self to the actual classname CCLayer which should point Xcode in the right direction.
The same thing happened for me when using the "LLVM GCC 4.2" compiler. Changing the compiler setting to "Apple LLVM Compiler 3.0" fixed it.

Resources