'Development using iOS5 NewStuff' keynote for #IDOC2012. Bandung, 18th February 2012.
- iCloud Storage
- CoreImage
- NewsStand
Demo and sample code : https://github.com/DeenNa
3. SDK & Development tools?
over 1,500 new APIs and powerful new development tools
4. iCloud Storage API
Apa itu iCloud?
- Sync service
- Transfers user data between devices
- Runs in background
- Per-app sandboxing (as usual)
Keuntungannya Apa ?
- Gak perlu âsync serverâ sendiri.
- Gak perlu ânetwork protocolâ sendiri.
- Gak perlu bayar âstorage/bandwidthâ sendiri.
Intinya sih gak perlu repot-repot.
5. Konsep dan Ketentuan iCloud
Ubiquitous
Suatu keadaan yang memungkinkan manusia untuk berinteraksi dengan
âkomputerâ dimana saja, kapan saja dan bagaimana saja.
6. Sinkronisasi Background
Ubiquity daemon, ubd
Saat anda menyimpan perubahan, ubd mengirimkannya pada âcloudâ
ubd akan mengunduhnya dari iCloud
Dimana itu berarti....
8. iCloud Containers
Lokasi untuk data aplikasi anda berada di iCloud
Setiap pengaktifan iCloud pada aplikasi setidaknya hanya
memiliki satu tempat.
Kontainer sesuai dengan direktori yang kita buat
9. File Coordinator
Data dapat diubah oleh aplikasi anda atau oleh ubd
(Ubiquity Daemon)
Membutuhkan âreader/writer lockâ untuk akses koordinasi
Menggunakan âNSFileCoordinatorâ saat menulis atau
membacanya
10. File Presenter
Disertakan juga pada ďŹle koordinator
Menerapkan âNSFilePresenterâ agar mendapat
pemberitahuan akan adanya perubahan
Saat ďŹle koordinator membuat perubahan, maka âďŹle
presenterâ ini akan dipanggil.
19. UIDocument with iCloud
Acts as a ďŹle coordinator and presenter
Mendeteksi conďŹicts
- NotiďŹcations
- API to help resolve
20. UIDocument Concepts
Outside the (sand)box
- iCloud documents are not located in your app sandbox
- Located in your iCloud container
- Create the document in the sandbox
- Move it to iCloud
35. image processing technology
memungkinkan proses mendekati real-time
menyediakan akses untuk âbuilt-in image ďŹltersâ pada
video and gambar
menyediakan juga ďŹtur untuk membuat âcustom ďŹltersâ
38. CIFaceFeature
Facial Features
⢠  hasLeftEyePosition  property
⢠  hasRightEyePosition  property
⢠  hasMouthPosition  property
⢠  leftEyePosition  property
⢠  rightEyePosition  property
⢠  mouthPosition  property
40. // we'll iterate through every detected face. CIFaceFeature provides us
// with the width for the entire face, and the coordinates of each eye
// and the mouth if detected. Also provided are BOOL's for the eye's and
// mouth so we can check if they already exist.
for(CIFaceFeature* faceFeature in features)
{
// get the width of the face
CGFloat faceWidth = faceFeature.bounds.size.width;
// create a UIView using the bounds of the face
UIView* faceView = [[UIView alloc] initWithFrame:faceFeature.bounds];
// add a border around the newly created UIView
faceView.layer.borderWidth = 1;
faceView.layer.borderColor = [[UIColor redColor] CGColor];
// add the new view to create a box around the face
[self.window addSubview:faceView];
if(faceFeature.hasLeftEyePosition)
{
// create a UIView with a size based on the width of the face
UIView* leftEyeView = [[UIView alloc] initWithFrame:CGRectMake(faceFeature.leftEyePosition.x-faceWidth*0.15,
faceFeature.leftEyePosition.y-faceWidth*0.15, faceWidth*0.3, faceWidth*0.3)];
// change the background color of the eye view
[leftEyeView setBackgroundColor:[[UIColor blueColor] colorWithAlphaComponent:0.3]];
// set the position of the leftEyeView based on the face
[leftEyeView setCenter:faceFeature.leftEyePosition];
// round the corners
leftEyeView.layer.cornerRadius = faceWidth*0.15;
// add the view to the window
[self.window addSubview:leftEyeView];
}
if(faceFeature.hasRightEyePosition)
{
// create a UIView with a size based on the width of the face
UIView* leftEye = [[UIView alloc] initWithFrame:CGRectMake(faceFeature.rightEyePosition.x-faceWidth*0.15,
faceFeature.rightEyePosition.y-faceWidth*0.15, faceWidth*0.3, faceWidth*0.3)];
// change the background color of the eye view
[leftEye setBackgroundColor:[[UIColor blueColor] colorWithAlphaComponent:0.3]];
// set the position of the rightEyeView based on the face
[leftEye setCenter:faceFeature.rightEyePosition];
// round the corners
leftEye.layer.cornerRadius = faceWidth*0.15;
// add the new view to the window
[self.window addSubview:leftEye];
}
41. Detector Option Keys
Keys used in the options dictionary to conďŹgure a detector.
Detector Accuracy Options
NSString* const CIDetectorAccuracyLow;
NSString* const CIDetectorAccuracyHigh;
- CIDetectorAccuracyLow
Indicates that the detector should choose techniques that are lower in accuracy, but can be
processed more quickly.
- CIDetectorAccuracyHigh
Indicates that the detector should choose techniques that are higher in accuracy, even if it
requires more processing time.
44. Newsstand for developer
Simpel dan mudah digunakan untuk konten majalah
dan surat kabar
Termasuk gratis berlangganan untuk pengguna iPhone,
iPod touch dan iPad
Menerbitkan edisi terbaru majalah dan surat kabar
langsung menggunakan Newsstand kit dan Store kit
framework
46. Menampilkan pada Newsstand
Menjadikan Newsstand app
Menambahkan satu key dalam ďŹle
Info.plist
<key>UINewsstandApp</key>
<true/>
Yak jadilah Newsstand app!
Tapi masih butuh icon nih.
47. Menampilkan pada Newsstand
Standard icon speciďŹcation
Standard icon specification
⢠Top-level key in your Info.plist with an array of image name
<key>CFBundleIconFiles</key>
Key pada level paling atas di ďŹle <array>
Info.plist berisi array nama dari image
! <string>Icon.png</string>
! <string>Icon@2x.png</string>
...
</array>
48. Menampilkan pada Newsstand
Updating your Info.plist
Updating your Info.plist
<key>CFBundleIcons</key>
New top-level key
<dict>
<key>CFBundlePrimaryIcon</key>
Icon style key
<dict>
<key>CFBundleIconFiles</key>
<array>
Existing CFBundleIconFiles <string>Icon.png</string>
<string>Icon@2x.png</string>
</array>
</dict>
</dict>
54. Organizing Issues
Using NKLibrary
⢠Provides persistent state for :
â Available issues
â Ongoing downloads
â Issue being read
!
⢠Organizes issues
â Uses appâs Caches directory
â Improves resource management
55. Organizing Issues
NKIssues
⢠Creating issues
â Penamaan yang unik
â Tanggal publikasi
NKIssue *myIssue = [myLibrary addIssueWithName:issueName date:issueDate];
â Mengolah repository di dalam âlibraryâ
NSURL *baseURL = [myIssue contentURL];
⢠Setting the current issue
[myLibrary setCurrentlyReadingIssue:myIssue];
56. Handling Updates
Downloading content
Downloading Content
NKAssetDownload
⢠Handles data transfer
â Keeps going
⢠Uses NSURLConnectionDelegate
⢠Wake for critical events
newsstand-content
⢠Wi-Fi only in background
57. Downloading Content
Setup
NSArray *itemsToDownload = !! query server for list of assets
for (item in itemsToDownload) {
NSURLRequest *downloadRequest = [item URLRequest];
NKAssetDownload *asset = [issue addAssetWithRequest:downloadRequest];
NSURLConnection *connection = [asset downloadWithDelegate:myDelegate];
}
}
59. Updating Your Newsstand Icon
Update your icon and badge
Simple!
Update Icon
-[UIApplication setNewsstandIconImage:(UIImage*)]
⢠Bisa digunakan saat berjalan di background, jadi bisa diupdate kapanpun jika konten sudah siap.
Update Badge
⢠Uses existing badge API
-[UIApplication setApplicationIconBadgeNumber:(NSInteger)]