Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bugfix for Touch with Alpha, courtesy of Dirk

  • Loading branch information...
commit b8ca8905d17015839a0917e1dcd407d055890236 1 parent 0eef808
Erica Sadun authored
Showing with 1,298 additions and 2 deletions.
  1. +15 −0 C05-ViewControllers/02-SegmentMenu/main.m
  2. +0 −1  C07-Images/09-Multiscroller/HelloWorld.xcodeproj/project.pbxproj
  3. +2 −1  C08-Gestures/04-Testing Touches With Alpha/main.m
  4. BIN  C14-Device/06-Free Movement/ButterflyArt/Default.png
  5. BIN  C14-Device/06-Free Movement/ButterflyArt/Default1.png
  6. BIN  C14-Device/06-Free Movement/ButterflyArt/Default2.png
  7. BIN  C14-Device/06-Free Movement/ButterflyArt/arrow.png
  8. BIN  C14-Device/06-Free Movement/ButterflyArt/bf_1.png
  9. BIN  C14-Device/06-Free Movement/ButterflyArt/bf_10.png
  10. BIN  C14-Device/06-Free Movement/ButterflyArt/bf_11.png
  11. BIN  C14-Device/06-Free Movement/ButterflyArt/bf_12.png
  12. BIN  C14-Device/06-Free Movement/ButterflyArt/bf_13.png
  13. BIN  C14-Device/06-Free Movement/ButterflyArt/bf_14.png
  14. BIN  C14-Device/06-Free Movement/ButterflyArt/bf_15.png
  15. BIN  C14-Device/06-Free Movement/ButterflyArt/bf_16.png
  16. BIN  C14-Device/06-Free Movement/ButterflyArt/bf_17.png
  17. BIN  C14-Device/06-Free Movement/ButterflyArt/bf_2.png
  18. BIN  C14-Device/06-Free Movement/ButterflyArt/bf_3.png
  19. BIN  C14-Device/06-Free Movement/ButterflyArt/bf_4.png
  20. BIN  C14-Device/06-Free Movement/ButterflyArt/bf_5.png
  21. BIN  C14-Device/06-Free Movement/ButterflyArt/bf_6.png
  22. BIN  C14-Device/06-Free Movement/ButterflyArt/bf_7.png
  23. BIN  C14-Device/06-Free Movement/ButterflyArt/bf_8.png
  24. BIN  C14-Device/06-Free Movement/ButterflyArt/bf_9.png
  25. BIN  C14-Device/06-Free Movement/ButterflyArt/net.png
  26. BIN  C16-Push/01-PushClientUniversal/Audio/ping1.caf
  27. BIN  C16-Push/01-PushClientUniversal/Audio/ping2.caf
  28. BIN  C16-Push/01-PushClientUniversal/Audio/ping3.caf
  29. BIN  C16-Push/01-PushClientUniversal/Covers/cover-ipad-landscape.png
  30. BIN  C16-Push/01-PushClientUniversal/Covers/cover-ipad-portrait.png
  31. BIN  C16-Push/01-PushClientUniversal/Covers/cover-iphone-landscape.png
  32. BIN  C16-Push/01-PushClientUniversal/Covers/cover-iphone-portrait.png
  33. BIN  C16-Push/01-PushClientUniversal/Default Images/Default-Landscape.png
  34. BIN  C16-Push/01-PushClientUniversal/Default Images/Default-Portrait.png
  35. BIN  C16-Push/01-PushClientUniversal/Default Images/Default.png
  36. BIN  C16-Push/01-PushClientUniversal/Default Images/icon.png
  37. +35 −0 C16-Push/01-PushClientUniversal/HelloWorld-Info.plist
  38. +305 −0 C16-Push/01-PushClientUniversal/HelloWorld.xcodeproj/project.pbxproj
  39. +8 −0 C16-Push/01-PushClientUniversal/HelloWorld_Prefix.pch
  40. +20 −0 C16-Push/01-PushClientUniversal/TestBed Support/TestBedViewController.h
  41. +706 −0 C16-Push/01-PushClientUniversal/TestBed Support/TestBedViewController.xib
  42. +207 −0 C16-Push/01-PushClientUniversal/main.m
