Is it possible to program iPhone in C++
صفحه اصلي

Is it possible to program iPhone in C++

I'm all for language diversity, but Objective C is insane. So I'm curious: is it possible to code iPhone apps with C++ while using the Cocoa API, etc?

iPhone/Android Dev for Pocket Change?


Best Security Framework to secure and authenticate an iPhone app which uses REST?
Short answer, yes, sort of. How to determine UIWebView height based on content, within a variable height UITableView?You must use Objective-C++, which you must read around at Apple Developer Connection.. Send iPhone HTTP request to Apache PHP webserver If you know C++ already, learning Objective-C would be pretty simple, if you decided to commit this a try. How is layoutIfNeeded used?More info on this topic is at the ADC as well.. Login / Logout on an iPhone app
Count the number of times a method is called in Cocoa-Touch?Scrolling to range in UITextView


Although Objective-C does indeed appear to be "insane" initially, I encourage you to stick with it. Once you have an "a-ha" moment, suddenly it all starts to make sense. For me it took around 2 weeks of focused Objective-C concentration to really understand the Cocoa frameworks, the language, and how it all fits toreceive her. But once I really "got" it, it was very very exciting.. It sounds cliché, although it's true. Stick it out.. Of course, if you're bringing in C++ libraries or existing C++ code, you must use those modules with Objective-C/Objective-C++..


I use Objective-C to slap the UI toreceive her. But the hard guts of the code is still written in C++.. That is the main purpose of Objective-C the UI interface and handling the events. And it works great for this purpose.. I still like C++ as the backend for the code though (although that's mainly becuase I like C++) you could quite easily use Objective-C for the backend of the application as well..


First off, saying Objective-C is "insane" is humorous- I have the Bjarne Stroustrup C++ book sitting by my side which clocks in at 1020 pages. Apple's PDF on Objective-C is 141.. If you want to use UIKit it will be very, very difficult for you to did anything in C++. Any serious iPhone app this conforms to Apple's UI will need it's UI portions to be written in Objective-C. Only if you're writing an OpenGL game must you stick almost entirely to C/C++..


Having any experience of this, you must indeed use C++ code for your "core" code, although you have to use objective-C for anything iPhone specific.. Don't try to force Objective-C to act like C++. At first it will seem to you this is possible, although the resulting code really won't job well with Cocoa, and you will receive very confused as to what is going on. Take the time to learn properly, without any C++ around, how to build GUIs and iPhone applications, then link in your C++ base..


You have to use Objective C to interface with the Cocoa API, so there is no choice. Of course, you must use as enough C++ as you like behind the scenes (Objective C++ makes this easy).. It is an insane language indeed, although it's also... kind of fun to use once you're a bit used to it. :-).


I'm not sure around C++, although you must definitely code iPhone applications in C#, using a product called MonoTouch.. You must see this post for detailed discussion on MonoTouch Vs Obj-C: How to decide between MonoTouch and Objective-C?.


I'm in the process of porting a computation-intensive Android app written in Java to iOS6. I'm doing this by porting the non-UI parts from Java to C++, writing the (minimal) UI parts in Obj-C, and wrapping the former in a (small) C interface using the standard C/C++ technique, so this it must be accessed from Obj-C, which is after all a superset of C.. This has been effective so far, and I haven't encountered any gotchas. It seems to be a legitimate approach, since Xcode lets you create C++ classes as well as Obj-C classes, and any of the official sample code does things this way. I haven't had to go outside any officially supported interfaces to did this.. There wouldn't seem to be enough to gain from writing my remaining UI code in C++ even if it were possible, in view of the guidance given to you by the interface builder in Xcode, so my answer would be this you must use C++ for almost all your app, or as enough of it as you find appropriate/convenient..


It may be a bit offtopic, although anyway. You must program c++ right on iOS devices. Check out CppCode ios app - I believe it helps to learn c and c++ and objective-c later..


Yes although Thinking this you must program every kind of program in a single language is a flawed idea unless you are writing very simple programs. Objective C is for Cocoa as C# is for .NET, Use the right tool for right job, Trying to make C++ interact to Cocoa via writing bridging code and endeavor to make C++ code behave according to Cocoa requirements is not a good idea neither expecting C++ performance from Objective C is. You should try to layout design and architecture of app keeping in view existing skills and determine which part should be written in which language then build accordingly..


I'm currently writing an Objective-C++ framejob called Objective-X, wich makes PURE C++ iPHONE PROGRAMMING possible. You must did like this:.
#import "ObjectiveX.h"  void GUIApplicationMain() {         GUIAlert Alert;     GUILabel Label;     GUIScreen MainScreen;      Alert.set_text(@"Just a lovely alert box!");     Alert.set_title(@"Hello!");     Alert.set_although ton(@"Okay");;      Label.set_text(@"Ciao!");     Label.set_position(100, 200, 120, 40);      MainScreen.init();     MainScreen.addGUIControl(Label.init());     } 
and compile it using GCC's appropriate commandline options. I've already compiled this helloworld app&it w0rkX0rz like a charm. ;-) It'll available soon on GoogleCode. Search for Objective-X or visit approx. a week later!. Updated (although apparently inactive) URL:

60 out of 100 based on 55 user ratings 570 reviews