├── PushDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── mac.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── mac.xcuserdatad │ └── xcschemes │ ├── PushDemo.xcscheme │ └── xcschememanagement.plist ├── PushDemo ├── AppDelegate.h ├── AppDelegate.m ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── Info.plist └── main.m └── PushDemoTests ├── Info.plist └── PushDemoTests.m /PushDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 04A2544F195D423700E37CAD /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 04A2544E195D423700E37CAD /* main.m */; }; 11 | 04A25452195D423700E37CAD /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 04A25451195D423700E37CAD /* AppDelegate.m */; }; 12 | 04A25454195D423700E37CAD /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 04A25453195D423700E37CAD /* Images.xcassets */; }; 13 | 04A25460195D423700E37CAD /* PushDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 04A2545F195D423700E37CAD /* PushDemoTests.m */; }; 14 | /* End PBXBuildFile section */ 15 | 16 | /* Begin PBXContainerItemProxy section */ 17 | 04A2545A195D423700E37CAD /* PBXContainerItemProxy */ = { 18 | isa = PBXContainerItemProxy; 19 | containerPortal = 04A25441195D423700E37CAD /* Project object */; 20 | proxyType = 1; 21 | remoteGlobalIDString = 04A25448195D423700E37CAD; 22 | remoteInfo = PushDemo; 23 | }; 24 | /* End PBXContainerItemProxy section */ 25 | 26 | /* Begin PBXFileReference section */ 27 | 04A25449195D423700E37CAD /* PushDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PushDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | 04A2544D195D423700E37CAD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 29 | 04A2544E195D423700E37CAD /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 30 | 04A25450195D423700E37CAD /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 31 | 04A25451195D423700E37CAD /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 32 | 04A25453195D423700E37CAD /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 33 | 04A25459195D423700E37CAD /* PushDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PushDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | 04A2545E195D423700E37CAD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | 04A2545F195D423700E37CAD /* PushDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PushDemoTests.m; sourceTree = ""; }; 36 | /* End PBXFileReference section */ 37 | 38 | /* Begin PBXFrameworksBuildPhase section */ 39 | 04A25446195D423700E37CAD /* Frameworks */ = { 40 | isa = PBXFrameworksBuildPhase; 41 | buildActionMask = 2147483647; 42 | files = ( 43 | ); 44 | runOnlyForDeploymentPostprocessing = 0; 45 | }; 46 | 04A25456195D423700E37CAD /* Frameworks */ = { 47 | isa = PBXFrameworksBuildPhase; 48 | buildActionMask = 2147483647; 49 | files = ( 50 | ); 51 | runOnlyForDeploymentPostprocessing = 0; 52 | }; 53 | /* End PBXFrameworksBuildPhase section */ 54 | 55 | /* Begin PBXGroup section */ 56 | 04A25440195D423700E37CAD = { 57 | isa = PBXGroup; 58 | children = ( 59 | 04A2544B195D423700E37CAD /* PushDemo */, 60 | 04A2545C195D423700E37CAD /* PushDemoTests */, 61 | 04A2544A195D423700E37CAD /* Products */, 62 | ); 63 | sourceTree = ""; 64 | }; 65 | 04A2544A195D423700E37CAD /* Products */ = { 66 | isa = PBXGroup; 67 | children = ( 68 | 04A25449195D423700E37CAD /* PushDemo.app */, 69 | 04A25459195D423700E37CAD /* PushDemoTests.xctest */, 70 | ); 71 | name = Products; 72 | sourceTree = ""; 73 | }; 74 | 04A2544B195D423700E37CAD /* PushDemo */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | 04A25450195D423700E37CAD /* AppDelegate.h */, 78 | 04A25451195D423700E37CAD /* AppDelegate.m */, 79 | 04A25453195D423700E37CAD /* Images.xcassets */, 80 | 04A2544C195D423700E37CAD /* Supporting Files */, 81 | ); 82 | path = PushDemo; 83 | sourceTree = ""; 84 | }; 85 | 04A2544C195D423700E37CAD /* Supporting Files */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 04A2544D195D423700E37CAD /* Info.plist */, 89 | 04A2544E195D423700E37CAD /* main.m */, 90 | ); 91 | name = "Supporting Files"; 92 | sourceTree = ""; 93 | }; 94 | 04A2545C195D423700E37CAD /* PushDemoTests */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 04A2545F195D423700E37CAD /* PushDemoTests.m */, 98 | 04A2545D195D423700E37CAD /* Supporting Files */, 99 | ); 100 | path = PushDemoTests; 101 | sourceTree = ""; 102 | }; 103 | 04A2545D195D423700E37CAD /* Supporting Files */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | 04A2545E195D423700E37CAD /* Info.plist */, 107 | ); 108 | name = "Supporting Files"; 109 | sourceTree = ""; 110 | }; 111 | /* End PBXGroup section */ 112 | 113 | /* Begin PBXNativeTarget section */ 114 | 04A25448195D423700E37CAD /* PushDemo */ = { 115 | isa = PBXNativeTarget; 116 | buildConfigurationList = 04A25463195D423700E37CAD /* Build configuration list for PBXNativeTarget "PushDemo" */; 117 | buildPhases = ( 118 | 04A25445195D423700E37CAD /* Sources */, 119 | 04A25446195D423700E37CAD /* Frameworks */, 120 | 04A25447195D423700E37CAD /* Resources */, 121 | ); 122 | buildRules = ( 123 | ); 124 | dependencies = ( 125 | ); 126 | name = PushDemo; 127 | productName = PushDemo; 128 | productReference = 04A25449195D423700E37CAD /* PushDemo.app */; 129 | productType = "com.apple.product-type.application"; 130 | }; 131 | 04A25458195D423700E37CAD /* PushDemoTests */ = { 132 | isa = PBXNativeTarget; 133 | buildConfigurationList = 04A25466195D423700E37CAD /* Build configuration list for PBXNativeTarget "PushDemoTests" */; 134 | buildPhases = ( 135 | 04A25455195D423700E37CAD /* Sources */, 136 | 04A25456195D423700E37CAD /* Frameworks */, 137 | 04A25457195D423700E37CAD /* Resources */, 138 | ); 139 | buildRules = ( 140 | ); 141 | dependencies = ( 142 | 04A2545B195D423700E37CAD /* PBXTargetDependency */, 143 | ); 144 | name = PushDemoTests; 145 | productName = PushDemoTests; 146 | productReference = 04A25459195D423700E37CAD /* PushDemoTests.xctest */; 147 | productType = "com.apple.product-type.bundle.unit-test"; 148 | }; 149 | /* End PBXNativeTarget section */ 150 | 151 | /* Begin PBXProject section */ 152 | 04A25441195D423700E37CAD /* Project object */ = { 153 | isa = PBXProject; 154 | attributes = { 155 | LastUpgradeCheck = 0600; 156 | ORGANIZATIONNAME = "于建祥"; 157 | TargetAttributes = { 158 | 04A25448195D423700E37CAD = { 159 | CreatedOnToolsVersion = 6.0; 160 | }; 161 | 04A25458195D423700E37CAD = { 162 | CreatedOnToolsVersion = 6.0; 163 | TestTargetID = 04A25448195D423700E37CAD; 164 | }; 165 | }; 166 | }; 167 | buildConfigurationList = 04A25444195D423700E37CAD /* Build configuration list for PBXProject "PushDemo" */; 168 | compatibilityVersion = "Xcode 3.2"; 169 | developmentRegion = English; 170 | hasScannedForEncodings = 0; 171 | knownRegions = ( 172 | en, 173 | ); 174 | mainGroup = 04A25440195D423700E37CAD; 175 | productRefGroup = 04A2544A195D423700E37CAD /* Products */; 176 | projectDirPath = ""; 177 | projectRoot = ""; 178 | targets = ( 179 | 04A25448195D423700E37CAD /* PushDemo */, 180 | 04A25458195D423700E37CAD /* PushDemoTests */, 181 | ); 182 | }; 183 | /* End PBXProject section */ 184 | 185 | /* Begin PBXResourcesBuildPhase section */ 186 | 04A25447195D423700E37CAD /* Resources */ = { 187 | isa = PBXResourcesBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | 04A25454195D423700E37CAD /* Images.xcassets in Resources */, 191 | ); 192 | runOnlyForDeploymentPostprocessing = 0; 193 | }; 194 | 04A25457195D423700E37CAD /* Resources */ = { 195 | isa = PBXResourcesBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | ); 199 | runOnlyForDeploymentPostprocessing = 0; 200 | }; 201 | /* End PBXResourcesBuildPhase section */ 202 | 203 | /* Begin PBXSourcesBuildPhase section */ 204 | 04A25445195D423700E37CAD /* Sources */ = { 205 | isa = PBXSourcesBuildPhase; 206 | buildActionMask = 2147483647; 207 | files = ( 208 | 04A25452195D423700E37CAD /* AppDelegate.m in Sources */, 209 | 04A2544F195D423700E37CAD /* main.m in Sources */, 210 | ); 211 | runOnlyForDeploymentPostprocessing = 0; 212 | }; 213 | 04A25455195D423700E37CAD /* Sources */ = { 214 | isa = PBXSourcesBuildPhase; 215 | buildActionMask = 2147483647; 216 | files = ( 217 | 04A25460195D423700E37CAD /* PushDemoTests.m in Sources */, 218 | ); 219 | runOnlyForDeploymentPostprocessing = 0; 220 | }; 221 | /* End PBXSourcesBuildPhase section */ 222 | 223 | /* Begin PBXTargetDependency section */ 224 | 04A2545B195D423700E37CAD /* PBXTargetDependency */ = { 225 | isa = PBXTargetDependency; 226 | target = 04A25448195D423700E37CAD /* PushDemo */; 227 | targetProxy = 04A2545A195D423700E37CAD /* PBXContainerItemProxy */; 228 | }; 229 | /* End PBXTargetDependency section */ 230 | 231 | /* Begin XCBuildConfiguration section */ 232 | 04A25461195D423700E37CAD /* Debug */ = { 233 | isa = XCBuildConfiguration; 234 | buildSettings = { 235 | ALWAYS_SEARCH_USER_PATHS = NO; 236 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 237 | CLANG_CXX_LIBRARY = "libc++"; 238 | CLANG_ENABLE_MODULES = YES; 239 | CLANG_ENABLE_OBJC_ARC = YES; 240 | CLANG_WARN_BOOL_CONVERSION = YES; 241 | CLANG_WARN_CONSTANT_CONVERSION = YES; 242 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 243 | CLANG_WARN_EMPTY_BODY = YES; 244 | CLANG_WARN_ENUM_CONVERSION = YES; 245 | CLANG_WARN_INT_CONVERSION = YES; 246 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 247 | CLANG_WARN_UNREACHABLE_CODE = YES; 248 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 249 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 250 | COPY_PHASE_STRIP = NO; 251 | ENABLE_STRICT_OBJC_MSGSEND = YES; 252 | GCC_C_LANGUAGE_STANDARD = gnu99; 253 | GCC_DYNAMIC_NO_PIC = NO; 254 | GCC_OPTIMIZATION_LEVEL = 0; 255 | GCC_PREPROCESSOR_DEFINITIONS = ( 256 | "DEBUG=1", 257 | "$(inherited)", 258 | ); 259 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 260 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 261 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 262 | GCC_WARN_UNDECLARED_SELECTOR = YES; 263 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 264 | GCC_WARN_UNUSED_FUNCTION = YES; 265 | GCC_WARN_UNUSED_VARIABLE = YES; 266 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 267 | METAL_ENABLE_DEBUG_INFO = YES; 268 | ONLY_ACTIVE_ARCH = YES; 269 | SDKROOT = iphoneos; 270 | }; 271 | name = Debug; 272 | }; 273 | 04A25462195D423700E37CAD /* Release */ = { 274 | isa = XCBuildConfiguration; 275 | buildSettings = { 276 | ALWAYS_SEARCH_USER_PATHS = NO; 277 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 278 | CLANG_CXX_LIBRARY = "libc++"; 279 | CLANG_ENABLE_MODULES = YES; 280 | CLANG_ENABLE_OBJC_ARC = YES; 281 | CLANG_WARN_BOOL_CONVERSION = YES; 282 | CLANG_WARN_CONSTANT_CONVERSION = YES; 283 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 284 | CLANG_WARN_EMPTY_BODY = YES; 285 | CLANG_WARN_ENUM_CONVERSION = YES; 286 | CLANG_WARN_INT_CONVERSION = YES; 287 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 288 | CLANG_WARN_UNREACHABLE_CODE = YES; 289 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 290 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 291 | COPY_PHASE_STRIP = YES; 292 | ENABLE_NS_ASSERTIONS = NO; 293 | ENABLE_STRICT_OBJC_MSGSEND = YES; 294 | GCC_C_LANGUAGE_STANDARD = gnu99; 295 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 296 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 297 | GCC_WARN_UNDECLARED_SELECTOR = YES; 298 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 299 | GCC_WARN_UNUSED_FUNCTION = YES; 300 | GCC_WARN_UNUSED_VARIABLE = YES; 301 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 302 | METAL_ENABLE_DEBUG_INFO = NO; 303 | SDKROOT = iphoneos; 304 | VALIDATE_PRODUCT = YES; 305 | }; 306 | name = Release; 307 | }; 308 | 04A25464195D423700E37CAD /* Debug */ = { 309 | isa = XCBuildConfiguration; 310 | buildSettings = { 311 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 312 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 313 | INFOPLIST_FILE = PushDemo/Info.plist; 314 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 315 | PRODUCT_NAME = "$(TARGET_NAME)"; 316 | }; 317 | name = Debug; 318 | }; 319 | 04A25465195D423700E37CAD /* Release */ = { 320 | isa = XCBuildConfiguration; 321 | buildSettings = { 322 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 323 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 324 | INFOPLIST_FILE = PushDemo/Info.plist; 325 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 326 | PRODUCT_NAME = "$(TARGET_NAME)"; 327 | }; 328 | name = Release; 329 | }; 330 | 04A25467195D423700E37CAD /* Debug */ = { 331 | isa = XCBuildConfiguration; 332 | buildSettings = { 333 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/PushDemo.app/PushDemo"; 334 | FRAMEWORK_SEARCH_PATHS = ( 335 | "$(SDKROOT)/Developer/Library/Frameworks", 336 | "$(inherited)", 337 | ); 338 | GCC_PREPROCESSOR_DEFINITIONS = ( 339 | "DEBUG=1", 340 | "$(inherited)", 341 | ); 342 | INFOPLIST_FILE = PushDemoTests/Info.plist; 343 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 344 | METAL_ENABLE_DEBUG_INFO = YES; 345 | PRODUCT_NAME = "$(TARGET_NAME)"; 346 | TEST_HOST = "$(BUNDLE_LOADER)"; 347 | }; 348 | name = Debug; 349 | }; 350 | 04A25468195D423700E37CAD /* Release */ = { 351 | isa = XCBuildConfiguration; 352 | buildSettings = { 353 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/PushDemo.app/PushDemo"; 354 | FRAMEWORK_SEARCH_PATHS = ( 355 | "$(SDKROOT)/Developer/Library/Frameworks", 356 | "$(inherited)", 357 | ); 358 | INFOPLIST_FILE = PushDemoTests/Info.plist; 359 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 360 | METAL_ENABLE_DEBUG_INFO = NO; 361 | PRODUCT_NAME = "$(TARGET_NAME)"; 362 | TEST_HOST = "$(BUNDLE_LOADER)"; 363 | }; 364 | name = Release; 365 | }; 366 | /* End XCBuildConfiguration section */ 367 | 368 | /* Begin XCConfigurationList section */ 369 | 04A25444195D423700E37CAD /* Build configuration list for PBXProject "PushDemo" */ = { 370 | isa = XCConfigurationList; 371 | buildConfigurations = ( 372 | 04A25461195D423700E37CAD /* Debug */, 373 | 04A25462195D423700E37CAD /* Release */, 374 | ); 375 | defaultConfigurationIsVisible = 0; 376 | defaultConfigurationName = Release; 377 | }; 378 | 04A25463195D423700E37CAD /* Build configuration list for PBXNativeTarget "PushDemo" */ = { 379 | isa = XCConfigurationList; 380 | buildConfigurations = ( 381 | 04A25464195D423700E37CAD /* Debug */, 382 | 04A25465195D423700E37CAD /* Release */, 383 | ); 384 | defaultConfigurationIsVisible = 0; 385 | }; 386 | 04A25466195D423700E37CAD /* Build configuration list for PBXNativeTarget "PushDemoTests" */ = { 387 | isa = XCConfigurationList; 388 | buildConfigurations = ( 389 | 04A25467195D423700E37CAD /* Debug */, 390 | 04A25468195D423700E37CAD /* Release */, 391 | ); 392 | defaultConfigurationIsVisible = 0; 393 | }; 394 | /* End XCConfigurationList section */ 395 | }; 396 | rootObject = 04A25441195D423700E37CAD /* Project object */; 397 | } 398 | -------------------------------------------------------------------------------- /PushDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /PushDemo.xcodeproj/project.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ios44first/PushDemo/d9da0539e5e3c683fd7720f3feab895a122595d3/PushDemo.xcodeproj/project.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /PushDemo.xcodeproj/xcuserdata/mac.xcuserdatad/xcschemes/PushDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /PushDemo.xcodeproj/xcuserdata/mac.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | PushDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 04A25448195D423700E37CAD 16 | 17 | primary 18 | 19 | 20 | 04A25458195D423700E37CAD 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /PushDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // PushDemo 4 | // 5 | // Created by mac on 14-6-27. 6 | // Copyright (c) 2014年 于建祥. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /PushDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // PushDemo 4 | // 5 | // Created by mac on 14-6-27. 6 | // Copyright (c) 2014年 于建祥. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 20 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 21 | // Override point for customization after application launch. 22 | self.window.backgroundColor = [UIColor whiteColor]; 23 | [self.window makeKeyAndVisible]; 24 | 25 | 26 | //[[UIApplication sharedApplication] setApplicationIconBadgeNumber:10]; 27 | 28 | //1.创建消息上面要添加的动作(按钮的形式显示出来) 29 | UIMutableUserNotificationAction *action = [[UIMutableUserNotificationAction alloc] init]; 30 | action.identifier = @"action";//按钮的标示 31 | action.title=@"Accept";//按钮的标题 32 | action.activationMode = UIUserNotificationActivationModeForeground;//当点击的时候启动程序 33 | // action.authenticationRequired = YES; 34 | // action.destructive = YES; 35 | 36 | UIMutableUserNotificationAction *action2 = [[UIMutableUserNotificationAction alloc] init]; 37 | action2.identifier = @"action2"; 38 | action2.title=@"Reject"; 39 | action2.activationMode = UIUserNotificationActivationModeBackground;//当点击的时候不启动程序,在后台处理 40 | action.authenticationRequired = YES;//需要解锁才能处理,如果action.activationMode = UIUserNotificationActivationModeForeground;则这个属性被忽略; 41 | action.destructive = YES; 42 | 43 | //2.创建动作(按钮)的类别集合 44 | UIMutableUserNotificationCategory *categorys = [[UIMutableUserNotificationCategory alloc] init]; 45 | categorys.identifier = @"alert";//这组动作的唯一标示 46 | [categorys setActions:@[action,action2] forContext:(UIUserNotificationActionContextMinimal)]; 47 | 48 | //3.创建UIUserNotificationSettings,并设置消息的显示类类型 49 | UIUserNotificationSettings *uns = [UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound) categories:[NSSet setWithObjects:categorys, nil]]; 50 | 51 | //4.注册推送 52 | [[UIApplication sharedApplication] registerForRemoteNotifications]; 53 | [[UIApplication sharedApplication] registerUserNotificationSettings:uns]; 54 | 55 | //5.发起本地推送消息 56 | UILocalNotification *notification = [[UILocalNotification alloc] init]; 57 | notification.fireDate=[NSDate dateWithTimeIntervalSinceNow:5]; 58 | notification.timeZone=[NSTimeZone defaultTimeZone]; 59 | notification.alertBody=@"测试推送的快捷回复"; 60 | notification.category = @"alert"; 61 | [[UIApplication sharedApplication] scheduleLocalNotification:notification]; 62 | 63 | //用这两个方法判断是否注册成功 64 | // NSLog(@"currentUserNotificationSettings = %@",[[UIApplication sharedApplication] currentUserNotificationSettings]); 65 | //[[UIApplication sharedApplication] isRegisteredForRemoteNotifications]; 66 | 67 | 68 | return YES; 69 | } 70 | 71 | //本地推送通知 72 | -(void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings 73 | { 74 | //成功注册registerUserNotificationSettings:后,回调的方法 75 | NSLog(@"%@",notificationSettings); 76 | } 77 | 78 | -(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification 79 | { 80 | //收到本地推送消息后调用的方法 81 | NSLog(@"%@",notification); 82 | } 83 | 84 | -(void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forLocalNotification:(UILocalNotification *)notification completionHandler:(void (^)())completionHandler 85 | { 86 | //在非本App界面时收到本地消息,下拉消息会有快捷回复的按钮,点击按钮后调用的方法,根据identifier来判断点击的哪个按钮,notification为消息内容 87 | NSLog(@"%@----%@",identifier,notification); 88 | 89 | completionHandler();//处理完消息,最后一定要调用这个代码块 90 | 91 | } 92 | 93 | //远程推送通知 94 | -(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken 95 | { 96 | //向APNS注册成功,收到返回的deviceToken 97 | } 98 | 99 | -(void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error 100 | { 101 | //向APNS注册失败,返回错误信息error 102 | } 103 | 104 | -(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo 105 | { 106 | //收到远程推送通知消息 107 | } 108 | 109 | -(void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)())completionHandler 110 | { 111 | //在没有启动本App时,收到服务器推送消息,下拉消息会有快捷回复的按钮,点击按钮后调用的方法,根据identifier来判断点击的哪个按钮 112 | } 113 | 114 | 115 | 116 | 117 | 118 | 119 | - (void)applicationWillResignActive:(UIApplication *)application { 120 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 121 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 122 | } 123 | 124 | - (void)applicationDidEnterBackground:(UIApplication *)application { 125 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 126 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 127 | } 128 | 129 | - (void)applicationWillEnterForeground:(UIApplication *)application { 130 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 131 | } 132 | 133 | - (void)applicationDidBecomeActive:(UIApplication *)application { 134 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 135 | } 136 | 137 | - (void)applicationWillTerminate:(UIApplication *)application { 138 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 139 | } 140 | 141 | @end 142 | -------------------------------------------------------------------------------- /PushDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /PushDemo/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /PushDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.sohu.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /PushDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // PushDemo 4 | // 5 | // Created by mac on 14-6-27. 6 | // Copyright (c) 2014年 于建祥. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /PushDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.sohu.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /PushDemoTests/PushDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // PushDemoTests.m 3 | // PushDemoTests 4 | // 5 | // Created by mac on 14-6-27. 6 | // Copyright (c) 2014年 于建祥. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PushDemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation PushDemoTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | XCTAssert(YES, @"Pass"); 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | --------------------------------------------------------------------------------