Reference for the C methods used in iPhone development - iphone

Is there a good reference somewhere with all the C functions that can be used by default in iPhone development (I guess they lie in the Foundation framework)? I mean functions like:
arc4random(), cos(), sinf(), hypot(), sqrt(), sqrtf() etc...
They are so many considering their variations too (sin(), sinf()) and googling every single time is ineffective.
Thanks :)

XCode/Help/Documentation
Then look in the Core Library. You may need to subscribe to one or more documentation sets first. Check that you search is not limited to Objective-C also.

If you're looking for all of the math functions, they can be found in the header file
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/include/math.h
For more generic functions, in addition to the documentation, I often find it helpful to right-(or Control-)click on a function in my code and choose "Jump to Definition". This takes you to the related header, which might also have similar functions and constants.

The Apple iPhone OS Man Pages doc is the handiest guide for this kind of thing.
http://developer.apple.com/iphone/library/documentation/System/Conceptual/ManPages_iPhoneOS/
Unfortunately being HeaderDoc driven, there's no PDF version. I thought at one point Apple indexed these symbols in the Xcode docset API indexes, but they don't seem to be there now.
Good luck!

Related

Embed/Read Command Line Tool in a Cocoa App (Swift 3)

I'm new here, so please be kind - I am open for tips and corrections ;)
Actually I'm trying to write an OS for a Sportsmachine. It basically contains a Joystick (JoyWarrior A8) input via USB. After some time I am now able to read the axes of the Controller using XCode, a Swift Command Line Tool with OpenGL and GLFW. The axes position is put out into the console.
What I would like to do now is to use this output in a Cocoa App to write the UI.
My questions to you are:
Is there a way to integrate and read a Command Line Tool within a Cocoa Application?
Or is there a better way to directly integrate the input into my Cocoa App?
Thank you in advance! Please let me know if something isn't explained well enough or if you need some code snippet!
As a rule-of-thumb, if you ever find yourself wondering whether Apple has an off-the-shelf solution for a feature you're trying to implement, ask yourself if the feature would be of use to a significant number of other developers. If you think that it would, you should do some googling, because there's a good chance that you're right, and that Apple will already have a library/framework that does what you need. It's fair to say that interacting with a game controller is just such a feature, and, true to form Apple, provides API to save you from having to re-invent the wheel (or use third-party wheels) - here's the guide.

Porting Max/MSP .app to iOS