View
15 C05-ViewControllers/02-SegmentMenu/main.m
@@ -13,6 +13,19 @@ @interface TestBedViewController : UIViewController
@end
@implementation TestBedViewController
+
+// Return an exhaustive descent of the view's subviews
+NSArray *allSubviews(UIView *aView)
+{
+ NSArray *results = [aView subviews];
+ for (UIView *eachView in [aView subviews])
+ {
+ NSArray *riz = allSubviews(eachView);
+ if (riz) results = [results arrayByAddingObjectsFromArray:riz];
+ }
+ return results;
+}
+
-(void) segmentAction: (UISegmentedControl *) sender
{
// Update the label with the segment number
@@ -41,6 +54,8 @@ - (void) loadView
segmentedControl.momentary = NO;
segmentedControl.selectedSegmentIndex = 0;
#endif
+
+ CFShow(allSubviews(segmentedControl));
// Add it to the navigation bar
View
1  C07-Images/09-Multiscroller/HelloWorld.xcodeproj/project.pbxproj
@@ -196,7 +196,6 @@
INFOPLIST_FILE = Info.plist;
PREBINDING = NO;
PRODUCT_NAME = HelloWorld;
- "PROVISIONING_PROFILE[sdk=iphoneos*]" = "09BC1CCF-453F-409C-B6C0-E6434BABBD03";
};
name = Debug;
};
View
3  C08-Gestures/04-Testing Touches With Alpha/main.m
@@ -21,7 +21,8 @@
}
CGSize size = image.size;
- void *bitmapData = malloc(size.width * size.height * 4);
+ // void *bitmapData = malloc(size.width * size.height * 4);
+ unsigned char *bitmapData = calloc(size.width * size.height * 4, 1); // Courtesy of Dirk. Thanks!
if (bitmapData == NULL)
{
fprintf (stderr, "Error: Memory not allocated!");
View
BIN  C14-Device/06-Free Movement/ButterflyArt/Default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C14-Device/06-Free Movement/ButterflyArt/Default1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C14-Device/06-Free Movement/ButterflyArt/Default2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C14-Device/06-Free Movement/ButterflyArt/arrow.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C14-Device/06-Free Movement/ButterflyArt/bf_1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C14-Device/06-Free Movement/ButterflyArt/bf_10.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C14-Device/06-Free Movement/ButterflyArt/bf_11.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C14-Device/06-Free Movement/ButterflyArt/bf_12.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C14-Device/06-Free Movement/ButterflyArt/bf_13.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C14-Device/06-Free Movement/ButterflyArt/bf_14.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C14-Device/06-Free Movement/ButterflyArt/bf_15.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C14-Device/06-Free Movement/ButterflyArt/bf_16.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C14-Device/06-Free Movement/ButterflyArt/bf_17.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C14-Device/06-Free Movement/ButterflyArt/bf_2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C14-Device/06-Free Movement/ButterflyArt/bf_3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C14-Device/06-Free Movement/ButterflyArt/bf_4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C14-Device/06-Free Movement/ButterflyArt/bf_5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C14-Device/06-Free Movement/ButterflyArt/bf_6.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C14-Device/06-Free Movement/ButterflyArt/bf_7.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C14-Device/06-Free Movement/ButterflyArt/bf_8.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C14-Device/06-Free Movement/ButterflyArt/bf_9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C14-Device/06-Free Movement/ButterflyArt/net.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C16-Push/01-PushClientUniversal/Audio/ping1.caf
Binary file not shown
View
BIN  C16-Push/01-PushClientUniversal/Audio/ping2.caf
Binary file not shown
View
BIN  C16-Push/01-PushClientUniversal/Audio/ping3.caf
Binary file not shown
View
BIN  C16-Push/01-PushClientUniversal/Covers/cover-ipad-landscape.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C16-Push/01-PushClientUniversal/Covers/cover-ipad-portrait.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C16-Push/01-PushClientUniversal/Covers/cover-iphone-landscape.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  C16-Push/01-PushClientUniversal/Covers/cover-iphone-portrait.png
Diff not rendered
View
BIN  C16-Push/01-PushClientUniversal/Default Images/Default-Landscape.png
Diff not rendered
View
BIN  C16-Push/01-PushClientUniversal/Default Images/Default-Portrait.png
Diff not rendered
View
BIN  C16-Push/01-PushClientUniversal/Default Images/Default.png
Diff not rendered
View
BIN  C16-Push/01-PushClientUniversal/Default Images/icon.png
Diff not rendered
View
35 C16-Push/01-PushClientUniversal/HelloWorld-Info.plist
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string>icon.png</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.sadun.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+</dict>
+</plist>
View
305 C16-Push/01-PushClientUniversal/HelloWorld.xcodeproj/project.pbxproj
@@ -0,0 +1,305 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 45;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; };
+ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
+ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
+ 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; };
+ 8E7D47211128F49D00B184C5 /* cover-ipad-landscape.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E7D471D1128F49D00B184C5 /* cover-ipad-landscape.png */; };
+ 8E7D47221128F49D00B184C5 /* cover-ipad-portrait.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E7D471E1128F49D00B184C5 /* cover-ipad-portrait.png */; };
+ 8E7D47231128F49D00B184C5 /* cover-iphone-landscape.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E7D471F1128F49D00B184C5 /* cover-iphone-landscape.png */; };
+ 8E7D47241128F49D00B184C5 /* cover-iphone-portrait.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E7D47201128F49D00B184C5 /* cover-iphone-portrait.png */; };
+ 8E7D47471128F52000B184C5 /* TestBedViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8E7D47461128F52000B184C5 /* TestBedViewController.xib */; };
+ 8E7D474D1128F56600B184C5 /* Default-Landscape.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E7D47491128F56600B184C5 /* Default-Landscape.png */; };
+ 8E7D474E1128F56600B184C5 /* Default-Portrait.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E7D474A1128F56600B184C5 /* Default-Portrait.png */; };
+ 8E7D474F1128F56600B184C5 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E7D474B1128F56600B184C5 /* Default.png */; };
+ 8E7D47501128F56600B184C5 /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 8E7D474C1128F56600B184C5 /* icon.png */; };
+ 8ED7057D112B3C3000A24321 /* ping1.caf in Resources */ = {isa = PBXBuildFile; fileRef = 8ED7057A112B3C3000A24321 /* ping1.caf */; };
+ 8ED7057E112B3C3000A24321 /* ping2.caf in Resources */ = {isa = PBXBuildFile; fileRef = 8ED7057B112B3C3000A24321 /* ping2.caf */; };
+ 8ED7057F112B3C3000A24321 /* ping3.caf in Resources */ = {isa = PBXBuildFile; fileRef = 8ED7057C112B3C3000A24321 /* ping3.caf */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ 1D6058910D05DD3D006BFB54 /* HelloWorld.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloWorld.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 32CA4F630368D1EE00C91783 /* HelloWorld_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HelloWorld_Prefix.pch; sourceTree = "<group>"; };
+ 8D1107310486CEB800E47090 /* HelloWorld-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "HelloWorld-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; };
+ 8E7D471D1128F49D00B184C5 /* cover-ipad-landscape.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "cover-ipad-landscape.png"; sourceTree = "<group>"; };
+ 8E7D471E1128F49D00B184C5 /* cover-ipad-portrait.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "cover-ipad-portrait.png"; sourceTree = "<group>"; };
+ 8E7D471F1128F49D00B184C5 /* cover-iphone-landscape.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "cover-iphone-landscape.png"; sourceTree = "<group>"; };
+ 8E7D47201128F49D00B184C5 /* cover-iphone-portrait.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "cover-iphone-portrait.png"; sourceTree = "<group>"; };
+ 8E7D47451128F52000B184C5 /* TestBedViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestBedViewController.h; sourceTree = "<group>"; };
+ 8E7D47461128F52000B184C5 /* TestBedViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TestBedViewController.xib; sourceTree = "<group>"; };
+ 8E7D47491128F56600B184C5 /* Default-Landscape.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape.png"; sourceTree = "<group>"; };
+ 8E7D474A1128F56600B184C5 /* Default-Portrait.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Portrait.png"; sourceTree = "<group>"; };
+ 8E7D474B1128F56600B184C5 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
+ 8E7D474C1128F56600B184C5 /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = "<group>"; };
+ 8ED7057A112B3C3000A24321 /* ping1.caf */ = {isa = PBXFileReference; lastKnownFileType = file; path = ping1.caf; sourceTree = "<group>"; };
+ 8ED7057B112B3C3000A24321 /* ping2.caf */ = {isa = PBXFileReference; lastKnownFileType = file; path = ping2.caf; sourceTree = "<group>"; };
+ 8ED7057C112B3C3000A24321 /* ping3.caf */ = {isa = PBXFileReference; lastKnownFileType = file; path = ping3.caf; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 1D60588F0D05DD3D006BFB54 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
+ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */,
+ 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 19C28FACFE9D520D11CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 1D6058910D05DD3D006BFB54 /* HelloWorld.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
+ isa = PBXGroup;
+ children = (
+ 29B97316FDCFA39411CA2CEA /* main.m */,
+ 29B97317FDCFA39411CA2CEA /* Resources */,
+ 29B97323FDCFA39411CA2CEA /* Frameworks */,
+ 19C28FACFE9D520D11CA2CBB /* Products */,
+ );
+ name = CustomTemplate;
+ sourceTree = "<group>";
+ };
+ 29B97317FDCFA39411CA2CEA /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 8ED70579112B3C3000A24321 /* Audio */,
+ 8E7D471C1128F49D00B184C5 /* Covers */,
+ 8E7D47481128F56600B184C5 /* Default Images */,
+ 8E7D47441128F52000B184C5 /* TestBed Support */,
+ 32CA4F630368D1EE00C91783 /* HelloWorld_Prefix.pch */,
+ 8D1107310486CEB800E47090 /* HelloWorld-Info.plist */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+ 29B97323FDCFA39411CA2CEA /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */,
+ 1D30AB110D05D00D00671497 /* Foundation.framework */,
+ 288765A40DF7441C002DB57D /* CoreGraphics.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ 8E7D471C1128F49D00B184C5 /* Covers */ = {
+ isa = PBXGroup;
+ children = (
+ 8E7D471D1128F49D00B184C5 /* cover-ipad-landscape.png */,
+ 8E7D471E1128F49D00B184C5 /* cover-ipad-portrait.png */,
+ 8E7D471F1128F49D00B184C5 /* cover-iphone-landscape.png */,
+ 8E7D47201128F49D00B184C5 /* cover-iphone-portrait.png */,
+ );
+ path = Covers;
+ sourceTree = "<group>";
+ };
+ 8E7D47441128F52000B184C5 /* TestBed Support */ = {
+ isa = PBXGroup;
+ children = (
+ 8E7D47451128F52000B184C5 /* TestBedViewController.h */,
+ 8E7D47461128F52000B184C5 /* TestBedViewController.xib */,
+ );
+ path = "TestBed Support";
+ sourceTree = "<group>";
+ };
+ 8E7D47481128F56600B184C5 /* Default Images */ = {
+ isa = PBXGroup;
+ children = (
+ 8E7D47491128F56600B184C5 /* Default-Landscape.png */,
+ 8E7D474A1128F56600B184C5 /* Default-Portrait.png */,
+ 8E7D474B1128F56600B184C5 /* Default.png */,
+ 8E7D474C1128F56600B184C5 /* icon.png */,
+ );
+ path = "Default Images";
+ sourceTree = "<group>";
+ };
+ 8ED70579112B3C3000A24321 /* Audio */ = {
+ isa = PBXGroup;
+ children = (
+ 8ED7057A112B3C3000A24321 /* ping1.caf */,
+ 8ED7057B112B3C3000A24321 /* ping2.caf */,
+ 8ED7057C112B3C3000A24321 /* ping3.caf */,
+ );
+ path = Audio;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 1D6058900D05DD3D006BFB54 /* HelloWorld */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "HelloWorld" */;
+ buildPhases = (
+ 1D60588D0D05DD3D006BFB54 /* Resources */,
+ 1D60588E0D05DD3D006BFB54 /* Sources */,
+ 1D60588F0D05DD3D006BFB54 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = HelloWorld;
+ productName = HelloWorld;
+ productReference = 1D6058910D05DD3D006BFB54 /* HelloWorld.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 29B97313FDCFA39411CA2CEA /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloWorld" */;
+ compatibilityVersion = "Xcode 3.1";
+ hasScannedForEncodings = 1;
+ mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 1D6058900D05DD3D006BFB54 /* HelloWorld */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 1D60588D0D05DD3D006BFB54 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8E7D47211128F49D00B184C5 /* cover-ipad-landscape.png in Resources */,
+ 8E7D47221128F49D00B184C5 /* cover-ipad-portrait.png in Resources */,
+ 8E7D47231128F49D00B184C5 /* cover-iphone-landscape.png in Resources */,
+ 8E7D47241128F49D00B184C5 /* cover-iphone-portrait.png in Resources */,
+ 8E7D47471128F52000B184C5 /* TestBedViewController.xib in Resources */,
+ 8E7D474D1128F56600B184C5 /* Default-Landscape.png in Resources */,
+ 8E7D474E1128F56600B184C5 /* Default-Portrait.png in Resources */,
+ 8E7D474F1128F56600B184C5 /* Default.png in Resources */,
+ 8E7D47501128F56600B184C5 /* icon.png in Resources */,
+ 8ED7057D112B3C3000A24321 /* ping1.caf in Resources */,
+ 8ED7057E112B3C3000A24321 /* ping2.caf in Resources */,
+ 8ED7057F112B3C3000A24321 /* ping3.caf in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 1D60588E0D05DD3D006BFB54 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1D60589B0D05DD56006BFB54 /* main.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 1D6058940D05DD3E006BFB54 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = HelloWorld_Prefix.pch;
+ INFOPLIST_FILE = "HelloWorld-Info.plist";
+ OTHER_CFLAGS = "";
+ OTHER_TEST_FLAGS = "";
+ PRODUCT_NAME = HelloWorld;
+ SDKROOT = iphoneos3.2;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 1D6058950D05DD3E006BFB54 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = HelloWorld_Prefix.pch;
+ INFOPLIST_FILE = "HelloWorld-Info.plist";
+ PRODUCT_NAME = HelloWorld;
+ SDKROOT = iphoneos3.2;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ C01FCF4F08A954540054247B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ PREBINDING = NO;
+ SDKROOT = iphoneos3.2;
+ TARGETED_DEVICE_FAMILY = 2;
+ };
+ name = Debug;
+ };
+ C01FCF5008A954540054247B /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
+ PREBINDING = NO;
+ SDKROOT = iphoneos3.2;
+ TARGETED_DEVICE_FAMILY = 2;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "HelloWorld" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 1D6058940D05DD3E006BFB54 /* Debug */,
+ 1D6058950D05DD3E006BFB54 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloWorld" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ C01FCF4F08A954540054247B /* Debug */,
+ C01FCF5008A954540054247B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
+}
View
8 C16-Push/01-PushClientUniversal/HelloWorld_Prefix.pch
@@ -0,0 +1,8 @@
+//
+// Prefix header for all source files of the 'HelloWorld' target in the 'HelloWorld' project
+//
+
+#ifdef __OBJC__
+ #import <Foundation/Foundation.h>
+ #import <UIKit/UIKit.h>
+#endif
View
20 C16-Push/01-PushClientUniversal/TestBed Support/TestBedViewController.h
@@ -0,0 +1,20 @@
+//
+// TestBedViewController.h
+// HelloWorld
+//
+// Created by Erica Sadun on 2/14/10.
+// Copyright 2010 Up To No Good, Inc. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface TestBedViewController : UIViewController
+{
+ IBOutlet UIImageView *imageView;
+ IBOutlet UITextView *textView;
+ IBOutlet UISwitch *badge;
+ IBOutlet UISwitch *alert;
+ IBOutlet UISwitch *sound;
+}
+- (IBAction) switchValueDidChange: (UISwitch *) aSwitch;
+@end
View
706 C16-Push/01-PushClientUniversal/TestBed Support/TestBedViewController.xib
@@ -0,0 +1,706 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
+ <data>
+ <int key="IBDocument.SystemTarget">800</int>
+ <string key="IBDocument.SystemVersion">10C540</string>
+ <string key="IBDocument.InterfaceBuilderVersion">760</string>
+ <string key="IBDocument.AppKitVersion">1038.25</string>
+ <string key="IBDocument.HIToolboxVersion">458.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="NS.object.0">82</string>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="3"/>
+ </object>
+ <object class="NSArray" key="IBDocument.PluginDependencies">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys" id="0">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBProxyObject" id="372490531">
+ <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBProxyObject" id="975951072">
+ <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBUIView" id="921748330">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">292</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBUIImageView" id="817257022">
+ <reference key="NSNextResponder" ref="921748330"/>
+ <int key="NSvFlags">274</int>
+ <string key="NSFrameSize">{320, 416}</string>
+ <reference key="NSSuperview" ref="921748330"/>
+ <object class="NSColor" key="IBUIBackgroundColor" id="224277525">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MCAwAA</bytes>
+ </object>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBUITextView" id="410919840">
+ <reference key="NSNextResponder" ref="921748330"/>
+ <int key="NSvFlags">306</int>
+ <string key="NSFrame">{{0, 81}, {320, 201}}</string>
+ <reference key="NSSuperview" ref="921748330"/>
+ <reference key="IBUIBackgroundColor" ref="224277525"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <bool key="IBUIMultipleTouchEnabled">YES</bool>
+ <int key="IBUITag">11</int>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <bool key="IBUIShowsHorizontalScrollIndicator">NO</bool>
+ <bool key="IBUIDelaysContentTouches">NO</bool>
+ <bool key="IBUICanCancelContentTouches">NO</bool>
+ <bool key="IBUIBouncesZoom">NO</bool>
+ <bool key="IBUIEditable">NO</bool>
+ <string key="IBUIText"/>
+ <object class="NSColor" key="IBUITextColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MCAwIDAAA</bytes>
+ </object>
+ <int key="IBUITextAlignment">1</int>
+ <object class="IBUITextInputTraits" key="IBUITextInputTraits">
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ </object>
+ <object class="IBUISwitch" id="71652634">
+ <reference key="NSNextResponder" ref="921748330"/>
+ <int key="NSvFlags">260</int>
+ <string key="NSFrame">{{11, 36}, {94, 27}}</string>
+ <reference key="NSSuperview" ref="921748330"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <bool key="IBUIMultipleTouchEnabled">YES</bool>
+ <int key="IBUITag">101</int>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <bool key="IBUIOn">YES</bool>
+ </object>
+ <object class="IBUISwitch" id="288400179">
+ <reference key="NSNextResponder" ref="921748330"/>
+ <int key="NSvFlags">261</int>
+ <string key="NSFrame">{{113, 36}, {94, 27}}</string>
+ <reference key="NSSuperview" ref="921748330"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <bool key="IBUIMultipleTouchEnabled">YES</bool>
+ <int key="IBUITag">102</int>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <bool key="IBUIOn">YES</bool>
+ </object>
+ <object class="IBUISwitch" id="1049564661">
+ <reference key="NSNextResponder" ref="921748330"/>
+ <int key="NSvFlags">257</int>
+ <string key="NSFrame">{{215, 36}, {94, 27}}</string>
+ <reference key="NSSuperview" ref="921748330"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <bool key="IBUIMultipleTouchEnabled">YES</bool>
+ <int key="IBUITag">103</int>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <bool key="IBUIOn">YES</bool>
+ </object>
+ <object class="IBUILabel" id="842366241">
+ <reference key="NSNextResponder" ref="921748330"/>
+ <int key="NSvFlags">260</int>
+ <string key="NSFrame">{{33, 10}, {56, 22}}</string>
+ <reference key="NSSuperview" ref="921748330"/>
+ <object class="NSColor" key="IBUIBackgroundColor" id="253874401">
+ <int key="NSColorSpace">2</int>
+ <bytes key="NSRGB">MC4yMTE3NjQ3MjMxIDAgMC41NDUwOTgwNjYzAA</bytes>
+ </object>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <bool key="IBUIUserInteractionEnabled">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <string key="IBUIText">Badge</string>
+ <object class="NSFont" key="IBUIFont" id="1025355288">
+ <string key="NSName">Helvetica-Bold</string>
+ <double key="NSSize">18</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ <object class="NSColor" key="IBUITextColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MSAxIDEAA</bytes>
+ </object>
+ <nil key="IBUIHighlightedColor"/>
+ <int key="IBUIBaselineAdjustment">1</int>
+ <bool key="IBUIAdjustsFontSizeToFit">NO</bool>
+ <float key="IBUIMinimumFontSize">9</float>
+ <int key="IBUITextAlignment">1</int>
+ </object>
+ <object class="IBUILabel" id="668101390">
+ <reference key="NSNextResponder" ref="921748330"/>
+ <int key="NSvFlags">261</int>
+ <string key="NSFrame">{{135, 10}, {50, 22}}</string>
+ <reference key="NSSuperview" ref="921748330"/>
+ <reference key="IBUIBackgroundColor" ref="253874401"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <bool key="IBUIUserInteractionEnabled">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <string key="IBUIText">Alert</string>
+ <reference key="IBUIFont" ref="1025355288"/>
+ <object class="NSColor" key="IBUITextColor" id="1059477681">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ </object>
+ <nil key="IBUIHighlightedColor"/>
+ <int key="IBUIBaselineAdjustment">1</int>
+ <bool key="IBUIAdjustsFontSizeToFit">NO</bool>
+ <float key="IBUIMinimumFontSize">9</float>
+ <int key="IBUITextAlignment">1</int>
+ </object>
+ <object class="IBUILabel" id="631683496">
+ <reference key="NSNextResponder" ref="921748330"/>
+ <int key="NSvFlags">257</int>
+ <string key="NSFrame">{{237, 10}, {56, 22}}</string>
+ <reference key="NSSuperview" ref="921748330"/>
+ <reference key="IBUIBackgroundColor" ref="253874401"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <bool key="IBUIUserInteractionEnabled">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <string key="IBUIText">Sound</string>
+ <reference key="IBUIFont" ref="1025355288"/>
+ <reference key="IBUITextColor" ref="1059477681"/>
+ <nil key="IBUIHighlightedColor"/>
+ <int key="IBUIBaselineAdjustment">1</int>
+ <bool key="IBUIAdjustsFontSizeToFit">NO</bool>
+ <float key="IBUIMinimumFontSize">9</float>
+ <int key="IBUITextAlignment">1</int>
+ </object>
+ </object>
+ <string key="NSFrameSize">{320, 416}</string>
+ <reference key="NSSuperview"/>
+ <reference key="IBUIBackgroundColor" ref="1059477681"/>
+ <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
+ <object class="IBUISimulatedNavigationBarMetrics" key="IBUISimulatedTopBarMetrics">
+ <bool key="IBUIPrompted">NO</bool>
+ </object>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ </object>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <object class="NSMutableArray" key="connectionRecords">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">view</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="921748330"/>
+ </object>
+ <int key="connectionID">4</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">imageView</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="817257022"/>
+ </object>
+ <int key="connectionID">8</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">badge</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="71652634"/>
+ </object>
+ <int key="connectionID">16</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">alert</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="288400179"/>
+ </object>
+ <int key="connectionID">17</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">sound</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="1049564661"/>
+ </object>
+ <int key="connectionID">18</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">textView</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="410919840"/>
+ </object>
+ <int key="connectionID">19</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">switchValueDidChange:</string>
+ <reference key="source" ref="1049564661"/>
+ <reference key="destination" ref="372490531"/>
+ <int key="IBEventType">13</int>
+ </object>
+ <int key="connectionID">20</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">switchValueDidChange:</string>
+ <reference key="source" ref="288400179"/>
+ <reference key="destination" ref="372490531"/>
+ <int key="IBEventType">13</int>
+ </object>
+ <int key="connectionID">21</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">switchValueDidChange:</string>
+ <reference key="source" ref="71652634"/>
+ <reference key="destination" ref="372490531"/>
+ <int key="IBEventType">13</int>
+ </object>
+ <int key="connectionID">22</int>
+ </object>
+ </object>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <object class="NSArray" key="orderedObjects">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <reference key="object" ref="0"/>
+ <reference key="children" ref="1000"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="372490531"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">File's Owner</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="975951072"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">3</int>
+ <reference key="object" ref="921748330"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="817257022"/>
+ <reference ref="71652634"/>
+ <reference ref="288400179"/>
+ <reference ref="1049564661"/>
+ <reference ref="842366241"/>
+ <reference ref="668101390"/>
+ <reference ref="410919840"/>
+ <reference ref="631683496"/>
+ </object>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5</int>
+ <reference key="object" ref="817257022"/>
+ <reference key="parent" ref="921748330"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">9</int>
+ <reference key="object" ref="410919840"/>
+ <reference key="parent" ref="921748330"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">10</int>
+ <reference key="object" ref="71652634"/>
+ <reference key="parent" ref="921748330"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">11</int>
+ <reference key="object" ref="288400179"/>
+ <reference key="parent" ref="921748330"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">12</int>
+ <reference key="object" ref="1049564661"/>
+ <reference key="parent" ref="921748330"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">13</int>
+ <reference key="object" ref="842366241"/>
+ <reference key="parent" ref="921748330"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">14</int>
+ <reference key="object" ref="668101390"/>
+ <reference key="parent" ref="921748330"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">15</int>
+ <reference key="object" ref="631683496"/>
+ <reference key="parent" ref="921748330"/>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="flattenedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>-1.CustomClassName</string>
+ <string>-2.CustomClassName</string>
+ <string>10.IBPluginDependency</string>
+ <string>11.IBPluginDependency</string>
+ <string>12.IBPluginDependency</string>
+ <string>13.IBPluginDependency</string>
+ <string>14.IBPluginDependency</string>
+ <string>15.IBPluginDependency</string>
+ <string>3.IBEditorWindowLastContentRect</string>
+ <string>3.IBPluginDependency</string>
+ <string>5.IBPluginDependency</string>
+ <string>9.IBPluginDependency</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>TestBedViewController</string>
+ <string>UIResponder</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>{{-550, 351}, {320, 480}}</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="unlocalizedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="activeLocalization"/>
+ <object class="NSMutableDictionary" key="localizations">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <nil key="sourceID"/>
+ <int key="maxID">22</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">TestBedViewController</string>
+ <string key="superclassName">UIViewController</string>
+ <object class="NSMutableDictionary" key="actions">
+ <string key="NS.key.0">switchValueDidChange:</string>
+ <string key="NS.object.0">UISwitch</string>
+ </object>
+ <object class="NSMutableDictionary" key="outlets">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>alert</string>
+ <string>badge</string>
+ <string>imageView</string>
+ <string>sound</string>
+ <string>textView</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>UISwitch</string>
+ <string>UISwitch</string>
+ <string>UIImageView</string>
+ <string>UISwitch</string>
+ <string>UITextView</string>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">TestBed Support/TestBedViewController.h</string>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSError.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSNetServices.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSPort.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSStream.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">Foundation.framework/Headers/NSXMLParser.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIAccessibility.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UINibLoading.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier" id="784389593">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIResponder.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIControl</string>
+ <string key="superclassName">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIControl.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIImageView</string>
+ <string key="superclassName">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIImageView.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UILabel</string>
+ <string key="superclassName">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UILabel.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIResponder</string>
+ <string key="superclassName">NSObject</string>
+ <reference key="sourceIdentifier" ref="784389593"/>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIScrollView</string>
+ <string key="superclassName">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIScrollView.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UISearchBar</string>
+ <string key="superclassName">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UISearchBar.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UISearchDisplayController</string>
+ <string key="superclassName">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UISearchDisplayController.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UISwitch</string>
+ <string key="superclassName">UIControl</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UISwitch.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UITextView</string>
+ <string key="superclassName">UIScrollView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UITextView.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UITextField.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIView</string>
+ <string key="superclassName">UIResponder</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIView.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIViewController</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UINavigationController.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIViewController</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIPopoverController.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIViewController</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UISplitViewController.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIViewController</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UITabBarController.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">UIViewController</string>
+ <string key="superclassName">UIResponder</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">UIKit.framework/Headers/UIViewController.h</string>
+ </object>
+ </object>
+ </object>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
+ <integer value="800" key="NS.object.0"/>
+ </object>
+ <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
+ <integer value="3100" key="NS.object.0"/>
+ </object>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <string key="IBDocument.LastKnownRelativeProjectPath">../HelloWorld.xcodeproj</string>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <string key="IBCocoaTouchPluginVersion">82</string>
+ </data>
+</archive>
View
207 C16-Push/01-PushClientUniversal/main.m
@@ -0,0 +1,207 @@
+/*
+ Erica Sadun, http://ericasadun.com
+ iPhone Developer's Cookbook, 3.0 Edition
+ BSD License, Use at your own risk
+ */
+
+#import <UIKit/UIKit.h>
+#import "TestBedViewController.h"
+
+#define COOKBOOK_PURPLE_COLOR [UIColor colorWithRed:0.20392f green:0.19607f blue:0.61176f alpha:1.0f]
+#define BARBUTTON(TITLE, SELECTOR) [[[UIBarButtonItem alloc] initWithTitle:TITLE style:UIBarButtonItemStylePlain target:self action:SELECTOR] autorelease]
+#define TEXTVIEWTAG 1776
+#define TRY_PERFORM(THE_OBJECT, THE_SELECTOR) (([THE_OBJECT respondsToSelector:THE_SELECTOR]) ? [THE_OBJECT performSelector:THE_SELECTOR] : nil)
+#define TRY_PERFORM_WITH_ARG(THE_OBJECT, THE_SELECTOR, THE_ARG) (([THE_OBJECT respondsToSelector:THE_SELECTOR]) ? [THE_OBJECT performSelector:THE_SELECTOR withObject:THE_ARG] : nil)
+#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
+#define IS_PORTRAIT UIDeviceOrientationIsPortrait([[UIDevice currentDevice] orientation])
+#define NAMED_IMAGE(THE_NAME) \
+ ([UIImage imageNamed:[NSString stringWithFormat:@"%@-%@-%@.png", THE_NAME, IS_IPHONE ? @"iphone" : @"ipad", IS_PORTRAIT ? @"portrait" : @"landscape"]] ?: \
+ ([UIImage imageNamed:[NSString stringWithFormat:@"%@-%@.png", THE_NAME, IS_IPHONE ? @"iphone" : @"ipad"]] ?: \
+ ([UIImage imageNamed:[NSString stringWithFormat:@"%@-%@.png", IS_PORTRAIT ? @"portrait" : @"landscape"]] ?: \
+ ([UIImage imageNamed:[NSString stringWithFormat:@"%@.png", THE_NAME]]))))
+
+NSString *pushStatus ()
+{
+ return [[UIApplication sharedApplication] enabledRemoteNotificationTypes] ?
+ @"Notifications were active for this application" :
+ @"Remote notifications were not active for this application";
+}
+
+@implementation TestBedViewController
+// Fetch the current switch settings
+- (NSUInteger) switchSettings
+{
+ NSUInteger which = 0;
+ if ([badge isOn]) which = which | UIRemoteNotificationTypeBadge;
+ if ([alert isOn]) which = which | UIRemoteNotificationTypeAlert;
+ if ([sound isOn]) which = which | UIRemoteNotificationTypeSound;
+ return which;
+}
+
+// Change the switches to match reality
+- (void) updateSwitches
+{
+ NSUInteger rntypes = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
+ [badge setOn:(rntypes & UIRemoteNotificationTypeBadge)];
+ [alert setOn:(rntypes & UIRemoteNotificationTypeAlert)];
+ [sound setOn:(rntypes & UIRemoteNotificationTypeSound)];
+}
+
+#pragma mark Registration and unregistration utilities
+
+// Little hack work-around to catch the end when the confirmation dialog goes away
+- (void) confirmationWasHidden: (NSNotification *) notification
+{
+ [[UIApplication sharedApplication] registerForRemoteNotificationTypes:[self switchSettings]];
+ [self updateSwitches];
+}
+
+// Register application for the services set out by the switches
+- (void) doOn
+{
+ if (![self switchSettings])
+ {
+ textView.text = [NSString stringWithFormat:@"%@\nNothing to register. Skipping.\n(Did you mean to press Unregister instead?)", pushStatus()];
+ [self updateSwitches];
+ return;
+ }
+
+ NSString *status = [NSString stringWithFormat:@"%@\nAttempting registration", pushStatus()];
+ textView.text = status;
+ [[UIApplication sharedApplication] registerForRemoteNotificationTypes:[self switchSettings]];
+}
+
+// Unregister application for all push notifications
+- (void) doOff
+{
+ textView.text = [NSString stringWithFormat:@"%@\nUnregistering.", pushStatus()];
+ [[UIApplication sharedApplication] unregisterForRemoteNotifications];
+ [self updateSwitches];
+}
+
+- (IBAction) switchValueDidChange: (UISwitch *) aSwitch
+{
+ //no op
+}
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
+{
+ return YES;
+}
+
+// Update background art when the device is rotated
+- (void) setBackgroundArt: (id) sender
+{
+ imageView.image = NAMED_IMAGE(@"cover");
+}
+
+- (void) viewDidLoad
+{
+ self.navigationController.navigationBar.tintColor = COOKBOOK_PURPLE_COLOR;
+ self.navigationItem.rightBarButtonItem = BARBUTTON(@"Action", @selector(action:));
+ self.title = @"Push Client";
+ textView.tag = TEXTVIEWTAG;
+
+ // Prepare to update art as the orientation changes
+ imageView.image = NAMED_IMAGE(@"cover");
+ [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setBackgroundArt:) name:@"UIDeviceOrientationDidChangeNotification" object:nil];
+
+ // Set up action switches
+ self.navigationItem.rightBarButtonItem = BARBUTTON(@"Register", @selector(doOn));
+ self.navigationItem.leftBarButtonItem = BARBUTTON(@"Unregister", @selector(doOff));
+ [self updateSwitches];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(confirmationWasHidden:) name:@"UIApplicationDidBecomeActiveNotification" object:nil];
+
+}
+
+-(void) viewDidUnload
+{
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:@"UIDeviceOrientationDidChangeNotification" object:nil];
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:@"UIApplicationDidBecomeActiveNotification" object:nil];
+}
+@end
+
+@interface TestBedAppDelegate : NSObject <UIApplicationDelegate>
+{
+ UIWindow *window;
+ UINavigationController *nav;
+}
+@end
+
+@implementation TestBedAppDelegate
+- (void) showString: (NSString *) aString
+{
+ UITextView *tv = (UITextView *)[[[UIApplication sharedApplication] keyWindow] viewWithTag:TEXTVIEWTAG];
+ tv.text = aString;
+}
+
+// Retrieve the device token
+- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
+{
+ NSUInteger rntypes = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
+ NSString *results = [NSString stringWithFormat:@"Badge: %@, Alert:%@, Sound: %@",
+ (rntypes & UIRemoteNotificationTypeBadge) ? @"Yes" : @"No",
+ (rntypes & UIRemoteNotificationTypeAlert) ? @"Yes" : @"No",
+ (rntypes & UIRemoteNotificationTypeSound) ? @"Yes" : @"No"];
+
+ NSString *status = [NSString stringWithFormat:@"%@\nRegistration succeeded.\n\nDevice Token: %@\n%@", pushStatus(), deviceToken, results];
+ [self showString:status];
+ NSLog(@"deviceToken: %@", deviceToken);
+}
+
+// Provide a user explanation for when the registration fails
+- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
+{
+ NSString *status = [NSString stringWithFormat:@"%@\nRegistration failed.\n\nError: %@", pushStatus(), [error localizedDescription]];
+ [self showString:status];
+ NSLog(@"Error in registration. Error: %@", error);
+}
+
+// Handle an actual notification
+- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
+{
+ NSString *status = [NSString stringWithFormat:@"Notification received:\n%@",[userInfo description]];
+ [self showString:status];
+ CFShow([userInfo description]);
+}
+
+// Report the notification payload when launched by alert
+- (void) launchNotification: (NSNotification *) notification
+{
+ [self performSelector:@selector(showString:) withObject:[[notification userInfo] description] afterDelay:1.0f];
+}
+
+// Does not work reliably at the time of writing.
+/*- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
+ {
+ // [self performSelector:@selector(showString:) withObject:[launchOptions description] afterDelay:2.0f];
+ printf("In launch options\n");
+ CFShow(launchOptions);
+ return YES;
+ }
+ */
+
+- (void)applicationDidFinishLaunching:(UIApplication *)application {
+ window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+ nav = [[UINavigationController alloc] initWithRootViewController:[[[TestBedViewController alloc] init] autorelease]];
+ [window addSubview:nav.view];
+ [window makeKeyAndVisible];
+
+ // Listen for remote notification launches
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(launchNotification:) name:@"UIApplicationDidFinishLaunchingNotification" object:nil];
+}
+
+- (void) dealloc
+{
+ [nav.view removeFromSuperview]; [nav release]; [window release]; [super dealloc];
+}
+@end
+
+int main(int argc, char *argv[])
+{
+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
+ int retVal = UIApplicationMain(argc, argv, nil, @"TestBedAppDelegate");
+ [pool release];
+ return retVal;
+}
Please sign in to comment.
Something went wrong with that request. Please try again.