What comes after learning objective-c for programming an ios device? - objective-c

It appears the language is the same for either device ios or mac os on a mbp, but if I learn Objective-C in a tutorial, won't I also need to learn cocoa or cocoa touch to program effectively?
I'm not sure how to start on my path of learning to program an ios device. I know I need to learn objective-c and that appears to work on all apple products. Then do I move to cocoa touch for ipad and iphone? What comes after objective-c?
The type of project is akin to a web app but native objective-c app instead. Have ui, buttons, the app hits some back end location, returns data, I put it on that same ui. Only, as stated, use objective-c and whatever framework and library to do it (that's my dilemma. I dont know what to do next after objective-c).
thanks.

Cocoa and Objective-c go hand in hand. For getting started, I would suggest going over some old WWDC footage and following some of the examples there.
As far as Cocoa and Cocoa touch are concerned, they are very similar in many aspects, same name conventions, similar structure, etc. Learn one, and you can easily pick up the other.
#craig adds:
I would further this answer by also mentioning that Objective-C is a programming language, while Cocoa/Cocoa Touch are collections of frameworks that are provided by Apple, and used by developers to add functionality to their programs. (Which are written in Objective-C.) The Cocoa frameworks contain various UI components like buttons, table views, sliders, etc. in addition to various fundamental classes like NSString and other text- and graphics-based APIs

I started my learning by watching thenewboston's xcode tutorials:
you can begin with this one
Good luck :)

I prefer books for some strange reason and I found that the Apress series of IOS development is really good. The book goes through developing iPhone and iPad apps using all kinds of Cocoa libraries. There's a lot of good books out there on the subject; I would go find one that looks like it would suit your needs.

Related

How do I add a subview to a view

I want to learn more about XCode, so I created an application that is intended for general desktop/laptop use, but not for iPhone.
It has AppController built on #include "Foundation/Foundation.h" and using files that I named AppController.h, AppController.m, and the MainMenu.xib file that was generated by the development system.
Now I want to add a subview. As I work though the problem, I'm obviously leaving out something or I'm incorrectly coding something. I can find many tutorials that provide a list of steps that are intended for iPhone applications, but none that fit my non-iPhone project.
Here's a chapter from Aaron Hillegass's book that shows how to do custom views and explains the view hierarchy.
There's also a "View Programing Guide" available on Apple's web site.
I'd very much recommend buying the physical book of "Cocoa Programming for Mac OS X" and going through each of the chapters and doing each of the practice apps. You might think it expensive, but it's absolutely worth every penny. It one of those resources I used way back when I wanted to become a hardcore Cocoa engineer.

Does Objective-C have views?

