user177893
user177893

Reputation: 145

For Question About a Warning In Objective-c Coding

I have one file viewcontroller.h and .m and viewcontroller1.h and .m

In viewcontroller1.m file , i write function like BOOL rechable = [viewcontroller functionrechable];

it gives me warning like warning:initialization makes integer from pointer without a cast

how to remove this warning??? is it any way to do it?

Upvotes: 0

Views: 43

Answers (2)

AnthonyLambert
AnthonyLambert

Reputation: 8830

What is the definition for the method [viewcontroller functionrechable]....

The solution is most likely:

BOOL rechable = (BOOL) [viewcontroller functionrechable];

But I would need the definition to be sure.

Upvotes: 0

ennuikiller
ennuikiller

Reputation: 46965

This is telling you that your defining reachable as a BOOL type which really resolves to an integer typye, yet the [viewcontroller functionrechable] message is returning a pointer. You can remove the warning either by casting the return type of the function to BOOL or int, or changing the type of reachable to a pointer.

Upvotes: 1

Related Questions