Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7854731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:10:01+00:00 2026-06-02T20:10:01+00:00

I have a ViewController class (maybe I shouldn’t have named that class that way

  • 0

I have a ViewController class (maybe I shouldn’t have named that class that way ?)

Why do I have a warning

Incompatible pointer type assigning to ‘ViewController’ from
‘UIViewController’ in AppDelegate

Update:

at this line

self.viewController = [[[myPlugin alloc] getPluginViewController] autorelease];

in AppDelegate.h I have

@class ViewController;

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@property (strong, nonatomic) ViewController *viewController;

@end

in myPlugin I have

-(ViewController*) getPluginViewController {
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
    return self.viewController;

In ViewController I have

@interface ViewController : UIViewController {
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T20:10:09+00:00Added an answer on June 2, 2026 at 8:10 pm

    The viewController property in your app delegate probably has type UIViewController* and you are trying to assign an object of type ViewController* to it. Probably your ViewController class needs to inherit from UIViewController.

    There are many other problems with your code:

    self.viewController = [[[myPlugin alloc] getPluginViewController] autorelease];
    

    Ignoring the assignment, the first message sent to an object straight after it has been allocated should be an init message by convention. 99.99% of programmers will automatically assume this is a horrendous bug in your code whether or not it is a horrendous bug. You should stick to the conventions.

    Also, if getPluginViewController abides by the memory management rules, you do not own the object it returns, so you must not autorelease it.

    -(ViewController*) getPluginViewController {
         self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
         return self.viewController;
    }
    

    In itself, this is kind of OK. In Objective-C, by convention, a method beginning with “get” is for methods that return values in pointer parameters. However, putting it together with where you call it there are several problems:

    • the original allocated ViewController leaks because this method returns a pointer to a different object
    • the original allocated ViewController is never initialised
    • the returned ViewController is autoreleased twice.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class that is viewcontroller and I'v putted it inside of tabbar.
I have a ViewController class that has a property that is the model which
My parent ViewController class contains a UISearchBar. I have a UIButton that will push
I have a ViewController class called GamePlay. In GamePlay there is a nested class
I have a UITableView in a ViewController class. The ViewController class uses a custom
I have a view controller class that has to implement several protocols. Too keep
I have the problem that my view controller class has too many delegates and
Say I have a class ObjectA (a view controller for example), that does this
I have a ViewController that has its own NIB. I would like to embed
I have a viewController that autorotates just fine, The problem is that is I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.