Including C Program into OSX Application - objective-c

I am working on a Mac OSX application in Xcode 4 that will read and display data from a program written by someone else in C. How can I put this code into my project? Do I have to create new Objective C files and then "rewrite" the C program into these ObjC files? Or can I simply include the C file in the project and reference it from other files? I have tried the latter and it didn't work, but I'm sure I was doing something wrong.
Thanks

You can do:
File->New File->Under "OS X" heading in Xcode, "C and C++" option has an option of adding a .h, .c, or .cpp file (all of which work with Objective-C).

Related

Xcode autocomplete broken for .mm files

Since there's no way to directly create .mm (Objective-C++) files in Xcode, I just create a CocoaTouch Class with Objective-C and rename the .m file to .mm file. However it seems the code autocomplete functionality is completely broken for .mm files, for example after I type "NS" I expect a list of "NSArray", "NSString", "NSLog", etc. etc. to show up, but now it only shows some code snippet shortcuts like "nsenum" and "nsoptions". If I rename the extension back to .m, the autocomplete works correctly again.
Now I wonder if there's some setting in Xcode to make the code autocomplete functionality work correctly for .mm files? So far I have not found any relevant setting, and keep renaming the extension back and forth between m and mm is really tedious after a while.

In xcode -- how to easily switch editor view from 'swift-like' generated representation of header to underlying objective-c header

Xcode has the "helpful feature" (in quotes because its not helpful to me) of generating a swift-syntax representation of objective-c headers.
When using shortcuts to open a .h file (cmd-shift-o then type Foo.h) -- sometimes you are taken to the swift representation of Foo.h and sometimes to the objective-c representation.
The vast majority of the time, I want the objective-c representation -- is there a way to quickly switch to it with keyboard shortcuts when Xcode dumps you in the swift version?
As of Xcode 9 (possibly before), you can select the "counterpart" from the four square menu. One is labeled as the swift representation, one is the ObjC representation.
As far as I know, if you are currently in a Swift file and open a header, you'll see the Swift-generated header. If you want to see the Objective-C version, you can open a .m file first, then open the header file.

Dissassembe multiple objective C .o object files at once in IDAPro from archive

I am trying to reverse engineer iOS static library files (".a" extension). Whenever I am trying to open it in IDAPro it gives me list of ".o" files in from the .a archive. My goal is to translate .o files to pseudocode using Hex Rays decompiler. It is taking so much to time to go through each object file in the list as shown in following image
This is how it looks like when I have to select object files (i have to go through one by one and save its C code. )
Is there any command via command prompt or any way that can help me in decompiling all the object files at once.
Thanks in advance for your time.

Project-Prefix.pch file in Xcode 6

In Xcode 6 the .pch file is not created automatically for you anymore. I understand there are steps to create the file on your own. My question is, should the .pch file be added at all?
Did Apple move away from the .pch file completely? Or is there a new convention used to store all #import statements?

Xcode 6 localization

I'm using XCode 6 beta 4.
I have experience with localization iOS app with xCode 5, but now I can't find a way to use localized strings in code.
When I put something like "alertMessage" = "Warning!" in Main.strings (English) and then try to use NSLocalizedString method to get my localized string, I just get same string, which I put as a parameter.
Where should I put "alertMessage" = "Warning!" and others localized strings so I could use them in code? There is no lproj folder and no Localizable.strings file.
There is a screenshot of my test project:
Updated
I found the solution. I should open in Finder lproj folder (which does not appear in Xcode) in project folder and have to manually create Localizable.strings file, and then drop him in Xcode project.