The rejection of a recent edit I suggested gave me doubts about something I thought I knew on Objective-C.
I've lived under the assumption that the UIViews are part of iOS, that iOS is a descendant of Objective-C and that Objective-C has no default kits with any views.
I've tried some Google and Stack Overflow searches, but the results didn't seem trustworthy and were mostly about UIViews. Wikipedia seems to mention nothing about this .
Does Objective-C have views? Or is that, as I assumed before, a common misunderstanding?
The problem that I see is that iOS is NOT a descendant of Objective C.
iOS is the operating system (like Windows Linux OSX) whilst Objective-C is a programming language albeit one that most iOS and OSX apps are written in. However there are iOS apps written in Python and other languages,
iOS as such does not have views - these are part of the Cocoa-touch framework which is a set of libraries that run on iOS and can be called with Objective C code. Although in practice for the programmer the difference between calling code in iOS and Cocoa touch is not really clear if you are only writing for iOS devices, the split is clearer in OSX where you can write code just using OSX calls or can use Cocoa frameworks.
As noted the views are part of the Cocoa touch framework. This can be called by any language including Objective - C. Most languages do not include the ability to write GUIS as part of itself they usually make use of separate libraries to do this. For example Objective C has no GUI libraries itself but has had Cocoa touch written for iOS, Cocoa and Carbon (although that mainly uses a C binding) for OSX and GNUStep for Windows and Unix like OSes (and historically NeXTStep, OpenStep, Rhapsody, basically earlier versions of Cocoa, on various OSs and Stepstone's ICPak 201)
Objective-C is the open source programming language. UIKit(iOS) and AppKit(Mac OS) are what provide the visual elements - and this is not open source.
Objective-C itself doesn't have a UI, that's provided by other frameworks.
From what I have understood obj-c's views are part of the UIKit framework : check here
which is designed for constructing GUI applications on the iOS.
I don't think you can use this framework in other obj-c applications but on iOS. Probably there are other frameworks that have views which can be used.
Edit: And yes, good point by #Mark that you are confusing the Operating System with the Programming Language

Can you use MacRuby to develop applications for the Mac App Store?

I have some basic familiarity with Objective-C, but prefer Ruby, so I'm thinking of playing around with MacRuby. Is it possible to use MacRuby to develop applications for the Mac App Store, or do I have to use Objective-C? (Note that I don't care so much about iOS/the iPhone and iPad store right now, just the Mac OS X app store.)
And to answer the actual question, yes, see http://lists.macosforge.org/pipermail/macruby-devel/2010-November/006475.html.
Short answer: Yes, you can, technically, build such an app. You need to revisit the store guidelines to know what requirements must be met to submit to the various stores.
This comes up sporadically; beyond the guidelines that #NSResponder mentioned, the reality is that you'll just be spending a lot of extra & unnecessary time if you decide to use MacRuby unless you plan on using some large chunk of already written Ruby code in your app.
Learning Objective-C is about 2% of the overall learning needed to be an effective Cocoa developer. The other 98% is everything from memory management model to standard idioms like KVC/KVO/delegation to NIB files to the myriad of classes & APIs throughout the system.
All of those things are written in Objective-C (or C) with documentation targeting Objective-C and examples written in Objective-C.
As well, the entire tool chain is focused on validating, compiling, indexing, debugging, and manipulating Objective-C.
If you want to use MacRuby to build a real Cocoa app, you are going to have to know Objective-C through and through anyway. And you are going to have to deal with whatever bugs and impedance mismatch is in the bridge layer, too.
Yes. As the Mac developer forums says:
My Mac app is not written in
Objective-C. Is this allowed on the
MacApp Store?
Yes, provided it also adheres to the
Mac App Store Review Guidelines at
http://developer.apple.com/appstore/mac/resources/approval/guidelines.htmland
the Mac Developer Program License
Agreement at
http://developer.apple.com/programs/terms/mac/mac_program_agreement_20101020.pdf
(via alloy)
Read the submission guidelines here: https://developer.apple.com/appstore/mac/resources/approval/guidelines.html

migrating an application from carbon to cocoa

