2010-04-04 9 views
5

la documentazione di sdk per iPhone contiene collegamenti a codice di esempio, ma è necessario scaricarli singolarmente dal Web. C'è un pacchetto che puoi scaricare tutto in una volta da Apple?download iphone sample code from apple

Ad esempio, leggendo lo first iphone tutorial allo switchonthecode, la prima nuova parola che ho trovato era UIApplication. Ci sono 5 campioni sul web ...

+0

Non poteva far male sapere che sarebbe stato un modo migliore per ottenere il codice di esempio: http://developer.apple.com/bugreporter/ –

risposta

4

Sono un principiante e ho trovato fastidioso che non hanno un zip "tutti gli esempi". Inoltre, non semplificano l'estrazione automatica perché utilizzano javascript per popolare l'elenco di esempi.

Fortunatamente ero in grado di utilizzare Chrome per ispezionare la pagina degli esempi e darmi il codice HTML "risultato finale" efficace e usarlo per creare questo script che scaricherà e decomprimerà tutti gli esempi.

Speriamo che come comunità possiamo mantenere questa lista mantenuta, ma ad oggi contiene tutti gli esempi.

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 

In una nota correlata, trovo che ack è un modo di gran lunga superiore per cercare gli esempi di trovare/grep

Spero che questo aiuta gli altri tanto come mi ha aiutato.

+1

Desidero solo che Apple abbia ospitato il codice di esempio in github o qualcos'altro. –

+0

Quello e mi auguro che li abbiano concessi in licenza con la licenza Public Source Apple. –

1

Grazie a David Blevins per l'originale pubblicato sopra. Ho guardato manualmente per qualsiasi prima aggiunta di e grep'd sceneggiatura di David aggiunta di nuovo materiale si spera mantenere lo script fino ad oggi:

#!/bin/bash 

# Found here: 
# http://stackoverflow.com/questions/2576256/download-iphone-sample-code-from-apple 

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 
CoreTelephonyDemo 
CryptoExercise 
CurrentAddress 
DateCell 
DateSectionTitles 
DocInteraction 
DrillDownSave 
EADemo 
ExternalDisplay 
FastEnumerationSample 
Formulaic 
GKAuthentication 
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 
MVCNetworking 
NavBar 
PVRTextureLoader 
PageControl 
PhotoLocations 
PhotoPicker 
Popovers 
PrintPhoto 
PrintWebView 
QuartzDemo 
QuickContacts 
Reachability 
Reflection 
Scrolling 
SeismicXML 
SimpleDrillDown 
SimpleEKDemo 
SimpleFTPSample 
SimpleGestureRecognizers 
SimpleNetworkStreams 
SimpleTextInput 
SimpleURLConnections 
SimpleUndo 
SpeakHere 
SysSound 
TableSearch 
TableViewSuite 
TableViewUpdates 
TaggedLocations 
Teslameter 
TheElements 
ThreadedCoreData 
ToolbarSearch 
TopPaid 
TopSongs 
TouchCells 
Touches 
Trailers 
TransWeb 
UICatalog 
URLCache 
ViewTransitions 
WeatherMap 
WhichWayIsUp 
WiTap 
WorldCities 
ZoomingPDFViewer 
aurioTouch 
avTouch 
iAdSuite 
iPhoneACFileConvertTest 
iPhoneCoreDataRecipes 
iPhoneExtAudioFileConvertTest 
iPhoneMixerEQGraphTest 
iPhoneMultichannelMixerTest 
iPhoneUnitTests 
oalTouch 
EOF 
1

Per quelli di voi su OSX (e non hanno wget/non voglio installarlo solo per questo). Inoltre, sembra che sia passato da http a https:

while read n; do 
curl -o $n.zip https://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 
CoreTelephonyDemo 
CryptoExercise 
CurrentAddress 
DateCell 
DateSectionTitles 
DocInteraction 
DrillDownSave 
EADemo 
ExternalDisplay 
FastEnumerationSample 
Formulaic 
GKAuthentication 
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 
MVCNetworking 
NavBar 
PVRTextureLoader 
PageControl 
PhotoLocations 
PhotoPicker 
Popovers 
PrintPhoto 
PrintWebView 
QuartzDemo 
QuickContacts 
Reachability 
Reflection 
Scrolling 
SeismicXML 
SimpleDrillDown 
SimpleEKDemo 
SimpleFTPSample 
SimpleGestureRecognizers 
SimpleNetworkStreams 
SimpleTextInput 
SimpleURLConnections 
SimpleUndo 
SpeakHere 
SysSound 
TableSearch 
TableViewSuite 
TableViewUpdates 
TaggedLocations 
Teslameter 
TheElements 
ThreadedCoreData 
ToolbarSearch 
TopPaid 
TopSongs 
TouchCells 
Touches 
Trailers 
TransWeb 
UICatalog 
URLCache 
ViewTransitions 
WeatherMap 
WhichWayIsUp 
WiTap 
WorldCities 
ZoomingPDFViewer 
aurioTouch 
avTouch 
iAdSuite 
iPhoneACFileConvertTest 
iPhoneCoreDataRecipes 
iPhoneExtAudioFileConvertTest 
iPhoneMixerEQGraphTest 
iPhoneMultichannelMixerTest 
iPhoneUnitTests 
oalTouch 
EOF 
Problemi correlati