Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

download iphone sample code from apple [closed]

the iphone sdk documentation has links to sample code, but you have to download them individually from the web. Is there a bundle you can download all at once from apple ?

For example, reading the first iphone tutorial at switchonthecode, the first new word I came across was UIApplication. There are 5 samples on the web...

like image 626
Naveen Avatar asked Apr 04 '10 23:04

Naveen


2 Answers

I'm a beginner as well and found it annoying they don't have an "all examples" zip. They also don't make it easy to pull them down automatically because they use javascript to populate the list of examples.

Fortunately I was able to use Chrome to inspect the examples page and give me the effective "end result" HTML and used it to create this script which will download and unpack all of the examples.

Hopefully we as a community can keep this list maintained, but as of today it does contain all the examples.

ios-examples.sh

#!/bin/bash

while read n; do
    wget "http://developer.apple.com/library/ios/samplecode/$n/$n.zip" &&
    unzip "$n.zip" &&
    rm "$n.zip"
done <<EOF
AQOfflineRenderTest
AccelerometerGraph
Accessory
AddMusic
AdvancedTableViewCells
AdvancedURLConnections
AlternateViews
AppPrefs
BatteryStatus
BonjourWeb
Breadcrumb
BubbleLevel
CopyPasteTile
CoreDataBooks
CryptoExercise
CurrentAddress
DateCell
DateSectionTitles
DocInteraction
DrillDownSave
EADemo
FastEnumerationSample
Formulaic
GKRocket
GKTank
GKTapper
GLES2Sample
GLGravity
GLImageProcessing
GLPaint
GLSprite
GLTextureAtlas
GenericKeychain
HazardMap
HeaderFooter
HeadsUpUI
HelloWorld_iPhone
Icons
InternationalMountains
KMLViewer
KeyboardAccessory
LaunchMe
LazyTableImages
ListAdder
LocateMe
Locations
MailComposer
MapCallouts
MessageComposer
Metronome
MixerHost
MoveMe
MoviePlayer_iPhone
MultipleDetailViews
MusicCube
NavBar
PVRTextureLoader
PageControl
PhotoLocations
PhotoPicker
Popovers
PrintPhoto
PrintWebView
QuartzDemo
QuickContacts
Reachability
Reflection
Scrolling
SeismicXML
SimpleDrillDown
SimpleEKDemo
SimpleFTPSample
SimpleGestureRecognizers
SimpleNetworkStreams
SimpleURLConnections
SimpleUndo
SpeakHere
SysSound
TableSearch
TableViewSuite
TableViewUpdates
TaggedLocations
Teslameter
TheElements
ToolbarSearch
TopPaid
TopSongs
TouchCells
Touches
Trailers
TransWeb
UICatalog
URLCache
ViewTransitions
WeatherMap
WhichWayIsUp
WiTap
WorldCities
ZoomingPDFViewer
aurioTouch
avTouch
iAdSuite
iPhoneCoreDataRecipes
iPhoneExtAudioFileConvertTest
iPhoneMixerEQGraphTest
iPhoneMultichannelMixerTest
iPhoneUnitTests
oalTouch
EOF

On a related note, I find that ack is a far superior way to search the examples than find/grep

Hope this helps others as much as it helped me.

like image 123
David Blevins Avatar answered Oct 11 '22 07:10

David Blevins


http://www.jerrybeers.com/index.php/2011/06/18/copying-xcode-samples/ shows how to get all the samples from the existing xcode install on your machine. Very useful!

like image 43
user906825 Avatar answered Oct 11 '22 06:10

user906825