3

Possible Duplicate:
Utilizing C++ in iOS and Mac OS X applications

I want to make a app with only C++ (with out using Objective C).

If I get the UIScrollView kind of class, then I can use that for Android.

Can any one guide me on this?

Community
  • 1
  • 1
  • AFAIK Apple is pretty strict and only accepts ObjC (not even C), but I think you can get around it. – Pubby Mar 19 '12 at 08:35
  • @Pubby - I am curious how they can discriminate between Objective-C and plain C which is fully contained in Objective-C. – mouviciel Mar 19 '12 at 08:37
  • Apple will allow C++ and C mixed with Objective-C. I've used a lot of plain C in my project for raw sockets and never had any problems with the Appstore approval. – rckoenes Mar 19 '12 at 08:44

5 Answers5

5

Well no, not really. Since there is no C++ version of UIKit you will need to do all the UI stuff in Objective-C. There are some bridges for Objective-C++.

You are allowed to mix C++/C with Objective-C.

FreeAsInBeer
  • 12,937
  • 5
  • 50
  • 82
rckoenes
  • 69,092
  • 8
  • 134
  • 166
1

Well theoretically you can because all of the Objective-C runtime can be accessed using C functions like objMsgSend(). However, why bother? Just learn Objective-C (or possibly, more relevantly, Objective-C++). There's nothing to stop you from coding most of the application in C++ and just doing the UI in Objective-C.

Who knows, you may come to like it.

JeremyP
  • 84,577
  • 15
  • 123
  • 161
0

Well, I think you can do a little iPhone development in C++. There is Objective-C++, but I don't know if it's supported a lot.

But I don't think you should really use only C++. I propose coding the UI in Objective-C then writing the logic etc. in C++ if you want.

ApprenticeHacker
  • 21,351
  • 27
  • 103
  • 153
0

There are some frameworks (like crossmob and libnui) that allow you to write plain old-school C++ code without using Objective-C. But there is no way to use directly Apple SDK with C++, unfortunately.

TheHube
  • 752
  • 1
  • 10
  • 23
0

You can write your model on C++. But your controller and view you have to implement on Objective-C. Because UIKit it's 100% Objective-C Framework. I think you can write OpenGL Game in Xcode only with C++ if you want.

Anatoliy Gatt
  • 2,501
  • 3
  • 26
  • 42