I am working on an application in which I need to migrate the whole code of it from carbon to cocoa.I have experience in programming of C,C++,python and Java during my college time and internship but have never touched objective C or have done any programming for Mac(Carbon and Cocoa) before this.
So Can you please suggest me some sources to start with, also how should I go about the whole migration ?
After researching on net I have found that most the people have suggested following books
Cocoa Programming for Mac® OS X, Third Edition by Aaron Hillegass
Programming in Objective C - Stephen Kochan
I have got both these books.
Should I read them first and then should start with the code change? (it will take some time to read both of these)
OR
after having a decent fimiliarity with Obj C and Cocoa, should I directly get started with code migration?
Also,
since I don't know carbon , what should I refer to learn carbon to have sufficient knowledge to migrate the carbon code to cocoa?
First, learn Carbon so you can read the program and understand how it's currently implemented.
Install the Legacy documentation set in Xcode to gain access to the Carbon guides. You'll want to read the Carbon Overview, then Getting Started with Carbon, then everything that Getting Started links to. You'll also need to learn Core Foundation, which some of the more modern parts of Carbon use; read Core Foundation Design Concepts and the Memory Management Programming Guide for Core Foundation.
Then, learn Cocoa.
I didn't learn by the Hillegass book, but a lot of people swear by it. My current favorite Cocoa book is “Cocoa and Objective-C: Up and Running” by Scott Stevenson. The way I learned Cocoa was using Apple's own docs. Start with The Objective-C Programming Language, the Cocoa Fundamentals Guide, and the Memory Management Programming Guide for Cocoa. Much of the last document will seem really familiar, but skip nothing. Read every one of those guides from beginning to end and all the way through.
Once you've learned Cocoa's general concepts, you can move on to more application-specific material. Start with the Application Architecture Overview and most of what that document links to. The Cocoa Guides list has the full list of guides.
Down the road, you'll also need to make the application compatible with 64-bit mode. If you still have any Carbon code by that point, you'll need to read the 64-bit Guide for Carbon Developers; either way, you'll also need the general 64-bit Transition Guide and the 64-bit Transition Guide for Cocoa.
I am working on this process myself right now, and it's a fairly complex undertaking for a full document-based application that uses a few frameworks. My Carbon app has dozens of menu items, the interface is built with Carbon Nibs and implemented using Carbon event hooks. The programming language is C++. Going back in history, the original Mac classic version was implemented in straight C, so there's a little bit of legacy from that era too. Resource-based PICS for example!
There are several approaches one can take, so it depends on your particular situation how to proceed. In my case I decided to start with a bare Cocoa document-based project and start building the document loading code, because the hooks for that are already in place in the empty project. This seems like a good place to start for me, because it gets me into the mode of working with Cocoa and thinking about the app in terms of smaller pieces.
You really have to take a methodical approach and look at what your app depends on in Carbon versus which parts of your app are independent - for instance your abstract classes. If your app is in C++ there may be some pitfalls with converting over to pure Objective-C. Operator overrides can be tricky to notice, for example.
You can mix C++ with Objective-C, as described in Apple's Carbon-Cocoa Integration Guide and around the web you can find plenty of C++ wrappers for Cocoa foundation objects like NSStrings. So if you already have C++ classes that wrap CFString, these can come in handy.
Generally-speaking, you can leave your data storage just as it is. If you use malloc() and calloc() to make a linked list of structs, there's no special reason to move over to an NSArray. You won't get better performance. The real change comes in the interfaces, the way you call and access that data from other objects. If you decide to mix C++ and Objective-C objects in the same app it helps to encapsulate as much as possible. That is, as much as possible make your abstract C++ classes only refer to their own data and that of other C++ objects. Eventually this will make it easier to transition them to Objective-C.
If you're transitioning from one event model to another or from Carbon port-based imaging to Cocoa's views-based imaging, it's probably best to start with a fresh Objective-C app and bring over your model classes first. Add some test functions to make sure they all work within the new language. If your app is anything like mine (old) then it probably needs to display some things larger, and to have more polish in the interface. This is a good time to rebuild those parts piece-by-piece.
There's definitely no great shortcut. The PDF linked above is the best document I've found on the topic.

Programming for IPhone - Do you really need to learn Objective-c?

Looking on-line I saw that I can write most of the application in Ansi-C code or as a website and present it in a webView control.
Then besides some general knowledge about iOS and the API... Do I really need to learn Objective C?
You could use something like PhoneGap, which wraps an HTML-based application into a native launcher app. It may not be as powerful as what you can do with a pure native app, but on the other hand, your code will not only run on iOS.
PhoneGap does offer access to some of the phone's API (camera, notifications, accelerometer and so on) that you normally only get in native apps (it exposes them as JavaScript objects), so you can do more than you could in a regular HTML5 webapp, even without learning Objective-C.
Most people overlook the fact the iPhone has an extremely capable web browser. You can create very powerful web apps and therefore avoid having to learn objective C.
Safari on the iPhone has a bunch of great HTML5 features, including local sqlite stoage - so for example you could easily make a todo list app which could sync up with your server when there's a net connection.
You can even add home screen icons etc.. personally I'm astonished people don't write iPhone web apps more!
This is a super useful guide on how to do it:
http://building-iphone-apps.labs.oreilly.com/
You can use C# to write iPhone apps using MonoTouch, but it costs money. Then again, so does developing for the iPhone the normal way.
The other answers are correct in that you /can/ use other languages... you really don't want to. You are never going to create a pleasant to use, standard, and HIG-abiding application without learning Objective-C. Truly, though, there's no reason /not/ to learn something new. It's not particularly difficult (like, say, C++), and Cocoa is a well-designed API.
Somewhat related, I personally refuse to install all the PhoneGap/etc apps in the App Store as I find them of significantly less inherent quality (especially as compared to the rest of the apps on the device), and I would suspect many non-developers would have similar issues with them, if not so specific.
Unless your app is all web, or uses a framework such as PhoneGap you have to have some working knowledge of obj-C. It's actually not that bad. It's C with Smalltalk bolted onto it.
It's generally much simpler than C++.
if u want true native app that can take advantage of the latest features on the latest iOS release, Objective-C is da language you gotta learn.
Objective-C is a very powerful language, and there are a ton of great frameworks - you are doing yourself a HUGE disservice by not learning the language, and your app quality will suffer as a result.
You can write an entire iPhone app in C++ using a framework like libnui.