2010-04-04 12 views
5

Dokumentacja iPhone SDK zawiera linki do przykładowego kodu, ale musisz pobrać je pojedynczo z sieci. Czy istnieje pakiet, który możesz pobrać na raz z Apple?pobierz kod przykładowy iPhone'a z Apple

Na przykład, czytając first iphone tutorial po przełączeniu kodu, pierwszym nowym słowem, które znalazłem, było UIApplication. Jest 5 próbek w Internecie ...

+0

To nie zaszkodzi dać im znać, że będzie to lepszy sposób na pobranie przykładowego kodu: http://developer.apple.com/bugreporter/ –

Odpowiedz

4

Jestem również początkującym i okazało się to irytujące, że nie mają "wszystkich przykładów" zip. Nie ułatwiają też automatycznego ich usuwania, ponieważ używają javascript do wypełnienia listy przykładów.

Na szczęście udało mi się skorzystać z przeglądarki Chrome, aby przejrzeć stronę przykładów i podać efektywny "wynik końcowy" HTML i użyć go do stworzenia tego skryptu, który pobierze i rozpakuje wszystkie przykłady.

Mamy nadzieję, że jako społeczność będziemy w stanie zachować tę listę, ale od dzisiaj zawiera ona wszystkie przykłady.

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 

Na powiązana uwaga, uważam, że ack jest o wiele lepszy sposób, aby szukać przykładów niż find/grep

Nadzieja to pomaga innym, jak wiele ponieważ to mi pomogło.

+1

Po prostu życzę sobie, aby Apple hostował przykładowy kod w github lub coś innego. –

+0

To i ja żałuję, że nie licencjonowali ich na podstawie licencji Apple Public Source. –

1

Podziękowania dla Davida Blevinsa za oryginał zamieszczony powyżej. I ręcznie spojrzał na każdy pierwszy dodany i grep'd scenariusza Davida dodanie nowych rzeczy nadzieją utrzymania skrypt na bieżąco:

#!/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

Dla tych z was na OSX (i nie mają wget/nie chcą instalować go tylko do tego). Poza tym wygląda na to, że przeniesiono go z http do 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 
Powiązane problemy