├── NotiContentExtension
├── Base.lproj
│ └── MainInterface.storyboard
├── Info.plist
├── NotificationViewController.h
└── NotificationViewController.m
├── README.md
├── XZPushTest.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
└── xcuserdata
│ └── coderxu.xcuserdatad
│ ├── xcdebugger
│ └── Breakpoints_v2.xcbkptlist
│ └── xcschemes
│ ├── NotiContentExtension.xcscheme
│ ├── XZPushTest.xcscheme
│ ├── mytest.xcscheme
│ └── xcschememanagement.plist
├── XZPushTest
├── AppDelegate.h
├── AppDelegate.m
├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
├── Info.plist
├── ViewController.h
├── ViewController.m
├── XZPushTest.entitlements
├── flv视频测试用例1.mp4
├── icon_certification_status1@2x.png
├── image01.jpg
├── main.m
└── test1.gif
├── XZPushTestTests
├── Info.plist
└── XZPushTestTests.m
├── XZPushTestUITests
├── Info.plist
└── XZPushTestUITests.m
└── mytest
├── Info.plist
├── NotificationService.h
└── NotificationService.m
/NotiContentExtension/Base.lproj/MainInterface.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/NotiContentExtension/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | NotiContentExtension
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | XPC!
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleVersion
22 | 1
23 | NSExtension
24 |
25 | NSExtensionAttributes
26 |
27 | UNNotificationExtensionCategory
28 |
29 | category1
30 | category2
31 | category3
32 |
33 | UNNotificationExtensionInitialContentSizeRatio
34 | 1
35 |
36 | NSExtensionMainStoryboard
37 | MainInterface
38 | NSExtensionPointIdentifier
39 | com.apple.usernotifications.content-extension
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/NotiContentExtension/NotificationViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // NotificationViewController.h
3 | // NotiContentExtension
4 | //
5 | // Created by coderXu on 16/10/13.
6 | // Copyright © 2016年 coderXu. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NotificationViewController : UIViewController
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/NotiContentExtension/NotificationViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // NotificationViewController.m
3 | // NotiContentExtension
4 | //
5 | // Created by coderXu on 16/10/13.
6 | // Copyright © 2016年 coderXu. All rights reserved.
7 | //
8 |
9 | #import "NotificationViewController.h"
10 | #import
11 | #import
12 |
13 | @interface NotificationViewController ()
14 |
15 | @property IBOutlet UILabel *label;
16 |
17 | @end
18 |
19 | @implementation NotificationViewController
20 |
21 | - (void)viewDidLoad {
22 | [super viewDidLoad];
23 |
24 |
25 |
26 | }
27 |
28 | - (void)didReceiveNotification:(UNNotification *)notification {
29 |
30 |
31 |
32 | NSDictionary *dict = notification.request.content.userInfo;
33 | // 这里可以把打印的所有东西拿出来
34 | NSLog(@"%@",dict);
35 |
36 | /****************************打印的信息是************
37 | aps = {
38 | alert = "This is some fancy message.";
39 | badge = 1;
40 | from = "大家好,我是徐不同";
41 | imageAbsoluteString = "http://upload.univs.cn/2012/0104/1325645511371.jpg";
42 | "mutable-content" = 1;
43 | sound = default;
44 | };
45 | }
46 | *******************************************/
47 |
48 |
49 | }
50 |
51 |
52 | //- (void)didReceiveNotificationResponse:(UNNotificationResponse *)response completionHandler:(void (^)(UNNotificationContentExtensionResponseOption option))completion{
53 | //
54 | // if ([response isKindOfClass:[UNTextInputNotificationResponse class]]) {
55 | //
56 | // NSString* userSayStr = [(UNTextInputNotificationResponse *)response userText];
57 | // NSLog(@"%@",userSayStr);
58 | //
59 | // }
60 | //
61 | //}
62 |
63 |
64 |
65 | - (UNNotificationContentExtensionMediaPlayPauseButtonType)mediaPlayPauseButtonType
66 | {
67 | return UNNotificationContentExtensionMediaPlayPauseButtonTypeDefault;
68 | }
69 |
70 | - (CGRect)mediaPlayPauseButtonFrame
71 | {
72 | return CGRectMake(100, 100, 100, 100);
73 | }
74 |
75 | - (UIColor *)mediaPlayPauseButtonTintColor{
76 | return [UIColor blueColor];
77 | }
78 |
79 | - (void)mediaPlay{
80 | NSLog(@"mediaPlay,开始播放");
81 |
82 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
83 | [self.extensionContext mediaPlayingPaused];
84 | });
85 |
86 |
87 | }
88 | - (void)mediaPause{
89 | NSLog(@"mediaPause,暂停播放");
90 |
91 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(10.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
92 | [self.extensionContext mediaPlayingStarted];
93 | });
94 |
95 |
96 | }
97 |
98 |
99 | - (void)mediaPlayingStarted{
100 | NSLog(@"主动调用开始的方法");
101 | }
102 | - (void)mediaPlayingPaused
103 | {
104 | NSLog(@"主动调用暂停的方法");
105 |
106 | }
107 |
108 |
109 |
110 |
111 | //@property (nonatomic, readonly, assign) UNNotificationContentExtensionMediaPlayPauseButtonType mediaPlayPauseButtonType;
112 | //
113 | //// Implementing this method and returning a non-empty frame will make
114 | //// the notification draw a button that allows the user to play and pause
115 | //// media content embedded in the notification.
116 | //@property (nonatomic, readonly, assign) CGRect mediaPlayPauseButtonFrame;
117 | //
118 | //// The tint color to use for the button.
119 | //@property (nonatomic, readonly, copy) UIColor *mediaPlayPauseButtonTintColor;
120 | //
121 | //// Called when the user taps the play or pause button.
122 | //- (void)mediaPlay;
123 | //- (void)mediaPause;
124 |
125 |
126 |
127 |
128 | @end
129 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # XZPushTest
2 | 大家好,我是徐不同
3 |
4 | 这是我写的一个iOS10的推送demo,其中包含了本地通知以及远程推送的一些例子。
5 |
6 | 具体使用以及相关代码的说明,可以查看我的简书。
7 |
8 | 后续我会补充更多的demo供大家参考~
9 |
10 | [徐不同简书主页](http://www.jianshu.com/users/2446e9195d21/latest_articles)
11 |
12 | [iOS开发 iOS10推送必看(基础篇)](http://www.jianshu.com/p/f5337e8f336d)
13 |
14 | [iOS开发 iOS10推送必看(高阶1)](http://www.jianshu.com/p/3d602a60ca4f)
15 |
16 | [iOS开发 iOS10推送必看(高阶2)](http://www.jianshu.com/p/f77d070a8812)
17 |
18 |
19 | [iOS开发 适配iOS10以及Xcode8](http://www.jianshu.com/p/9756992a35ca)
20 |
21 | [iOS开发 支持https请求以及https请求的抓包](http://www.jianshu.com/p/97745be81d64)
22 |
23 | 绝对原创,如果你喜欢我,可以关注我,谢谢
24 |
--------------------------------------------------------------------------------
/XZPushTest.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | F72E8A751D8E8A6500B99CC7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = F72E8A741D8E8A6500B99CC7 /* main.m */; };
11 | F72E8A781D8E8A6500B99CC7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = F72E8A771D8E8A6500B99CC7 /* AppDelegate.m */; };
12 | F72E8A7B1D8E8A6500B99CC7 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F72E8A7A1D8E8A6500B99CC7 /* ViewController.m */; };
13 | F72E8A7E1D8E8A6500B99CC7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F72E8A7C1D8E8A6500B99CC7 /* Main.storyboard */; };
14 | F72E8A801D8E8A6500B99CC7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F72E8A7F1D8E8A6500B99CC7 /* Assets.xcassets */; };
15 | F72E8A831D8E8A6500B99CC7 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F72E8A811D8E8A6500B99CC7 /* LaunchScreen.storyboard */; };
16 | F72E8A8E1D8E8A6500B99CC7 /* XZPushTestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F72E8A8D1D8E8A6500B99CC7 /* XZPushTestTests.m */; };
17 | F72E8A991D8E8A6500B99CC7 /* XZPushTestUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = F72E8A981D8E8A6500B99CC7 /* XZPushTestUITests.m */; };
18 | F72E8AA81D8EABAB00B99CC7 /* icon_certification_status1@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F72E8AA71D8EABAB00B99CC7 /* icon_certification_status1@2x.png */; };
19 | F73D3FF21DAF614C00FA9237 /* UserNotifications.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F761674C1D94D57500936B14 /* UserNotifications.framework */; };
20 | F73D3FF31DAF614C00FA9237 /* UserNotificationsUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F761674E1D94D57500936B14 /* UserNotificationsUI.framework */; };
21 | F73D3FF71DAF614C00FA9237 /* NotificationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F73D3FF61DAF614C00FA9237 /* NotificationViewController.m */; };
22 | F73D3FFA1DAF614C00FA9237 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F73D3FF81DAF614C00FA9237 /* MainInterface.storyboard */; };
23 | F73D3FFE1DAF614C00FA9237 /* NotiContentExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = F73D3FF11DAF614C00FA9237 /* NotiContentExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
24 | F78AC8841D9012E500E7AA87 /* flv视频测试用例1.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = F78AC8831D9012E500E7AA87 /* flv视频测试用例1.mp4 */; };
25 | F79D576F1D938A37003732D5 /* NotificationService.m in Sources */ = {isa = PBXBuildFile; fileRef = F79D576E1D938A37003732D5 /* NotificationService.m */; };
26 | F79D57731D938A37003732D5 /* mytest.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = F79D576B1D938A37003732D5 /* mytest.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
27 | F7DADFF61D8FC3EC00A449E2 /* test1.gif in Resources */ = {isa = PBXBuildFile; fileRef = F7DADFF51D8FC3EC00A449E2 /* test1.gif */; };
28 | F7DAE0001D8FEF2C00A449E2 /* image01.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F7DADFFF1D8FEF2C00A449E2 /* image01.jpg */; };
29 | /* End PBXBuildFile section */
30 |
31 | /* Begin PBXContainerItemProxy section */
32 | F72E8A8A1D8E8A6500B99CC7 /* PBXContainerItemProxy */ = {
33 | isa = PBXContainerItemProxy;
34 | containerPortal = F72E8A681D8E8A6500B99CC7 /* Project object */;
35 | proxyType = 1;
36 | remoteGlobalIDString = F72E8A6F1D8E8A6500B99CC7;
37 | remoteInfo = XZPushTest;
38 | };
39 | F72E8A951D8E8A6500B99CC7 /* PBXContainerItemProxy */ = {
40 | isa = PBXContainerItemProxy;
41 | containerPortal = F72E8A681D8E8A6500B99CC7 /* Project object */;
42 | proxyType = 1;
43 | remoteGlobalIDString = F72E8A6F1D8E8A6500B99CC7;
44 | remoteInfo = XZPushTest;
45 | };
46 | F73D3FFC1DAF614C00FA9237 /* PBXContainerItemProxy */ = {
47 | isa = PBXContainerItemProxy;
48 | containerPortal = F72E8A681D8E8A6500B99CC7 /* Project object */;
49 | proxyType = 1;
50 | remoteGlobalIDString = F73D3FF01DAF614C00FA9237;
51 | remoteInfo = NotiContentExtension;
52 | };
53 | F79D57711D938A37003732D5 /* PBXContainerItemProxy */ = {
54 | isa = PBXContainerItemProxy;
55 | containerPortal = F72E8A681D8E8A6500B99CC7 /* Project object */;
56 | proxyType = 1;
57 | remoteGlobalIDString = F79D576A1D938A37003732D5;
58 | remoteInfo = mytest;
59 | };
60 | /* End PBXContainerItemProxy section */
61 |
62 | /* Begin PBXCopyFilesBuildPhase section */
63 | F79D57661D9384AA003732D5 /* Embed App Extensions */ = {
64 | isa = PBXCopyFilesBuildPhase;
65 | buildActionMask = 12;
66 | dstPath = "";
67 | dstSubfolderSpec = 13;
68 | files = (
69 | F73D3FFE1DAF614C00FA9237 /* NotiContentExtension.appex in Embed App Extensions */,
70 | F79D57731D938A37003732D5 /* mytest.appex in Embed App Extensions */,
71 | );
72 | name = "Embed App Extensions";
73 | runOnlyForDeploymentPostprocessing = 0;
74 | };
75 | /* End PBXCopyFilesBuildPhase section */
76 |
77 | /* Begin PBXFileReference section */
78 | F72E8A701D8E8A6500B99CC7 /* XZPushTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = XZPushTest.app; sourceTree = BUILT_PRODUCTS_DIR; };
79 | F72E8A741D8E8A6500B99CC7 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
80 | F72E8A761D8E8A6500B99CC7 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
81 | F72E8A771D8E8A6500B99CC7 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
82 | F72E8A791D8E8A6500B99CC7 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; };
83 | F72E8A7A1D8E8A6500B99CC7 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; };
84 | F72E8A7D1D8E8A6500B99CC7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
85 | F72E8A7F1D8E8A6500B99CC7 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
86 | F72E8A821D8E8A6500B99CC7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
87 | F72E8A841D8E8A6500B99CC7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
88 | F72E8A891D8E8A6500B99CC7 /* XZPushTestTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = XZPushTestTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
89 | F72E8A8D1D8E8A6500B99CC7 /* XZPushTestTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XZPushTestTests.m; sourceTree = ""; };
90 | F72E8A8F1D8E8A6500B99CC7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
91 | F72E8A941D8E8A6500B99CC7 /* XZPushTestUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = XZPushTestUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
92 | F72E8A981D8E8A6500B99CC7 /* XZPushTestUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XZPushTestUITests.m; sourceTree = ""; };
93 | F72E8A9A1D8E8A6500B99CC7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
94 | F72E8AA61D8E8CA300B99CC7 /* XZPushTest.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = XZPushTest.entitlements; sourceTree = ""; };
95 | F72E8AA71D8EABAB00B99CC7 /* icon_certification_status1@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_certification_status1@2x.png"; sourceTree = ""; };
96 | F73D3FF11DAF614C00FA9237 /* NotiContentExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = NotiContentExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
97 | F73D3FF51DAF614C00FA9237 /* NotificationViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NotificationViewController.h; sourceTree = ""; };
98 | F73D3FF61DAF614C00FA9237 /* NotificationViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NotificationViewController.m; sourceTree = ""; };
99 | F73D3FF91DAF614C00FA9237 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = ""; };
100 | F73D3FFB1DAF614C00FA9237 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
101 | F761674C1D94D57500936B14 /* UserNotifications.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UserNotifications.framework; path = System/Library/Frameworks/UserNotifications.framework; sourceTree = SDKROOT; };
102 | F761674E1D94D57500936B14 /* UserNotificationsUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UserNotificationsUI.framework; path = System/Library/Frameworks/UserNotificationsUI.framework; sourceTree = SDKROOT; };
103 | F78AC8831D9012E500E7AA87 /* flv视频测试用例1.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = "flv视频测试用例1.mp4"; sourceTree = ""; };
104 | F79D576B1D938A37003732D5 /* mytest.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = mytest.appex; sourceTree = BUILT_PRODUCTS_DIR; };
105 | F79D576D1D938A37003732D5 /* NotificationService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NotificationService.h; sourceTree = ""; };
106 | F79D576E1D938A37003732D5 /* NotificationService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NotificationService.m; sourceTree = ""; };
107 | F79D57701D938A37003732D5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
108 | F7DADFF51D8FC3EC00A449E2 /* test1.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = test1.gif; sourceTree = ""; };
109 | F7DADFFF1D8FEF2C00A449E2 /* image01.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = image01.jpg; sourceTree = ""; };
110 | /* End PBXFileReference section */
111 |
112 | /* Begin PBXFrameworksBuildPhase section */
113 | F72E8A6D1D8E8A6500B99CC7 /* Frameworks */ = {
114 | isa = PBXFrameworksBuildPhase;
115 | buildActionMask = 2147483647;
116 | files = (
117 | );
118 | runOnlyForDeploymentPostprocessing = 0;
119 | };
120 | F72E8A861D8E8A6500B99CC7 /* Frameworks */ = {
121 | isa = PBXFrameworksBuildPhase;
122 | buildActionMask = 2147483647;
123 | files = (
124 | );
125 | runOnlyForDeploymentPostprocessing = 0;
126 | };
127 | F72E8A911D8E8A6500B99CC7 /* Frameworks */ = {
128 | isa = PBXFrameworksBuildPhase;
129 | buildActionMask = 2147483647;
130 | files = (
131 | );
132 | runOnlyForDeploymentPostprocessing = 0;
133 | };
134 | F73D3FEE1DAF614C00FA9237 /* Frameworks */ = {
135 | isa = PBXFrameworksBuildPhase;
136 | buildActionMask = 2147483647;
137 | files = (
138 | F73D3FF31DAF614C00FA9237 /* UserNotificationsUI.framework in Frameworks */,
139 | F73D3FF21DAF614C00FA9237 /* UserNotifications.framework in Frameworks */,
140 | );
141 | runOnlyForDeploymentPostprocessing = 0;
142 | };
143 | F79D57681D938A37003732D5 /* Frameworks */ = {
144 | isa = PBXFrameworksBuildPhase;
145 | buildActionMask = 2147483647;
146 | files = (
147 | );
148 | runOnlyForDeploymentPostprocessing = 0;
149 | };
150 | /* End PBXFrameworksBuildPhase section */
151 |
152 | /* Begin PBXGroup section */
153 | F72E8A671D8E8A6500B99CC7 = {
154 | isa = PBXGroup;
155 | children = (
156 | F72E8A721D8E8A6500B99CC7 /* XZPushTest */,
157 | F79D576C1D938A37003732D5 /* mytest */,
158 | F73D3FF41DAF614C00FA9237 /* NotiContentExtension */,
159 | F72E8A8C1D8E8A6500B99CC7 /* XZPushTestTests */,
160 | F72E8A971D8E8A6500B99CC7 /* XZPushTestUITests */,
161 | F761674B1D94D57500936B14 /* Frameworks */,
162 | F72E8A711D8E8A6500B99CC7 /* Products */,
163 | );
164 | sourceTree = "";
165 | };
166 | F72E8A711D8E8A6500B99CC7 /* Products */ = {
167 | isa = PBXGroup;
168 | children = (
169 | F72E8A701D8E8A6500B99CC7 /* XZPushTest.app */,
170 | F72E8A891D8E8A6500B99CC7 /* XZPushTestTests.xctest */,
171 | F72E8A941D8E8A6500B99CC7 /* XZPushTestUITests.xctest */,
172 | F79D576B1D938A37003732D5 /* mytest.appex */,
173 | F73D3FF11DAF614C00FA9237 /* NotiContentExtension.appex */,
174 | );
175 | name = Products;
176 | sourceTree = "";
177 | };
178 | F72E8A721D8E8A6500B99CC7 /* XZPushTest */ = {
179 | isa = PBXGroup;
180 | children = (
181 | F72E8AA61D8E8CA300B99CC7 /* XZPushTest.entitlements */,
182 | F72E8AA71D8EABAB00B99CC7 /* icon_certification_status1@2x.png */,
183 | F7DADFF51D8FC3EC00A449E2 /* test1.gif */,
184 | F7DADFFF1D8FEF2C00A449E2 /* image01.jpg */,
185 | F78AC8831D9012E500E7AA87 /* flv视频测试用例1.mp4 */,
186 | F72E8A761D8E8A6500B99CC7 /* AppDelegate.h */,
187 | F72E8A771D8E8A6500B99CC7 /* AppDelegate.m */,
188 | F72E8A791D8E8A6500B99CC7 /* ViewController.h */,
189 | F72E8A7A1D8E8A6500B99CC7 /* ViewController.m */,
190 | F72E8A7C1D8E8A6500B99CC7 /* Main.storyboard */,
191 | F72E8A7F1D8E8A6500B99CC7 /* Assets.xcassets */,
192 | F72E8A811D8E8A6500B99CC7 /* LaunchScreen.storyboard */,
193 | F72E8A841D8E8A6500B99CC7 /* Info.plist */,
194 | F72E8A731D8E8A6500B99CC7 /* Supporting Files */,
195 | );
196 | path = XZPushTest;
197 | sourceTree = "";
198 | };
199 | F72E8A731D8E8A6500B99CC7 /* Supporting Files */ = {
200 | isa = PBXGroup;
201 | children = (
202 | F72E8A741D8E8A6500B99CC7 /* main.m */,
203 | );
204 | name = "Supporting Files";
205 | sourceTree = "";
206 | };
207 | F72E8A8C1D8E8A6500B99CC7 /* XZPushTestTests */ = {
208 | isa = PBXGroup;
209 | children = (
210 | F72E8A8D1D8E8A6500B99CC7 /* XZPushTestTests.m */,
211 | F72E8A8F1D8E8A6500B99CC7 /* Info.plist */,
212 | );
213 | path = XZPushTestTests;
214 | sourceTree = "";
215 | };
216 | F72E8A971D8E8A6500B99CC7 /* XZPushTestUITests */ = {
217 | isa = PBXGroup;
218 | children = (
219 | F72E8A981D8E8A6500B99CC7 /* XZPushTestUITests.m */,
220 | F72E8A9A1D8E8A6500B99CC7 /* Info.plist */,
221 | );
222 | path = XZPushTestUITests;
223 | sourceTree = "";
224 | };
225 | F73D3FF41DAF614C00FA9237 /* NotiContentExtension */ = {
226 | isa = PBXGroup;
227 | children = (
228 | F73D3FF51DAF614C00FA9237 /* NotificationViewController.h */,
229 | F73D3FF61DAF614C00FA9237 /* NotificationViewController.m */,
230 | F73D3FF81DAF614C00FA9237 /* MainInterface.storyboard */,
231 | F73D3FFB1DAF614C00FA9237 /* Info.plist */,
232 | );
233 | path = NotiContentExtension;
234 | sourceTree = "";
235 | };
236 | F761674B1D94D57500936B14 /* Frameworks */ = {
237 | isa = PBXGroup;
238 | children = (
239 | F761674C1D94D57500936B14 /* UserNotifications.framework */,
240 | F761674E1D94D57500936B14 /* UserNotificationsUI.framework */,
241 | );
242 | name = Frameworks;
243 | sourceTree = "";
244 | };
245 | F79D576C1D938A37003732D5 /* mytest */ = {
246 | isa = PBXGroup;
247 | children = (
248 | F79D576D1D938A37003732D5 /* NotificationService.h */,
249 | F79D576E1D938A37003732D5 /* NotificationService.m */,
250 | F79D57701D938A37003732D5 /* Info.plist */,
251 | );
252 | path = mytest;
253 | sourceTree = "";
254 | };
255 | /* End PBXGroup section */
256 |
257 | /* Begin PBXNativeTarget section */
258 | F72E8A6F1D8E8A6500B99CC7 /* XZPushTest */ = {
259 | isa = PBXNativeTarget;
260 | buildConfigurationList = F72E8A9D1D8E8A6500B99CC7 /* Build configuration list for PBXNativeTarget "XZPushTest" */;
261 | buildPhases = (
262 | F72E8A6C1D8E8A6500B99CC7 /* Sources */,
263 | F72E8A6D1D8E8A6500B99CC7 /* Frameworks */,
264 | F72E8A6E1D8E8A6500B99CC7 /* Resources */,
265 | F79D57661D9384AA003732D5 /* Embed App Extensions */,
266 | );
267 | buildRules = (
268 | );
269 | dependencies = (
270 | F79D57721D938A37003732D5 /* PBXTargetDependency */,
271 | F73D3FFD1DAF614C00FA9237 /* PBXTargetDependency */,
272 | );
273 | name = XZPushTest;
274 | productName = XZPushTest;
275 | productReference = F72E8A701D8E8A6500B99CC7 /* XZPushTest.app */;
276 | productType = "com.apple.product-type.application";
277 | };
278 | F72E8A881D8E8A6500B99CC7 /* XZPushTestTests */ = {
279 | isa = PBXNativeTarget;
280 | buildConfigurationList = F72E8AA01D8E8A6500B99CC7 /* Build configuration list for PBXNativeTarget "XZPushTestTests" */;
281 | buildPhases = (
282 | F72E8A851D8E8A6500B99CC7 /* Sources */,
283 | F72E8A861D8E8A6500B99CC7 /* Frameworks */,
284 | F72E8A871D8E8A6500B99CC7 /* Resources */,
285 | );
286 | buildRules = (
287 | );
288 | dependencies = (
289 | F72E8A8B1D8E8A6500B99CC7 /* PBXTargetDependency */,
290 | );
291 | name = XZPushTestTests;
292 | productName = XZPushTestTests;
293 | productReference = F72E8A891D8E8A6500B99CC7 /* XZPushTestTests.xctest */;
294 | productType = "com.apple.product-type.bundle.unit-test";
295 | };
296 | F72E8A931D8E8A6500B99CC7 /* XZPushTestUITests */ = {
297 | isa = PBXNativeTarget;
298 | buildConfigurationList = F72E8AA31D8E8A6500B99CC7 /* Build configuration list for PBXNativeTarget "XZPushTestUITests" */;
299 | buildPhases = (
300 | F72E8A901D8E8A6500B99CC7 /* Sources */,
301 | F72E8A911D8E8A6500B99CC7 /* Frameworks */,
302 | F72E8A921D8E8A6500B99CC7 /* Resources */,
303 | );
304 | buildRules = (
305 | );
306 | dependencies = (
307 | F72E8A961D8E8A6500B99CC7 /* PBXTargetDependency */,
308 | );
309 | name = XZPushTestUITests;
310 | productName = XZPushTestUITests;
311 | productReference = F72E8A941D8E8A6500B99CC7 /* XZPushTestUITests.xctest */;
312 | productType = "com.apple.product-type.bundle.ui-testing";
313 | };
314 | F73D3FF01DAF614C00FA9237 /* NotiContentExtension */ = {
315 | isa = PBXNativeTarget;
316 | buildConfigurationList = F73D40011DAF614C00FA9237 /* Build configuration list for PBXNativeTarget "NotiContentExtension" */;
317 | buildPhases = (
318 | F73D3FED1DAF614C00FA9237 /* Sources */,
319 | F73D3FEE1DAF614C00FA9237 /* Frameworks */,
320 | F73D3FEF1DAF614C00FA9237 /* Resources */,
321 | );
322 | buildRules = (
323 | );
324 | dependencies = (
325 | );
326 | name = NotiContentExtension;
327 | productName = NotiContentExtension;
328 | productReference = F73D3FF11DAF614C00FA9237 /* NotiContentExtension.appex */;
329 | productType = "com.apple.product-type.app-extension";
330 | };
331 | F79D576A1D938A37003732D5 /* mytest */ = {
332 | isa = PBXNativeTarget;
333 | buildConfigurationList = F79D57741D938A37003732D5 /* Build configuration list for PBXNativeTarget "mytest" */;
334 | buildPhases = (
335 | F79D57671D938A37003732D5 /* Sources */,
336 | F79D57681D938A37003732D5 /* Frameworks */,
337 | F79D57691D938A37003732D5 /* Resources */,
338 | );
339 | buildRules = (
340 | );
341 | dependencies = (
342 | );
343 | name = mytest;
344 | productName = mytest;
345 | productReference = F79D576B1D938A37003732D5 /* mytest.appex */;
346 | productType = "com.apple.product-type.app-extension";
347 | };
348 | /* End PBXNativeTarget section */
349 |
350 | /* Begin PBXProject section */
351 | F72E8A681D8E8A6500B99CC7 /* Project object */ = {
352 | isa = PBXProject;
353 | attributes = {
354 | LastUpgradeCheck = 0800;
355 | ORGANIZATIONNAME = coderXu;
356 | TargetAttributes = {
357 | F72E8A6F1D8E8A6500B99CC7 = {
358 | CreatedOnToolsVersion = 8.0;
359 | DevelopmentTeam = 2S9EXUX8CH;
360 | ProvisioningStyle = Automatic;
361 | SystemCapabilities = {
362 | com.apple.BackgroundModes = {
363 | enabled = 1;
364 | };
365 | com.apple.Push = {
366 | enabled = 1;
367 | };
368 | };
369 | };
370 | F72E8A881D8E8A6500B99CC7 = {
371 | CreatedOnToolsVersion = 8.0;
372 | DevelopmentTeam = 2S9EXUX8CH;
373 | ProvisioningStyle = Automatic;
374 | TestTargetID = F72E8A6F1D8E8A6500B99CC7;
375 | };
376 | F72E8A931D8E8A6500B99CC7 = {
377 | CreatedOnToolsVersion = 8.0;
378 | DevelopmentTeam = 2S9EXUX8CH;
379 | ProvisioningStyle = Automatic;
380 | TestTargetID = F72E8A6F1D8E8A6500B99CC7;
381 | };
382 | F73D3FF01DAF614C00FA9237 = {
383 | CreatedOnToolsVersion = 8.0;
384 | DevelopmentTeam = 2S9EXUX8CH;
385 | ProvisioningStyle = Automatic;
386 | };
387 | F79D576A1D938A37003732D5 = {
388 | CreatedOnToolsVersion = 8.0;
389 | DevelopmentTeam = 2S9EXUX8CH;
390 | ProvisioningStyle = Automatic;
391 | };
392 | };
393 | };
394 | buildConfigurationList = F72E8A6B1D8E8A6500B99CC7 /* Build configuration list for PBXProject "XZPushTest" */;
395 | compatibilityVersion = "Xcode 3.2";
396 | developmentRegion = English;
397 | hasScannedForEncodings = 0;
398 | knownRegions = (
399 | en,
400 | Base,
401 | );
402 | mainGroup = F72E8A671D8E8A6500B99CC7;
403 | productRefGroup = F72E8A711D8E8A6500B99CC7 /* Products */;
404 | projectDirPath = "";
405 | projectRoot = "";
406 | targets = (
407 | F72E8A6F1D8E8A6500B99CC7 /* XZPushTest */,
408 | F72E8A881D8E8A6500B99CC7 /* XZPushTestTests */,
409 | F72E8A931D8E8A6500B99CC7 /* XZPushTestUITests */,
410 | F79D576A1D938A37003732D5 /* mytest */,
411 | F73D3FF01DAF614C00FA9237 /* NotiContentExtension */,
412 | );
413 | };
414 | /* End PBXProject section */
415 |
416 | /* Begin PBXResourcesBuildPhase section */
417 | F72E8A6E1D8E8A6500B99CC7 /* Resources */ = {
418 | isa = PBXResourcesBuildPhase;
419 | buildActionMask = 2147483647;
420 | files = (
421 | F78AC8841D9012E500E7AA87 /* flv视频测试用例1.mp4 in Resources */,
422 | F72E8A831D8E8A6500B99CC7 /* LaunchScreen.storyboard in Resources */,
423 | F72E8A801D8E8A6500B99CC7 /* Assets.xcassets in Resources */,
424 | F7DAE0001D8FEF2C00A449E2 /* image01.jpg in Resources */,
425 | F7DADFF61D8FC3EC00A449E2 /* test1.gif in Resources */,
426 | F72E8AA81D8EABAB00B99CC7 /* icon_certification_status1@2x.png in Resources */,
427 | F72E8A7E1D8E8A6500B99CC7 /* Main.storyboard in Resources */,
428 | );
429 | runOnlyForDeploymentPostprocessing = 0;
430 | };
431 | F72E8A871D8E8A6500B99CC7 /* Resources */ = {
432 | isa = PBXResourcesBuildPhase;
433 | buildActionMask = 2147483647;
434 | files = (
435 | );
436 | runOnlyForDeploymentPostprocessing = 0;
437 | };
438 | F72E8A921D8E8A6500B99CC7 /* Resources */ = {
439 | isa = PBXResourcesBuildPhase;
440 | buildActionMask = 2147483647;
441 | files = (
442 | );
443 | runOnlyForDeploymentPostprocessing = 0;
444 | };
445 | F73D3FEF1DAF614C00FA9237 /* Resources */ = {
446 | isa = PBXResourcesBuildPhase;
447 | buildActionMask = 2147483647;
448 | files = (
449 | F73D3FFA1DAF614C00FA9237 /* MainInterface.storyboard in Resources */,
450 | );
451 | runOnlyForDeploymentPostprocessing = 0;
452 | };
453 | F79D57691D938A37003732D5 /* Resources */ = {
454 | isa = PBXResourcesBuildPhase;
455 | buildActionMask = 2147483647;
456 | files = (
457 | );
458 | runOnlyForDeploymentPostprocessing = 0;
459 | };
460 | /* End PBXResourcesBuildPhase section */
461 |
462 | /* Begin PBXSourcesBuildPhase section */
463 | F72E8A6C1D8E8A6500B99CC7 /* Sources */ = {
464 | isa = PBXSourcesBuildPhase;
465 | buildActionMask = 2147483647;
466 | files = (
467 | F72E8A7B1D8E8A6500B99CC7 /* ViewController.m in Sources */,
468 | F72E8A781D8E8A6500B99CC7 /* AppDelegate.m in Sources */,
469 | F72E8A751D8E8A6500B99CC7 /* main.m in Sources */,
470 | );
471 | runOnlyForDeploymentPostprocessing = 0;
472 | };
473 | F72E8A851D8E8A6500B99CC7 /* Sources */ = {
474 | isa = PBXSourcesBuildPhase;
475 | buildActionMask = 2147483647;
476 | files = (
477 | F72E8A8E1D8E8A6500B99CC7 /* XZPushTestTests.m in Sources */,
478 | );
479 | runOnlyForDeploymentPostprocessing = 0;
480 | };
481 | F72E8A901D8E8A6500B99CC7 /* Sources */ = {
482 | isa = PBXSourcesBuildPhase;
483 | buildActionMask = 2147483647;
484 | files = (
485 | F72E8A991D8E8A6500B99CC7 /* XZPushTestUITests.m in Sources */,
486 | );
487 | runOnlyForDeploymentPostprocessing = 0;
488 | };
489 | F73D3FED1DAF614C00FA9237 /* Sources */ = {
490 | isa = PBXSourcesBuildPhase;
491 | buildActionMask = 2147483647;
492 | files = (
493 | F73D3FF71DAF614C00FA9237 /* NotificationViewController.m in Sources */,
494 | );
495 | runOnlyForDeploymentPostprocessing = 0;
496 | };
497 | F79D57671D938A37003732D5 /* Sources */ = {
498 | isa = PBXSourcesBuildPhase;
499 | buildActionMask = 2147483647;
500 | files = (
501 | F79D576F1D938A37003732D5 /* NotificationService.m in Sources */,
502 | );
503 | runOnlyForDeploymentPostprocessing = 0;
504 | };
505 | /* End PBXSourcesBuildPhase section */
506 |
507 | /* Begin PBXTargetDependency section */
508 | F72E8A8B1D8E8A6500B99CC7 /* PBXTargetDependency */ = {
509 | isa = PBXTargetDependency;
510 | target = F72E8A6F1D8E8A6500B99CC7 /* XZPushTest */;
511 | targetProxy = F72E8A8A1D8E8A6500B99CC7 /* PBXContainerItemProxy */;
512 | };
513 | F72E8A961D8E8A6500B99CC7 /* PBXTargetDependency */ = {
514 | isa = PBXTargetDependency;
515 | target = F72E8A6F1D8E8A6500B99CC7 /* XZPushTest */;
516 | targetProxy = F72E8A951D8E8A6500B99CC7 /* PBXContainerItemProxy */;
517 | };
518 | F73D3FFD1DAF614C00FA9237 /* PBXTargetDependency */ = {
519 | isa = PBXTargetDependency;
520 | target = F73D3FF01DAF614C00FA9237 /* NotiContentExtension */;
521 | targetProxy = F73D3FFC1DAF614C00FA9237 /* PBXContainerItemProxy */;
522 | };
523 | F79D57721D938A37003732D5 /* PBXTargetDependency */ = {
524 | isa = PBXTargetDependency;
525 | target = F79D576A1D938A37003732D5 /* mytest */;
526 | targetProxy = F79D57711D938A37003732D5 /* PBXContainerItemProxy */;
527 | };
528 | /* End PBXTargetDependency section */
529 |
530 | /* Begin PBXVariantGroup section */
531 | F72E8A7C1D8E8A6500B99CC7 /* Main.storyboard */ = {
532 | isa = PBXVariantGroup;
533 | children = (
534 | F72E8A7D1D8E8A6500B99CC7 /* Base */,
535 | );
536 | name = Main.storyboard;
537 | sourceTree = "";
538 | };
539 | F72E8A811D8E8A6500B99CC7 /* LaunchScreen.storyboard */ = {
540 | isa = PBXVariantGroup;
541 | children = (
542 | F72E8A821D8E8A6500B99CC7 /* Base */,
543 | );
544 | name = LaunchScreen.storyboard;
545 | sourceTree = "";
546 | };
547 | F73D3FF81DAF614C00FA9237 /* MainInterface.storyboard */ = {
548 | isa = PBXVariantGroup;
549 | children = (
550 | F73D3FF91DAF614C00FA9237 /* Base */,
551 | );
552 | name = MainInterface.storyboard;
553 | sourceTree = "";
554 | };
555 | /* End PBXVariantGroup section */
556 |
557 | /* Begin XCBuildConfiguration section */
558 | F72E8A9B1D8E8A6500B99CC7 /* Debug */ = {
559 | isa = XCBuildConfiguration;
560 | buildSettings = {
561 | ALWAYS_SEARCH_USER_PATHS = NO;
562 | CLANG_ANALYZER_NONNULL = YES;
563 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
564 | CLANG_CXX_LIBRARY = "libc++";
565 | CLANG_ENABLE_MODULES = YES;
566 | CLANG_ENABLE_OBJC_ARC = YES;
567 | CLANG_WARN_BOOL_CONVERSION = YES;
568 | CLANG_WARN_CONSTANT_CONVERSION = YES;
569 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
570 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
571 | CLANG_WARN_EMPTY_BODY = YES;
572 | CLANG_WARN_ENUM_CONVERSION = YES;
573 | CLANG_WARN_INFINITE_RECURSION = YES;
574 | CLANG_WARN_INT_CONVERSION = YES;
575 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
576 | CLANG_WARN_SUSPICIOUS_MOVES = YES;
577 | CLANG_WARN_UNREACHABLE_CODE = YES;
578 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
579 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
580 | COPY_PHASE_STRIP = NO;
581 | DEBUG_INFORMATION_FORMAT = dwarf;
582 | ENABLE_STRICT_OBJC_MSGSEND = YES;
583 | ENABLE_TESTABILITY = YES;
584 | GCC_C_LANGUAGE_STANDARD = gnu99;
585 | GCC_DYNAMIC_NO_PIC = NO;
586 | GCC_NO_COMMON_BLOCKS = YES;
587 | GCC_OPTIMIZATION_LEVEL = 0;
588 | GCC_PREPROCESSOR_DEFINITIONS = (
589 | "DEBUG=1",
590 | "$(inherited)",
591 | );
592 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
593 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
594 | GCC_WARN_UNDECLARED_SELECTOR = YES;
595 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
596 | GCC_WARN_UNUSED_FUNCTION = YES;
597 | GCC_WARN_UNUSED_VARIABLE = YES;
598 | IPHONEOS_DEPLOYMENT_TARGET = 10.0;
599 | MTL_ENABLE_DEBUG_INFO = YES;
600 | ONLY_ACTIVE_ARCH = YES;
601 | SDKROOT = iphoneos;
602 | };
603 | name = Debug;
604 | };
605 | F72E8A9C1D8E8A6500B99CC7 /* Release */ = {
606 | isa = XCBuildConfiguration;
607 | buildSettings = {
608 | ALWAYS_SEARCH_USER_PATHS = NO;
609 | CLANG_ANALYZER_NONNULL = YES;
610 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
611 | CLANG_CXX_LIBRARY = "libc++";
612 | CLANG_ENABLE_MODULES = YES;
613 | CLANG_ENABLE_OBJC_ARC = YES;
614 | CLANG_WARN_BOOL_CONVERSION = YES;
615 | CLANG_WARN_CONSTANT_CONVERSION = YES;
616 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
617 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
618 | CLANG_WARN_EMPTY_BODY = YES;
619 | CLANG_WARN_ENUM_CONVERSION = YES;
620 | CLANG_WARN_INFINITE_RECURSION = YES;
621 | CLANG_WARN_INT_CONVERSION = YES;
622 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
623 | CLANG_WARN_SUSPICIOUS_MOVES = YES;
624 | CLANG_WARN_UNREACHABLE_CODE = YES;
625 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
626 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
627 | COPY_PHASE_STRIP = NO;
628 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
629 | ENABLE_NS_ASSERTIONS = NO;
630 | ENABLE_STRICT_OBJC_MSGSEND = YES;
631 | GCC_C_LANGUAGE_STANDARD = gnu99;
632 | GCC_NO_COMMON_BLOCKS = YES;
633 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
634 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
635 | GCC_WARN_UNDECLARED_SELECTOR = YES;
636 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
637 | GCC_WARN_UNUSED_FUNCTION = YES;
638 | GCC_WARN_UNUSED_VARIABLE = YES;
639 | IPHONEOS_DEPLOYMENT_TARGET = 10.0;
640 | MTL_ENABLE_DEBUG_INFO = NO;
641 | SDKROOT = iphoneos;
642 | VALIDATE_PRODUCT = YES;
643 | };
644 | name = Release;
645 | };
646 | F72E8A9E1D8E8A6500B99CC7 /* Debug */ = {
647 | isa = XCBuildConfiguration;
648 | buildSettings = {
649 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
650 | CODE_SIGN_ENTITLEMENTS = XZPushTest/XZPushTest.entitlements;
651 | DEVELOPMENT_TEAM = 2S9EXUX8CH;
652 | INFOPLIST_FILE = XZPushTest/Info.plist;
653 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
654 | PRODUCT_BUNDLE_IDENTIFIER = coderxu.com;
655 | PRODUCT_NAME = "$(TARGET_NAME)";
656 | };
657 | name = Debug;
658 | };
659 | F72E8A9F1D8E8A6500B99CC7 /* Release */ = {
660 | isa = XCBuildConfiguration;
661 | buildSettings = {
662 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
663 | CODE_SIGN_ENTITLEMENTS = XZPushTest/XZPushTest.entitlements;
664 | DEVELOPMENT_TEAM = 2S9EXUX8CH;
665 | INFOPLIST_FILE = XZPushTest/Info.plist;
666 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
667 | PRODUCT_BUNDLE_IDENTIFIER = coderxu.com;
668 | PRODUCT_NAME = "$(TARGET_NAME)";
669 | };
670 | name = Release;
671 | };
672 | F72E8AA11D8E8A6500B99CC7 /* Debug */ = {
673 | isa = XCBuildConfiguration;
674 | buildSettings = {
675 | BUNDLE_LOADER = "$(TEST_HOST)";
676 | DEVELOPMENT_TEAM = 2S9EXUX8CH;
677 | INFOPLIST_FILE = XZPushTestTests/Info.plist;
678 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
679 | PRODUCT_BUNDLE_IDENTIFIER = coderXu.github.io.XZPushTestTests;
680 | PRODUCT_NAME = "$(TARGET_NAME)";
681 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/XZPushTest.app/XZPushTest";
682 | };
683 | name = Debug;
684 | };
685 | F72E8AA21D8E8A6500B99CC7 /* Release */ = {
686 | isa = XCBuildConfiguration;
687 | buildSettings = {
688 | BUNDLE_LOADER = "$(TEST_HOST)";
689 | DEVELOPMENT_TEAM = 2S9EXUX8CH;
690 | INFOPLIST_FILE = XZPushTestTests/Info.plist;
691 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
692 | PRODUCT_BUNDLE_IDENTIFIER = coderXu.github.io.XZPushTestTests;
693 | PRODUCT_NAME = "$(TARGET_NAME)";
694 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/XZPushTest.app/XZPushTest";
695 | };
696 | name = Release;
697 | };
698 | F72E8AA41D8E8A6500B99CC7 /* Debug */ = {
699 | isa = XCBuildConfiguration;
700 | buildSettings = {
701 | DEVELOPMENT_TEAM = 2S9EXUX8CH;
702 | INFOPLIST_FILE = XZPushTestUITests/Info.plist;
703 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
704 | PRODUCT_BUNDLE_IDENTIFIER = coderXu.github.io.XZPushTestUITests;
705 | PRODUCT_NAME = "$(TARGET_NAME)";
706 | TEST_TARGET_NAME = XZPushTest;
707 | };
708 | name = Debug;
709 | };
710 | F72E8AA51D8E8A6500B99CC7 /* Release */ = {
711 | isa = XCBuildConfiguration;
712 | buildSettings = {
713 | DEVELOPMENT_TEAM = 2S9EXUX8CH;
714 | INFOPLIST_FILE = XZPushTestUITests/Info.plist;
715 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
716 | PRODUCT_BUNDLE_IDENTIFIER = coderXu.github.io.XZPushTestUITests;
717 | PRODUCT_NAME = "$(TARGET_NAME)";
718 | TEST_TARGET_NAME = XZPushTest;
719 | };
720 | name = Release;
721 | };
722 | F73D3FFF1DAF614C00FA9237 /* Debug */ = {
723 | isa = XCBuildConfiguration;
724 | buildSettings = {
725 | DEVELOPMENT_TEAM = 2S9EXUX8CH;
726 | INFOPLIST_FILE = NotiContentExtension/Info.plist;
727 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
728 | PRODUCT_BUNDLE_IDENTIFIER = coderxu.com.NotiContentExtension;
729 | PRODUCT_NAME = "$(TARGET_NAME)";
730 | SKIP_INSTALL = YES;
731 | };
732 | name = Debug;
733 | };
734 | F73D40001DAF614C00FA9237 /* Release */ = {
735 | isa = XCBuildConfiguration;
736 | buildSettings = {
737 | DEVELOPMENT_TEAM = 2S9EXUX8CH;
738 | INFOPLIST_FILE = NotiContentExtension/Info.plist;
739 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
740 | PRODUCT_BUNDLE_IDENTIFIER = coderxu.com.NotiContentExtension;
741 | PRODUCT_NAME = "$(TARGET_NAME)";
742 | SKIP_INSTALL = YES;
743 | };
744 | name = Release;
745 | };
746 | F79D57751D938A37003732D5 /* Debug */ = {
747 | isa = XCBuildConfiguration;
748 | buildSettings = {
749 | DEVELOPMENT_TEAM = 2S9EXUX8CH;
750 | INFOPLIST_FILE = mytest/Info.plist;
751 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
752 | PRODUCT_BUNDLE_IDENTIFIER = coderxu.com.mytest;
753 | PRODUCT_NAME = "$(TARGET_NAME)";
754 | SKIP_INSTALL = YES;
755 | };
756 | name = Debug;
757 | };
758 | F79D57761D938A37003732D5 /* Release */ = {
759 | isa = XCBuildConfiguration;
760 | buildSettings = {
761 | DEVELOPMENT_TEAM = 2S9EXUX8CH;
762 | INFOPLIST_FILE = mytest/Info.plist;
763 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
764 | PRODUCT_BUNDLE_IDENTIFIER = coderxu.com.mytest;
765 | PRODUCT_NAME = "$(TARGET_NAME)";
766 | SKIP_INSTALL = YES;
767 | };
768 | name = Release;
769 | };
770 | /* End XCBuildConfiguration section */
771 |
772 | /* Begin XCConfigurationList section */
773 | F72E8A6B1D8E8A6500B99CC7 /* Build configuration list for PBXProject "XZPushTest" */ = {
774 | isa = XCConfigurationList;
775 | buildConfigurations = (
776 | F72E8A9B1D8E8A6500B99CC7 /* Debug */,
777 | F72E8A9C1D8E8A6500B99CC7 /* Release */,
778 | );
779 | defaultConfigurationIsVisible = 0;
780 | defaultConfigurationName = Release;
781 | };
782 | F72E8A9D1D8E8A6500B99CC7 /* Build configuration list for PBXNativeTarget "XZPushTest" */ = {
783 | isa = XCConfigurationList;
784 | buildConfigurations = (
785 | F72E8A9E1D8E8A6500B99CC7 /* Debug */,
786 | F72E8A9F1D8E8A6500B99CC7 /* Release */,
787 | );
788 | defaultConfigurationIsVisible = 0;
789 | defaultConfigurationName = Release;
790 | };
791 | F72E8AA01D8E8A6500B99CC7 /* Build configuration list for PBXNativeTarget "XZPushTestTests" */ = {
792 | isa = XCConfigurationList;
793 | buildConfigurations = (
794 | F72E8AA11D8E8A6500B99CC7 /* Debug */,
795 | F72E8AA21D8E8A6500B99CC7 /* Release */,
796 | );
797 | defaultConfigurationIsVisible = 0;
798 | defaultConfigurationName = Release;
799 | };
800 | F72E8AA31D8E8A6500B99CC7 /* Build configuration list for PBXNativeTarget "XZPushTestUITests" */ = {
801 | isa = XCConfigurationList;
802 | buildConfigurations = (
803 | F72E8AA41D8E8A6500B99CC7 /* Debug */,
804 | F72E8AA51D8E8A6500B99CC7 /* Release */,
805 | );
806 | defaultConfigurationIsVisible = 0;
807 | defaultConfigurationName = Release;
808 | };
809 | F73D40011DAF614C00FA9237 /* Build configuration list for PBXNativeTarget "NotiContentExtension" */ = {
810 | isa = XCConfigurationList;
811 | buildConfigurations = (
812 | F73D3FFF1DAF614C00FA9237 /* Debug */,
813 | F73D40001DAF614C00FA9237 /* Release */,
814 | );
815 | defaultConfigurationIsVisible = 0;
816 | };
817 | F79D57741D938A37003732D5 /* Build configuration list for PBXNativeTarget "mytest" */ = {
818 | isa = XCConfigurationList;
819 | buildConfigurations = (
820 | F79D57751D938A37003732D5 /* Debug */,
821 | F79D57761D938A37003732D5 /* Release */,
822 | );
823 | defaultConfigurationIsVisible = 0;
824 | defaultConfigurationName = Release;
825 | };
826 | /* End XCConfigurationList section */
827 | };
828 | rootObject = F72E8A681D8E8A6500B99CC7 /* Project object */;
829 | }
830 |
--------------------------------------------------------------------------------
/XZPushTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/XZPushTest.xcodeproj/xcuserdata/coderxu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
20 |
21 |
22 |
24 |
36 |
37 |
38 |
40 |
52 |
53 |
54 |
56 |
68 |
69 |
70 |
72 |
84 |
85 |
86 |
88 |
100 |
101 |
102 |
104 |
116 |
117 |
131 |
132 |
146 |
147 |
148 |
149 |
150 |
152 |
164 |
165 |
179 |
180 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
--------------------------------------------------------------------------------
/XZPushTest.xcodeproj/xcuserdata/coderxu.xcuserdatad/xcschemes/NotiContentExtension.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
6 |
9 |
10 |
16 |
22 |
23 |
24 |
30 |
36 |
37 |
38 |
39 |
40 |
45 |
46 |
47 |
48 |
54 |
55 |
56 |
57 |
58 |
59 |
70 |
72 |
78 |
79 |
80 |
81 |
82 |
83 |
90 |
92 |
98 |
99 |
100 |
101 |
103 |
104 |
107 |
108 |
109 |
--------------------------------------------------------------------------------
/XZPushTest.xcodeproj/xcuserdata/coderxu.xcuserdatad/xcschemes/XZPushTest.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
43 |
49 |
50 |
51 |
52 |
53 |
59 |
60 |
61 |
62 |
63 |
64 |
74 |
76 |
82 |
83 |
84 |
85 |
89 |
90 |
91 |
92 |
93 |
94 |
100 |
102 |
108 |
109 |
110 |
111 |
113 |
114 |
117 |
118 |
119 |
--------------------------------------------------------------------------------
/XZPushTest.xcodeproj/xcuserdata/coderxu.xcuserdatad/xcschemes/mytest.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
6 |
9 |
10 |
16 |
22 |
23 |
24 |
30 |
36 |
37 |
38 |
39 |
40 |
45 |
46 |
47 |
48 |
54 |
55 |
56 |
57 |
58 |
59 |
70 |
74 |
75 |
76 |
82 |
83 |
84 |
85 |
86 |
87 |
94 |
96 |
102 |
103 |
104 |
105 |
107 |
108 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/XZPushTest.xcodeproj/xcuserdata/coderxu.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | NotiContentExtension.xcscheme
8 |
9 | orderHint
10 | 4
11 |
12 | XZPushTest.xcscheme
13 |
14 | orderHint
15 | 0
16 |
17 | mytest.xcscheme
18 |
19 | orderHint
20 | 1
21 |
22 |
23 | SuppressBuildableAutocreation
24 |
25 | F72E8A6F1D8E8A6500B99CC7
26 |
27 | primary
28 |
29 |
30 | F72E8A881D8E8A6500B99CC7
31 |
32 | primary
33 |
34 |
35 | F72E8A931D8E8A6500B99CC7
36 |
37 | primary
38 |
39 |
40 | F73D3FF01DAF614C00FA9237
41 |
42 | primary
43 |
44 |
45 | F76167491D94D57500936B14
46 |
47 | primary
48 |
49 |
50 | F761723F1D9A6D0B009F89E2
51 |
52 | primary
53 |
54 |
55 | F79D57591D9384AA003732D5
56 |
57 | primary
58 |
59 |
60 | F79D576A1D938A37003732D5
61 |
62 | primary
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/XZPushTest/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // XZPushTest
4 | //
5 | // Created by coderXu on 16/9/18.
6 | // Copyright © 2016年 coderXu. All rights reserved.
7 | //
8 |
9 | #import
10 | #define DDLOG(...) printf("%s\n",[[NSString stringWithFormat:__VA_ARGS__]UTF8String]);
11 |
12 | @interface AppDelegate : UIResponder
13 |
14 | @property (strong, nonatomic) UIWindow *window;
15 |
16 |
17 | @end
18 |
19 |
--------------------------------------------------------------------------------
/XZPushTest/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // XZPushTest
4 | //
5 | // Created by coderXu on 16/9/18.
6 | // Copyright © 2016年 coderXu. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 |
11 | #ifdef NSFoundationVersionNumber_iOS_9_x_Max
12 | #import
13 | #endif
14 |
15 | @interface AppDelegate ()
16 |
17 | @end
18 |
19 | @implementation AppDelegate
20 |
21 |
22 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
23 |
24 | if ([[UIDevice currentDevice].systemVersion floatValue] >= 10.0) {
25 |
26 | //iOS10特有
27 | UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
28 | center.delegate = self;
29 | [center requestAuthorizationWithOptions:(UNAuthorizationOptionAlert | UNAuthorizationOptionBadge | UNAuthorizationOptionSound) completionHandler:^(BOOL granted, NSError * _Nullable error) {
30 |
31 | if (granted) {
32 | // 点击允许
33 | DDLOG(@"注册成功");
34 | [center getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
35 | // NSLog(@"%@", settings);
36 | }];
37 | } else {
38 | // 点击不允许
39 | DDLOG(@"注册失败");
40 | }
41 |
42 | }];
43 | }else if ([[UIDevice currentDevice].systemVersion floatValue] >8.0){
44 |
45 |
46 |
47 | //iOS8 - iOS10
48 | [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeSound | UIUserNotificationTypeBadge categories:nil]];
49 |
50 | }else if ([[UIDevice currentDevice].systemVersion floatValue] < 8.0) {
51 | //iOS8系统以下
52 | [application registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound];
53 | }
54 | // 注册获得device Token
55 | [[UIApplication sharedApplication] registerForRemoteNotifications];
56 |
57 |
58 |
59 |
60 | return YES;
61 | }
62 |
63 |
64 |
65 | - (void)application:(UIApplication *)application
66 | didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
67 |
68 |
69 | DDLOG(@"%@", [NSString stringWithFormat:@"Device Token: %@", deviceToken]);
70 | }
71 |
72 | - (void)application:(UIApplication *)application
73 | didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
74 | DDLOG(@"did Fail To Register For Remote Notifications With Error: %@", error);
75 | }
76 |
77 |
78 |
79 | - (void)application:(UIApplication *)application
80 | didReceiveRemoteNotification:(NSDictionary *)userInfo {
81 |
82 | NSLog(@"iOS6及以下系统,收到通知:%@", [self logDic:userInfo]);
83 | }
84 |
85 | - (void)application:(UIApplication *)application
86 | didReceiveRemoteNotification:(NSDictionary *)userInfo
87 | fetchCompletionHandler:
88 | (void (^)(UIBackgroundFetchResult))completionHandler {
89 |
90 |
91 | NSLog(@"iOS7及以上系统,收到通知:%@", [self logDic:userInfo]);
92 |
93 |
94 | completionHandler(UIBackgroundFetchResultNewData);
95 | }
96 |
97 | // iOS 10收到通知
98 | - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler{
99 |
100 | NSDictionary * userInfo = notification.request.content.userInfo;
101 |
102 | UNNotificationRequest *request = notification.request; // 收到推送的请求
103 | UNNotificationContent *content = request.content; // 收到推送的消息内容
104 | NSNumber *badge = content.badge; // 推送消息的角标
105 | NSString *body = content.body; // 推送消息体
106 | UNNotificationSound *sound = content.sound; // 推送消息的声音
107 | NSString *subtitle = content.subtitle; // 推送消息的副标题
108 | NSString *title = content.title; // 推送消息的标题
109 |
110 |
111 |
112 | // UNNotificationAction *action1 = [UNNotificationAction actionWithIdentifier:@"action1" title:@"策略1行为1" options:UNNotificationActionOptionForeground];
113 | //
114 | // UNTextInputNotificationAction *action2 = [UNTextInputNotificationAction actionWithIdentifier:@"action2" title:@"策略1行为2" options:UNNotificationActionOptionDestructive textInputButtonTitle:@"comment" textInputPlaceholder:@"reply"];
115 |
116 | //UNNotificationCategoryOptionNone
117 | //UNNotificationCategoryOptionCustomDismissAction 清除通知被触发会走通知的代理方法
118 | //UNNotificationCategoryOptionAllowInCarPlay 适用于行车模式
119 |
120 |
121 | // UNNotificationCategory *catary1 = [UNNotificationCategory categoryWithIdentifier:@"category1" actions:@[action1,action2] intentIdentifiers:@[] options:UNNotificationCategoryOptionCustomDismissAction];
122 | //
123 | //
124 | // UNNotificationAction *action3 = [UNNotificationAction actionWithIdentifier:@"action3" title:@"策略2行为1" options:UNNotificationActionOptionForeground];
125 | //
126 | // UNNotificationAction *action4 = [UNNotificationAction actionWithIdentifier:@"action4" title:@"策略2行为2" options:UNNotificationActionOptionForeground];
127 | //
128 | // UNNotificationCategory *category2 = [UNNotificationCategory categoryWithIdentifier:@"category2" actions:@[action3,action4] intentIdentifiers:@[] options:UNNotificationCategoryOptionCustomDismissAction];
129 | //
130 | // [[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:[NSSet setWithObjects:catary1,category2, nil]];
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 | if([notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {
146 | NSLog(@"iOS10 前台收到远程通知:%@", [self logDic:userInfo]);
147 |
148 |
149 | }
150 | else {
151 | // 判断为本地通知
152 | NSLog(@"iOS10 前台收到本地通知:{\nbody:%@,\ntitle:%@,\nsubtitle:%@,\nbadge:%@,\nsound:%@,\nuserInfo:%@\n}",body,title,subtitle,badge,sound,userInfo);
153 | }
154 | completionHandler(UNNotificationPresentationOptionAlert); // 需要执行这个方法,选择是否提醒用户,有Badge、Sound、Alert三种类型可以设置
155 |
156 |
157 |
158 |
159 | }
160 | // 通知的点击事件
161 | - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)())completionHandler{
162 |
163 | NSDictionary * userInfo = response.notification.request.content.userInfo;
164 | UNNotificationRequest *request = response.notification.request; // 收到推送的请求
165 | UNNotificationContent *content = request.content; // 收到推送的消息内容
166 |
167 | NSNumber *badge = content.badge; // 推送消息的角标
168 | NSString *body = content.body; // 推送消息体
169 | UNNotificationSound *sound = content.sound; // 推送消息的声音
170 | NSString *subtitle = content.subtitle; // 推送消息的副标题
171 | NSString *title = content.title; // 推送消息的标题
172 |
173 | if([response.notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {
174 | NSLog(@"iOS10 收到远程通知:%@", [self logDic:userInfo]);
175 |
176 | }
177 | else {
178 | // 判断为本地通知
179 | NSLog(@"iOS10 收到本地通知:{\nbody:%@,\ntitle:%@,\nsubtitle:%@,\nbadge:%@,\nsound:%@,\nuserInfo:%@\n}",body,title,subtitle,badge,sound,userInfo);
180 | }
181 |
182 |
183 |
184 | // Warning: UNUserNotificationCenter delegate received call to -userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler: but the completion handler was never called.
185 | completionHandler(); // 系统要求执行这个方法
186 |
187 |
188 | }
189 |
190 |
191 |
192 | - (void)applicationWillResignActive:(UIApplication *)application {
193 | // 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.
194 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
195 | }
196 |
197 |
198 | - (void)applicationDidEnterBackground:(UIApplication *)application {
199 | // 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.
200 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
201 | }
202 |
203 |
204 | - (void)applicationWillEnterForeground:(UIApplication *)application {
205 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
206 | }
207 |
208 |
209 | - (void)applicationDidBecomeActive:(UIApplication *)application {
210 | // 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.
211 | }
212 |
213 |
214 | - (void)applicationWillTerminate:(UIApplication *)application {
215 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
216 | }
217 | - (NSString *)logDic:(NSDictionary *)dic {
218 | if (![dic count]) {
219 | return nil;
220 | }
221 | NSString *tempStr1 =
222 | [[dic description] stringByReplacingOccurrencesOfString:@"\\u"
223 | withString:@"\\U"];
224 | NSString *tempStr2 =
225 | [tempStr1 stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""];
226 | NSString *tempStr3 =
227 | [[@"\"" stringByAppendingString:tempStr2] stringByAppendingString:@"\""];
228 | NSData *tempData = [tempStr3 dataUsingEncoding:NSUTF8StringEncoding];
229 | NSString *str =
230 | [NSPropertyListSerialization propertyListFromData:tempData
231 | mutabilityOption:NSPropertyListImmutable
232 | format:NULL
233 | errorDescription:NULL];
234 | return str;
235 | }
236 |
237 |
238 | @end
239 |
--------------------------------------------------------------------------------
/XZPushTest/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "60x60",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "size" : "60x60",
41 | "scale" : "3x"
42 | }
43 | ],
44 | "info" : {
45 | "version" : 1,
46 | "author" : "xcode"
47 | }
48 | }
--------------------------------------------------------------------------------
/XZPushTest/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/XZPushTest/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/XZPushTest/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | NSAppTransportSecurity
24 |
25 | NSAllowsArbitraryLoads
26 |
27 |
28 | UIBackgroundModes
29 |
30 | remote-notification
31 |
32 | UILaunchStoryboardName
33 | LaunchScreen
34 | UIMainStoryboardFile
35 | Main
36 | UIRequiredDeviceCapabilities
37 |
38 | armv7
39 |
40 | UISupportedInterfaceOrientations
41 |
42 | UIInterfaceOrientationPortrait
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/XZPushTest/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // XZPushTest
4 | //
5 | // Created by coderXu on 16/9/18.
6 | // Copyright © 2016年 coderXu. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/XZPushTest/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // XZPushTest
4 | //
5 | // Created by coderXu on 16/9/18.
6 | // Copyright © 2016年 coderXu. All rights reserved.
7 | //
8 | #define DDLOG(...) printf("%s\n",[[NSString stringWithFormat:__VA_ARGS__]UTF8String]);
9 |
10 | #import "ViewController.h"
11 | #import
12 | #import
13 | #import
14 | @interface ViewController ()
15 |
16 | @end
17 |
18 | @implementation ViewController
19 |
20 | - (void)viewDidLoad {
21 | [super viewDidLoad];
22 |
23 |
24 | // 1.本地通知
25 | [self requestLocationNotification];
26 |
27 | }
28 |
29 |
30 |
31 |
32 | - (void)requestLocationNotification{
33 |
34 |
35 | UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init];
36 | content.title = @"徐不同测试通知";
37 | content.subtitle = @"测试通知";
38 | content.body = @"来自徐不同的简书";
39 | content.badge = @1;
40 |
41 | NSError *error = nil;
42 |
43 | NSString *path = [[NSBundle mainBundle] pathForResource:@"icon_certification_status1@2x" ofType:@"png"];
44 | /*
45 | // 1.gif图的路径
46 | NSString *path = [[NSBundle mainBundle] pathForResource:@"test1" ofType:@"gif"];
47 | // 2.mp4的路径
48 | // NSString *path = [[NSBundle mainBundle] pathForResource:@"flv视频测试用例1" ofType:@"mp4"];
49 |
50 |
51 | NSMutableDictionary *dict = [NSMutableDictionary dictionary];
52 |
53 |
54 | 附件通知键值使用说明
55 | 1.UNNotificationAttachmentOptionsTypeHintKey
56 | dict[UNNotificationAttachmentOptionsTypeHintKey] = (__bridge id _Nullable)(kUTTypeImage);
57 |
58 | 2.UNNotificationAttachmentOptionsThumbnailHiddenKey
59 | dict[UNNotificationAttachmentOptionsThumbnailHiddenKey] = @YES;
60 |
61 | 3.UNNotificationAttachmentOptionsThumbnailClippingRectKey
62 | dict[UNNotificationAttachmentOptionsThumbnailClippingRectKey] = (__bridge id _Nullable)((CGRectCreateDictionaryRepresentation(CGRectMake(0, 0, 1 ,1))));
63 | Rect对应的意思
64 | thumbnailClippingRect = {
65 | Height = "0.1";
66 | Width = "0.1";
67 | X = 0;
68 | Y = 0;
69 | };
70 | 4. UNNotificationAttachmentOptionsThumbnailTimeKey-选取影片的某一秒做推送显示的缩略图
71 | dict[UNNotificationAttachmentOptionsThumbnailTimeKey] =@10;
72 |
73 |
74 |
75 | UNNotificationAttachment *att = [UNNotificationAttachment attachmentWithIdentifier:@"att1" URL:[NSURL fileURLWithPath:path] options:nil error:&error];
76 | if (error) {
77 | NSLog(@"attachment error %@", error);
78 | }
79 | content.attachments = @[att];
80 | content.launchImageName = @"icon_certification_status1@2x.png";
81 |
82 | //这里设置category1, 是与之前设置的category对应
83 | content.categoryIdentifier = @"category1";
84 |
85 | UNNotificationSound *sound = [UNNotificationSound defaultSound];
86 | content.sound = sound;
87 |
88 |
89 |
90 |
91 | /*触发模式1*/
92 | UNTimeIntervalNotificationTrigger *trigger1 = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:1 repeats:NO];
93 |
94 | /*触发模式2*/
95 | UNTimeIntervalNotificationTrigger *trigger2 = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:1 repeats:NO];
96 |
97 | /*触发模式3*/
98 | // 周一早上 8:00 上班
99 | NSDateComponents *components = [[NSDateComponents alloc] init];
100 | // 注意,weekday是从周日开始的,如果想设置为从周一开始,大家可以自己想想~
101 | components.weekday = 2;
102 | components.hour = 8;
103 | UNCalendarNotificationTrigger *trigger3 = [UNCalendarNotificationTrigger triggerWithDateMatchingComponents:components repeats:YES];
104 |
105 |
106 | /*触发模式4 这个方法一般要先#import*/
107 |
108 | /*这个触发条件一般在
109 | //1、如果用户进入或者走出某个区域会调用下面两个方法
110 | - (void)locationManager:(CLLocationManager *)manager
111 | didEnterRegion:(CLRegion *)region
112 | - (void)locationManager:(CLLocationManager *)manager
113 | didExitRegion:(CLRegion *)region代理方法反馈相关信息
114 | */
115 |
116 | CLRegion *region = [[CLRegion alloc] init];
117 | CLCircularRegion *circlarRegin = [[CLCircularRegion alloc] init];
118 |
119 |
120 |
121 |
122 | // 创建本地通知
123 | NSString *requestIdentifer = @"TestRequestww1";
124 | UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:requestIdentifer content:content trigger:trigger1];
125 |
126 | //把通知加到UNUserNotificationCenter, 到指定触发点会被触发
127 | [[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest:request withCompletionHandler:^(NSError * _Nullable error) {
128 | }];
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 | }
138 |
139 |
140 |
141 | @end
142 |
--------------------------------------------------------------------------------
/XZPushTest/XZPushTest.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | aps-environment
6 | development
7 |
8 |
9 |
--------------------------------------------------------------------------------
/XZPushTest/flv视频测试用例1.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoderWQ/XZPushTest/05c82cdec9cd6bff3b27d7bc53a7ac8accc783d4/XZPushTest/flv视频测试用例1.mp4
--------------------------------------------------------------------------------
/XZPushTest/icon_certification_status1@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoderWQ/XZPushTest/05c82cdec9cd6bff3b27d7bc53a7ac8accc783d4/XZPushTest/icon_certification_status1@2x.png
--------------------------------------------------------------------------------
/XZPushTest/image01.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoderWQ/XZPushTest/05c82cdec9cd6bff3b27d7bc53a7ac8accc783d4/XZPushTest/image01.jpg
--------------------------------------------------------------------------------
/XZPushTest/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // XZPushTest
4 | //
5 | // Created by coderXu on 16/9/18.
6 | // Copyright © 2016年 coderXu. 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 |
--------------------------------------------------------------------------------
/XZPushTest/test1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CoderWQ/XZPushTest/05c82cdec9cd6bff3b27d7bc53a7ac8accc783d4/XZPushTest/test1.gif
--------------------------------------------------------------------------------
/XZPushTestTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/XZPushTestTests/XZPushTestTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // XZPushTestTests.m
3 | // XZPushTestTests
4 | //
5 | // Created by coderXu on 16/9/18.
6 | // Copyright © 2016年 coderXu. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface XZPushTestTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation XZPushTestTests
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 | // Use XCTAssert and related functions to verify your tests produce the correct results.
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 |
--------------------------------------------------------------------------------
/XZPushTestUITests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/XZPushTestUITests/XZPushTestUITests.m:
--------------------------------------------------------------------------------
1 | //
2 | // XZPushTestUITests.m
3 | // XZPushTestUITests
4 | //
5 | // Created by coderXu on 16/9/18.
6 | // Copyright © 2016年 coderXu. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface XZPushTestUITests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation XZPushTestUITests
16 |
17 | - (void)setUp {
18 | [super setUp];
19 |
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 |
22 | // In UI tests it is usually best to stop immediately when a failure occurs.
23 | self.continueAfterFailure = NO;
24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
25 | [[[XCUIApplication alloc] init] launch];
26 |
27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
28 | }
29 |
30 | - (void)tearDown {
31 | // Put teardown code here. This method is called after the invocation of each test method in the class.
32 | [super tearDown];
33 | }
34 |
35 | - (void)testExample {
36 | // Use recording to get started writing UI tests.
37 | // Use XCTAssert and related functions to verify your tests produce the correct results.
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/mytest/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | 徐不同
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | XPC!
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleVersion
22 | 1
23 | NSAppTransportSecurity
24 |
25 | NSAllowsArbitraryLoads
26 |
27 |
28 | NSExtension
29 |
30 | NSExtensionPointIdentifier
31 | com.apple.usernotifications.service
32 | NSExtensionPrincipalClass
33 | NotificationService
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/mytest/NotificationService.h:
--------------------------------------------------------------------------------
1 | //
2 | // NotificationService.h
3 | // mytest
4 | //
5 | // Created by coderXu on 16/9/22.
6 | // Copyright © 2016年 coderXu. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NotificationService : UNNotificationServiceExtension
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/mytest/NotificationService.m:
--------------------------------------------------------------------------------
1 | //
2 | // NotificationService.m
3 | // mytest
4 | //
5 | // Created by coderXu on 16/9/22.
6 | // Copyright © 2016年 coderXu. All rights reserved.
7 | //
8 | #define DDLOG(...) printf("%s\n",[[NSString stringWithFormat:__VA_ARGS__]UTF8String]);
9 |
10 | #import "NotificationService.h"
11 | #import
12 |
13 | @interface NotificationService ()
14 |
15 | @property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);
16 | @property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent;
17 |
18 | @end
19 |
20 | @implementation NotificationService
21 |
22 | - (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
23 | self.contentHandler = contentHandler;
24 | // copy发来的通知,开始做一些处理
25 | self.bestAttemptContent = [request.content mutableCopy];
26 |
27 | // Modify the notification content here...
28 | self.bestAttemptContent.title = [NSString stringWithFormat:@"%@ [modified]", self.bestAttemptContent.title];
29 |
30 |
31 | // 重写一些东西
32 | self.bestAttemptContent.title = @"我是标题";
33 | self.bestAttemptContent.subtitle = @"我是子标题";
34 | self.bestAttemptContent.body = @"来自徐不同";
35 |
36 | // 附件
37 | NSDictionary *dict = self.bestAttemptContent.userInfo;
38 | NSDictionary *notiDict = dict[@"aps"];
39 | NSString *imgUrl = [NSString stringWithFormat:@"%@",notiDict[@"imageAbsoluteString"]];
40 |
41 | // 这里添加一些点击事件,可以在收到通知的时候,添加,也可以在拦截通知的这个扩展中添加
42 |
43 | self.bestAttemptContent.categoryIdentifier = @"category1";
44 |
45 |
46 |
47 |
48 | if (!imgUrl.length) {
49 |
50 | self.contentHandler(self.bestAttemptContent);
51 |
52 | }
53 |
54 |
55 |
56 | [self loadAttachmentForUrlString:imgUrl withType:@"png" completionHandle:^(UNNotificationAttachment *attach) {
57 |
58 | if (attach) {
59 | self.bestAttemptContent.attachments = [NSArray arrayWithObject:attach];
60 | }
61 | self.contentHandler(self.bestAttemptContent);
62 |
63 | }];
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 | }
76 |
77 | - (void)serviceExtensionTimeWillExpire {
78 | // Called just before the extension will be terminated by the system.
79 | // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
80 | self.contentHandler(self.bestAttemptContent);
81 | }
82 |
83 |
84 | - (void)loadAttachmentForUrlString:(NSString *)urlStr
85 | withType:(NSString *)type
86 | completionHandle:(void(^)(UNNotificationAttachment *attach))completionHandler{
87 |
88 |
89 | __block UNNotificationAttachment *attachment = nil;
90 | NSURL *attachmentURL = [NSURL URLWithString:urlStr];
91 | NSString *fileExt = [self fileExtensionForMediaType:type];
92 |
93 | NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
94 | [[session downloadTaskWithURL:attachmentURL
95 | completionHandler:^(NSURL *temporaryFileLocation, NSURLResponse *response, NSError *error) {
96 | if (error != nil) {
97 | NSLog(@"%@", error.localizedDescription);
98 | } else {
99 | NSFileManager *fileManager = [NSFileManager defaultManager];
100 | NSURL *localURL = [NSURL fileURLWithPath:[temporaryFileLocation.path stringByAppendingString:fileExt]];
101 | [fileManager moveItemAtURL:temporaryFileLocation toURL:localURL error:&error];
102 |
103 | NSError *attachmentError = nil;
104 | attachment = [UNNotificationAttachment attachmentWithIdentifier:@"" URL:localURL options:nil error:&attachmentError];
105 | if (attachmentError) {
106 | NSLog(@"%@", attachmentError.localizedDescription);
107 | }
108 | }
109 |
110 | completionHandler(attachment);
111 |
112 |
113 | }] resume];
114 |
115 |
116 |
117 | }
118 | - (NSString *)fileExtensionForMediaType:(NSString *)type {
119 | NSString *ext = type;
120 |
121 |
122 | if ([type isEqualToString:@"image"]) {
123 | ext = @"jpg";
124 | }
125 |
126 | if ([type isEqualToString:@"video"]) {
127 | ext = @"mp4";
128 | }
129 |
130 | if ([type isEqualToString:@"audio"]) {
131 | ext = @"mp3";
132 | }
133 |
134 | return [@"." stringByAppendingString:ext];
135 | }
136 |
137 |
138 |
139 |
140 |
141 |
142 | @end
143 |
--------------------------------------------------------------------------------