I've read a number of posts on Apple's forums, and a number of posts on the Cycling '74 forums (with my own questions scattered around both) and nobody seems to be able to help me.
I used Max/MSP to write a 'patch' that takes samples and generates music. I'm going to release it as an album similar to Brian Eno's Thursday Afternoon, but wanted to make it available to people so they can have the music last for more than the hour a CD can hold.
What I don't know how to do, and can't figure out is HOW. It looks just like a regular OS X app, and the only difference I see in the directory structure is that my Max/MSP made application has extra .framework folders as well as the objects I use (which I guess are similar to 'functions' in JScript). I've looked at the package contents of both OS X files and the unpacked .ipa files from the App Store. Being so similar I would imagine it'd be pretty easy.
Where do I start? Has anybody on this forum done this? Thanks for your time!
[edit] - I just wanted to let you know I've discovered RJDJ, an iOS app that allows users to create 'scenes' in Puredata (Pd) and load them on their RJDJ program. I'd rather not go this route.
[edit2] - ok. I agree that it's very different. Especially having 4 (i could cut it down to 3) additional frameworks that aren't part of the SDK. But Ive been thinking. I can add a JavaScript object inside of my program, or make a special new object (object in max is sort of like a class in JS, i think) using C. Is there anything in these languages that would be able to convert a simple 'touch' to a 'mouseclick' in my app?
My application is very very simple. Basically just samples, played at randomly generated time intervals with some a 'conductor' to bring in/out the groups the samples are drawn from (piano, fx, etc...). So the user just clicks the 'start' button and off it goes. So the .nib file I would need to create is very simple. In my head it seems like the .ipa package/ios .app both contain unix executables and so long as these are basically the same it should work, right?
Max6 has been released.
A new object/concept named gen~ is available.
As far as I discussed with C74 dev, I know gen~ WILL provide its source code output. This code produce by the gen~ object could be useable in any other framework. basically, it will be C++
So it would really open A LOT of possibilities ; Max becoming a real graphical framework producing output that can be used in programming world.
It would save time for some part of the code.
As far as I can see from poking around at the Cycling '74 site and forums, there's currently no Max engine available for iOS. libpd is probably your best bet, really. (I'd note that the Inception app uses this Pure Data engine with a custom interface and it works very well.)
Unfortunately OSX and iOS apps are completely different under the hood. Outwardly they look similar (eg. you've noted the .app extension) but the internals are completely different.

Querying Google for iOS SDK API documentation by class name returns links to that class from the Mac OS X Library. Why? How can I avoid this?

Take CATransition as an example.
Why does Google return those results and not learn that I actually need the iOS reference library and is there a way to make it return the proper results for me?
It usually works by adding the ios keyword in the search query, but it's annoying. I generally return to the search results and click the link from the iOS Reference Library, or do another query with ios at the end and this brings me to the needed page, but I would expect the search engine to learn that I am not interested in the Mac OS X Reference.
It's probably too much to expect a search engine to tailor its results to your behavior, too many people use the same computers often without logging out of their Google account for it to be reliable.
However there is a quick fix, just make a slight change in the address bar once you're in the OSX reference.
http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CATransition_class/Introduction/Introduction.html
Can be switched to
http://developer.apple.com/library/ios/#documentation/GraphicsImaging/Reference/CATransition_class/Introduction/Introduction.html
Works for me every time.
Add site:developer.apple.com/library/ios to your Google queries. Or do the search in Xcode's documentation browser.

Is there a good iphone sdk documentation site that provides good examples / common usage?

The problem? I look up stuff in the xcode documentation and find very useful lists of objects, methods, etc... But then I still have to go somewhere else to find useful example code of how to use that object. For example, I looked up NSNumber yesterday and found all of the neat stuff it can do, but I still had no clue how to use it. That's just an example. I'm sure I could read the objective c pdf front to back and learn something there (which I plan on doing) but what about later? When I'm looking up some UIKit object? Do I have to go find a tutorial each time (or lately, I just ask StackOverflow and you guys take care of me).
Is there a part of the apple website / xcode documentation that shows the example code I'm looking for?
Is there a wiki site out there or something that has what I'm looking for? (I just tried a simple google search "iphone sdk wiki". this site could be good. iphone sdk wiki . I'll check it out. Anyone else have one they like? )
This is also sort of a mild complaint to Apple. Why not a section on each code definition page that shows usage?
I've found the sample code section on Apple's iPhone Developer Connection be extremely useful not only for samples of complete applications but also a best practices source. Going through the code of The Elements, for example, will expose you to how to use particular classes as well as how to structure your code. It is a wonderful example of how to create a non-trivial iPhone app.
Look in developer.apple.com/iphone they have pretty good documentation (you can use the search bar there) on all the classes and have a lot of good sample code..
I really would emphasize the "Related sample code" section on many, if not most, of the documented classes.
But, IMHO, there isn't any easy way of acquiring the knowledge to develop in Cocoa/Cocoa Touch. The API's are so numerous that it simply takes a lot of time and experience. You just have to work on it, look at a lot of books and study the sample source code where available.
I've tried to take a purposeful approach by carving out some time every week to learning a new API/class irrespective of whether my current project needs it or not.
Alternatively, search Joe Hewitt. He's the developer for iPhone facebook. He has a project you can download that demonstrates all the features of facebook. It's an awesome open source project!
When you look something up in Xcode Developer Documentation, you sometimes get a Related Sample Code: text that tells you what Sample the method or property is used in. Too bad you can't click on it to see the code, but if you do click it takes you to the page to download the sample. – mahboudz 0 secs ago
Apple Developer site has all kinds of code examples. Try searching google for a UICatalog project, it will show you all the basic UI stuff you can do, like adding buttons and progressbars through using only code.

Is Perl's CAM::PDF able to aggregate Annotation objects?

I have several copies of the same PDF file. These copies have annotations in it (Rect type with pop-up comments).
I want to know if I can get all these annotations from these copies and aggregate them into a single master copy using CAM::PDF (or another free tool).
an example to illustrate:
I have file1_userA.pdf and file1_userB.pdf. They are both annotated.
I want to generate file1_allusers.pdf aggregating annotations from both files file1_userA.pdf and file1_userB.pdf.
ps: I have the original un-annotated copy.
-- EDIT (Aug, 4):
I have developed an extension for CAM::PDF, namely CAM::PDF::Annot. It 'use base's CAM::PDF and adds extra functionality regarding Drawing Markup Annotations.
I am in the process of tidying up the code so I can post it to CPAN.
-- EDIT (Aug, 19)
I have finally submitted it to PAUSE, but I am running into some world writable related problems...
In any case, if anyone is interested in taking a look at the code, I will try and make it available somewhere... until then, just PM me and I will mail it to you.
geez, i'm getting such a thrill posting a module to cpan... i found the joy of working in working with Perl...
best regards,
Donato Azevedo
I'm the author of CAM::PDF. I have built only very limited support for annotations to date, specifically just for form field filling. So, no, that's not a supported feature today. The feature you describe is very interesting, though, and I can imagine that others would use it too, so I'd be interested in discussing it further with you offline.