Newsstand

2,490 views

Published on

Published in: Technology
1 Comment
3 Likes
Statistics
Notes
  • Can you let me know how many published i have to create for new issue release ... is it one for each and where to create it in server or ITC account
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
2,490
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
15
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide

Newsstand

  1. 1. Newsstand Kaz Yoshikawa
  2. 2. Why Newsstand?• Contents can be delivered to devices while sleeping • background downloading• Good for subscription type business model • Magazines, Newspaper, Free papers ...
  3. 3. How Newsstand Work?④ Launch with Your ServerBackground mode ① Launch Time Device Token, etc. ⑤ Download Contents Contents SSL ② When New Issue is Ready Certificate Device Token ⑥ Enjoy Reading Contents ③ Push Notification Apple’s APNS
  4. 4. Requirements (Vender)• Server facility • Hosting contents for downloading: • Capable of simultaneous download requests • Push Notifications • Server side programming: i.e. Apache+MySQL+PHP • SSL Certificate *
  5. 5. Provisioning Portal Paper Work
  6. 6. New App ID
  7. 7. Enable Push Notification
  8. 8. Register SSL Certificate
  9. 9. Provisioning Profiles• Push Notification won’t work on Wildcard provisioning
  10. 10. iTunes Connect Another Paper Work
  11. 11. Add New App from ITC• In-App-Purchase can only be configured from iTunesConnect•
  12. 12. In-App Purchases
  13. 13. In-App Purchases Auto-Renewable Free Subscription
  14. 14. Add Duration and Pricing Duration Sale or not Price Tier
  15. 15. Adding a Language
  16. 16. In-App Purchases
  17. 17. Shared Secret
  18. 18. Enabling Newsstand
  19. 19. Issues
  20. 20. Issue Added
  21. 21. ATOM Feed• Apple’s server checks your new issues time to time to update iTunesConnect.
  22. 22. Xcode
  23. 23. Info plist
  24. 24. Register Remote Notification - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)options{! // ...! UIRemoteNotificationType type = UIRemoteNotificationTypeBadge |! ! ! ! UIRemoteNotificationTypeSound |! ! ! ! UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeNewsstandContentAvailability;! [[UIApplication sharedApplication] registerForRemoteNotificationTypes:type];}
  25. 25. Newsstand Notification• Receive remote notification only once a day • You cannot push two contents a day• You can push regular push notifications multiple time• For debuging: [[NSUserDefaults standardUserDefaults] setValue:@YES forKey:@"NKDontThrottleNewsstandContentNotifications"];
  26. 26. Send Token To Your Server with APS Environment- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)token{#if DEBUG! NSString *aps_environment = @"development"; Why?#else! NSString *aps_environment = @"production";#endif! // send token to your server with other properties aps_environment}
  27. 27. Different Token: Development/Production Debug Release APNS production Sandbox development app_id token environmentcom.electricwoo 0x123...af30 development Yourds.yourmagazinecom.electricwoo 0x5c6...78c1 production Server APNSds.yourmagazine Production
  28. 28. Downloading New Issue Your ServerAPNS ① Push Notification ② Query Issues{ Issue name, Published date, Download URL "aps":{! "content-available":1, }, ③ Download new Issue ...} Payload ④ Unzip* and move ⑤ Replace Newsstand Icon * optional
  29. 29. Downloading New Issue- (void)downloadContentName:(NSString *)name URL:(NSURL *)URL date:(NSDate *)date{ NKLibrary *lib = [NKLibrary sharedLibrary]; NKIssue *issue = [lib issueWithName:name]; if (!issue) { issue = [lib addIssueWithName:name date:date]; NKAssetDownload *download = [issue addAssetWithRequest: [NSURLRequest requestWithURL:URL]]; [download downloadWithDelegate:self]; }}- (void)connectionDidFinishDownloading:(NSURLConnection *)connection destinationURL:(NSURL *)destinationURL{! NSIssue *issue = connection.newsstandAssetDownload.issue; NSString *contentPath = issue.contentURL.path; // unzip destinationURL to contentPath}
  30. 30. Restore Downloads at Launch Time! Don’t forget NKLibrary *library = [NKLibrary sharedLibrary];! for (NKAssetDownload *download in library.downloadingAssets) {! ! [download downloadWithDelegate:self];! }
  31. 31. Making a list of IssuesNKLibrary *lib = [NKLibrary sharedLibrary];NSArray *issues = [lib issues]; Build a Great Bookshelf
  32. 32. In App Purchase
  33. 33. Auto-renewable Subscription• Newsstand App requires at least one Auto-renewable subscription or free subscription• Auto-renewable durations are: 7d, 1m, 2m, 3m, 6m, 1y• StoreKit won’t let app know duration from product identifier • Need to query to your server or hard-coded
  34. 34. Restore Problem• What if Someone purchased auto-renewable subscriptions in-and-out few times• Purchased records can be retrieved by restore operation• But it can be cancelled, and StoreKit wouldn’t tell me...• Needs to ask to Apple’s server to verify those purchasesJan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
  35. 35. Verifying Receipt- (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue*)queue! for (SKPaymentTransaction *transaction in queue.transactions) {! ! NSString *identifier = transaction.payment.productIdentifier;! ! switch (transaction.transactionState) {! ! case SKPaymentTransactionStatePurchasing: // ...! ! case SKPaymentTransactionStateFailed: // ...! ! case SKPaymentTransactionStatePurchased:! ! case SKPaymentTransactionStateRestored:! ! ! [self verifyTransactionReceipt:transaction];! ! ! break;! ! }! }}- (void)verifyTransactionReceipt:(SKPaymentTransaction *)transaction{ ... do your stuff ... [queue finishTransaction:transaction];}
  36. 36. DEBUG Verifying Receipts App Store Production { "receipt-data" : "(receipt bytes here)", "sandbox" : 1 } { "status" : 0, "receipt" : , "latest_receipt" : ... { 0 "latest_receipt_info" : ... "receipt-data" : "(receipt bytes here)", } "password" : "(shared secret bytes here)" OK } Sandbox { "status" : 0, App StoreYour Server "receipt" : { (receipt here) }, "latest_receipt" : "(base-64 encoded receipt here "latest_receipt_info" : { (latest receipt info here }
  37. 37. PRODUCTION Verifying Receipts App Store Production { { "receipt-data" : "(receipt bytes here)", "receipt-data" : "(receipt bytes here)", "password" : "(shared secret bytes he } } { "status" : 21006, { "receipt" : { (receipt here) }, "status" : 21006, "latest_receipt" : "(base-64 encoded re "receipt" : , "latest_receipt_info" : { (latest receip "latest_receipt" : ... }21006 "latest_receipt_info" : ... }expired Sandbox App StoreYour Server
  38. 38. Auto renewable subscription recurring duration Production Sandbox 1 week 3 minutes 1 month 5 minutes 2 months 10 minutes 3 months 15 minutes 6 months 30 minutes 1 year 1 hour Automatically expires in 6th time recurring
  39. 39. "receipt" :{ Not Expired "receipt":{ Expired "unique_identifier":"44f9ec48b952a....34e12c61c9c4f", "unique_identifier":"44f9ec48b952a....34e12c61c9c4f", "original_transaction_id":"1000000055744550", "original_transaction_id":"1000000055744550", "expires_date":"1348131173000", "expires_date":"1347344399000", "transaction_id":"1000000056135747", "transaction_id":"1000000055932398", "quantity":"1", "quantity":"1", "product_id":"yourmagazine.1mo", "product_id":"yourmagazine.1mo", "original_purchase_date_ms":"1347343199000", "original_purchase_date_ms":"1347343199000", "bid":"com.electricwoods.newsstand", "bid":"com.electricwoods.newsstand", "bvrs":"1.0", "bvrs":"1.0", "expires_date_formatted":"2012-09-20 08:52:53 Etc/GMT", "expires_date_formatted":"2012-09-11 06:19:59 Etc/GMT", "purchase_date":"2012-09-20 08:47:53 Etc/GMT", "purchase_date":"2012-09-11 06:14:59 Etc/GMT", "purchase_date_ms":"1348130873000", "purchase_date_ms":"1347344099000", "original_purchase_date":"2012-09-11 05:59:59 Etc/GMT", "original_purchase_date":"2012-09-11 05:59:59 Etc/GMT", "item_id":"558725164", "item_id":"558725164"}; },“status”: 0 "status":21006
  40. 40. Wrap Up
  41. 41. These are what you get Newsstand Push Notification In AppPurchase UIKit
  42. 42. This is what you gonna build
  43. 43. kyoshikawa@electricwoods.com Thank you Electricwoods LLC

×