1

I have some problems when i am run any projects in Xcode 5 it gives error like

Duplicate interface definition for class 'ViewController'

Image of error in ViewController

it is happen in most of situations if i download any project from git hub or from other sources.

But if i run that project in earlier version of Xcode than its working fine. I have tried to run it Xcode 4.6 .

here is sample code that i run in Xcode 5 and gives error.

So whats problem with Xcode 5 ??

Popeye
  • 11,839
  • 9
  • 58
  • 91
  • http://stackoverflow.com/questions/5180232/duplicate-interface-declaration-for-class-test-coredataappdelegate – iPatel Feb 20 '14 at 06:49
  • @iPatel: download sample code that edited in question, and you will never see `include` in whole project. this is working fine in Xcode 4.6 so what happen fro xcode 5? –  Feb 20 '14 at 06:51
  • Does the error in the Issue Navigator (Command-4) show you where the previous definition is? (Reveal the details of the Semantic Issue error.) – Phillip Kinkade Feb 20 '14 at 06:52
  • @PhillipKinkade: yes it shows Semantic Issue error in issue navigation ., I have Included project which i am running. –  Feb 20 '14 at 06:53
  • @Optimistic - http://stackoverflow.com/questions/3911941/duplicate-interface-declaration-for-class-foo – iPatel Feb 20 '14 at 06:54
  • @Optimistic it builds successfully for me in Xcode 5 Version 5.0.2 (5A3005). – Phillip Kinkade Feb 20 '14 at 06:55
  • @iPatel:check accepted answer of that, still it is un answered http://stackoverflow.com/a/3912027/2265763 , see accepted answers comments. –  Feb 20 '14 at 06:56
  • @PhillipKinkade: i am using Xcode 5.0, so is it bug of Xcode 5.0 ? –  Feb 20 '14 at 06:59
  • I don't know. I'm not seeing the problem on my system. I recommend that you read the details of the Semantic Issue error to find the other declaration of ViewController. – Phillip Kinkade Feb 20 '14 at 07:07
  • Works for me to same version as @PhillipKinkade – Janak Nirmal Feb 20 '14 at 07:16
  • Thanks for your help, by mistake i have change some system header file. check my answer. –  Feb 20 '14 at 07:18
  • hey i am using xcode 5.0.1 n its working fine can you tell me which version you are using @Optimistic – Gajendra Rawat Feb 20 '14 at 07:18

1 Answers1

0

Solved:

By some Mistake i have Change System Header file from UIKIT > UITableViewController.h to

NS_CLASS_AVAILABLE_IOS(2_0) @interface ViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>

SO in any project if there is a viewcontroller named ViewController it gives this error,

So i have look in old xcode and changed it to

NS_CLASS_AVAILABLE_IOS(2_0) @interface UITableViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>

  • I'm not sure I understand your solution. You changed it to `NS_CLASS_AVAILABLE_IOS(2_0) @interface UITableViewController : UIViewController ` Should this return an error as `UITableViewController` is already a class in `UIKit`. – Popeye Feb 20 '14 at 08:08
  • @Popeye: in `UITableViewController.h` by mistake i have change `@interface UITableViewController :` to **@interface ViewController :** –  Feb 20 '14 at 09:43
  • Why are you even playing with that file? This is a locked file and requires a password to unlock, it should never be messed with. – Popeye Feb 20 '14 at 09:56
  • As i said earlier by mistake i had changed this file. –  Feb 21 '14 at 06:40