Forráskód Böngészése

ios push

ios push
linbing 4 éve
szülő
commit
2891cce7a2

+ 37 - 0
.gitignore

@@ -0,0 +1,37 @@
+.idea/
+.vagrant/
+.sconsign.dblite
+.svn/
+
+.DS_Store
+*.swp
+profile
+
+DerivedData/
+build/
+GeneratedPluginRegistrant.h
+GeneratedPluginRegistrant.m
+
+.generated/
+
+*.pbxuser
+*.mode1v3
+*.mode2v3
+*.perspectivev3
+
+!default.pbxuser
+!default.mode1v3
+!default.mode2v3
+!default.perspectivev3
+
+xcuserdata
+
+*.moved-aside
+
+*.pyc
+*sync/
+Icon?
+.tags*
+
+/Flutter/Generated.xcconfig
+/Flutter/flutter_export_environment.sh

+ 4 - 0
Classes/FlutterAliyunPushPlugin.h

@@ -0,0 +1,4 @@
+#import <Flutter/Flutter.h>
+
+@interface FlutterAliyunPushPlugin : NSObject<FlutterPlugin>
+@end

+ 20 - 0
Classes/FlutterAliyunPushPlugin.m

@@ -0,0 +1,20 @@
+#import "FlutterAliyunPushPlugin.h"
+
+@implementation FlutterAliyunPushPlugin
++ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
+  FlutterMethodChannel* channel = [FlutterMethodChannel
+      methodChannelWithName:@"flutter_aliyun_push"
+            binaryMessenger:[registrar messenger]];
+  FlutterAliyunPushPlugin* instance = [[FlutterAliyunPushPlugin alloc] init];
+  [registrar addMethodCallDelegate:instance channel:channel];
+}
+
+- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
+  if ([@"getPlatformVersion" isEqualToString:call.method]) {
+    result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]);
+  } else {
+    result(FlutterMethodNotImplemented);
+  }
+}
+
+@end

+ 1 - 0
example/ios/Flutter/.last_build_id

@@ -0,0 +1 @@
+f516fc0b0ba45789b5b7fb462653d400

+ 1 - 0
example/ios/Flutter/Debug.xcconfig

@@ -1 +1,2 @@
+#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
 #include "Generated.xcconfig"

+ 1 - 0
example/ios/Flutter/Release.xcconfig

@@ -1 +1,2 @@
+#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
 #include "Generated.xcconfig"

+ 41 - 0
example/ios/Podfile

@@ -0,0 +1,41 @@
+# Uncomment this line to define a global platform for your project
+# platform :ios, '9.0'
+
+# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
+source 'https://github.com/CocoaPods/Specs.git'
+source 'https://github.com/aliyun/aliyun-specs.git'
+
+ENV['COCOAPODS_DISABLE_STATS'] = 'true'
+
+project 'Runner', {
+  'Debug' => :debug,
+  'Profile' => :release,
+  'Release' => :release,
+}
+
+def flutter_root
+  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
+  unless File.exist?(generated_xcode_build_settings_path)
+    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
+  end
+
+  File.foreach(generated_xcode_build_settings_path) do |line|
+    matches = line.match(/FLUTTER_ROOT\=(.*)/)
+    return matches[1].strip if matches
+  end
+  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
+end
+
+require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
+
+flutter_ios_podfile_setup
+
+target 'Runner' do
+  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
+end
+
+post_install do |installer|
+  installer.pods_project.targets.each do |target|
+    flutter_additional_ios_build_settings(target)
+  end
+end

+ 42 - 0
example/ios/Podfile.lock

@@ -0,0 +1,42 @@
+PODS:
+  - AlicloudPush (1.9.9.4):
+    - AlicloudUT
+    - AlicloudUtils
+  - AlicloudUT (5.2.0.16):
+    - AlicloudUTDID
+  - AlicloudUTDID (1.5.0.94)
+  - AlicloudUtils (1.3.9):
+    - AlicloudUTDID
+  - Flutter (1.0.0)
+  - flutter_aliyun_push (0.0.1):
+    - AlicloudPush
+    - Flutter
+
+DEPENDENCIES:
+  - Flutter (from `Flutter`)
+  - flutter_aliyun_push (from `.symlinks/plugins/flutter_aliyun_push/ios`)
+
+SPEC REPOS:
+  https://github.com/aliyun/aliyun-specs.git:
+    - AlicloudPush
+    - AlicloudUT
+    - AlicloudUTDID
+    - AlicloudUtils
+
+EXTERNAL SOURCES:
+  Flutter:
+    :path: Flutter
+  flutter_aliyun_push:
+    :path: ".symlinks/plugins/flutter_aliyun_push/ios"
+
+SPEC CHECKSUMS:
+  AlicloudPush: 221d1de5f4b94e41b725a4a263626b22beb05016
+  AlicloudUT: 6d1cf30d57d096b7e9bb4b069dd0ba6ad59a3338
+  AlicloudUTDID: 7323c443dcdf9a73e2224dc6ce51703671d7a765
+  AlicloudUtils: 66e0ba6ece62d7dd05e9dd95674b2c7811624c2f
+  Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
+  flutter_aliyun_push: 7790e7185d850c5d5e3738ec10acc7d97e526958
+
+PODFILE CHECKSUM: 183fbb86437e4babda9d740acb62ce19d41da64f
+
+COCOAPODS: 1.10.0

+ 94 - 14
example/ios/Runner.xcodeproj/project.pbxproj

@@ -3,7 +3,7 @@
 	archiveVersion = 1;
 	classes = {
 	};
-	objectVersion = 46;
+	objectVersion = 51;
 	objects = {
 
 /* Begin PBXBuildFile section */
@@ -14,6 +14,7 @@
 		97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
 		97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
 		97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
+		A1F59FF8F8711F613CA45AD8 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 11CBBCF223C0C14144EEBE84 /* libPods-Runner.a */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXCopyFilesBuildPhase section */
@@ -30,9 +31,13 @@
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
+		11CBBCF223C0C14144EEBE84 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
 		1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
 		1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
+		1850322378931CB5BC7B5475 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
+		37C4894AAD3BF3FD386B29A7 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
 		3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
+		51492F6C86F113DB37790789 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
 		7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
 		7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
 		7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
@@ -44,6 +49,7 @@
 		97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
 		97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
 		97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+		A967E8D425B13CE000ADDB0E /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -51,12 +57,21 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				A1F59FF8F8711F613CA45AD8 /* libPods-Runner.a in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+		8B974E9C12354E2B443F1D26 /* Frameworks */ = {
+			isa = PBXGroup;
+			children = (
+				11CBBCF223C0C14144EEBE84 /* libPods-Runner.a */,
+			);
+			name = Frameworks;
+			sourceTree = "<group>";
+		};
 		9740EEB11CF90186004384FC /* Flutter */ = {
 			isa = PBXGroup;
 			children = (
@@ -74,7 +89,8 @@
 				9740EEB11CF90186004384FC /* Flutter */,
 				97C146F01CF9000F007C117D /* Runner */,
 				97C146EF1CF9000F007C117D /* Products */,
-				CF3B75C9A7D2FA2A4C99F110 /* Frameworks */,
+				B76FEA952847E92D97A47727 /* Pods */,
+				8B974E9C12354E2B443F1D26 /* Frameworks */,
 			);
 			sourceTree = "<group>";
 		};
@@ -89,6 +105,7 @@
 		97C146F01CF9000F007C117D /* Runner */ = {
 			isa = PBXGroup;
 			children = (
+				A967E8D425B13CE000ADDB0E /* Runner.entitlements */,
 				7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
 				7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
 				97C146FA1CF9000F007C117D /* Main.storyboard */,
@@ -110,6 +127,16 @@
 			name = "Supporting Files";
 			sourceTree = "<group>";
 		};
+		B76FEA952847E92D97A47727 /* Pods */ = {
+			isa = PBXGroup;
+			children = (
+				1850322378931CB5BC7B5475 /* Pods-Runner.debug.xcconfig */,
+				37C4894AAD3BF3FD386B29A7 /* Pods-Runner.release.xcconfig */,
+				51492F6C86F113DB37790789 /* Pods-Runner.profile.xcconfig */,
+			);
+			path = Pods;
+			sourceTree = "<group>";
+		};
 /* End PBXGroup section */
 
 /* Begin PBXNativeTarget section */
@@ -117,12 +144,14 @@
 			isa = PBXNativeTarget;
 			buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
 			buildPhases = (
+				EAB0A8E7AC9571400963E1D6 /* [CP] Check Pods Manifest.lock */,
 				9740EEB61CF901F6004384FC /* Run Script */,
 				97C146EA1CF9000F007C117D /* Sources */,
 				97C146EB1CF9000F007C117D /* Frameworks */,
 				97C146EC1CF9000F007C117D /* Resources */,
 				9705A1C41CF9048500538489 /* Embed Frameworks */,
 				3B06AD1E1E4923F5004D2608 /* Thin Binary */,
+				1A0A377D526F6C54B8851D02 /* [CP] Embed Pods Frameworks */,
 			);
 			buildRules = (
 			);
@@ -180,6 +209,23 @@
 /* End PBXResourcesBuildPhase section */
 
 /* Begin PBXShellScriptBuildPhase section */
+		1A0A377D526F6C54B8851D02 /* [CP] Embed Pods Frameworks */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputFileListPaths = (
+				"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
+			);
+			name = "[CP] Embed Pods Frameworks";
+			outputFileListPaths = (
+				"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
+			showEnvVarsInLog = 0;
+		};
 		3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
 			isa = PBXShellScriptBuildPhase;
 			buildActionMask = 2147483647;
@@ -208,6 +254,28 @@
 			shellPath = /bin/sh;
 			shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
 		};
+		EAB0A8E7AC9571400963E1D6 /* [CP] Check Pods Manifest.lock */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputFileListPaths = (
+			);
+			inputPaths = (
+				"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
+				"${PODS_ROOT}/Manifest.lock",
+			);
+			name = "[CP] Check Pods Manifest.lock";
+			outputFileListPaths = (
+			);
+			outputPaths = (
+				"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n    # print error to STDERR\n    echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n    exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
+			showEnvVarsInLog = 0;
+		};
 /* End PBXShellScriptBuildPhase section */
 
 /* Begin PBXSourcesBuildPhase section */
@@ -245,7 +313,6 @@
 /* Begin XCBuildConfiguration section */
 		249021D3217E4FDB00AE95B9 /* Profile */ = {
 			isa = XCBuildConfiguration;
-			baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				CLANG_ANALYZER_NONNULL = YES;
@@ -285,7 +352,7 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
 				MTL_ENABLE_DEBUG_INFO = NO;
 				SDKROOT = iphoneos;
 				SUPPORTED_PLATFORMS = iphoneos;
@@ -299,19 +366,24 @@
 			baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+				CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
 				CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+				DEVELOPMENT_TEAM = ZFPP7C44Q5;
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(PROJECT_DIR)/Flutter",
 				);
 				INFOPLIST_FILE = Runner/Info.plist;
-				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+				);
 				LIBRARY_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(PROJECT_DIR)/Flutter",
 				);
-				PRODUCT_BUNDLE_IDENTIFIER = com.flutter.flutterAliyunPushExample;
+				PRODUCT_BUNDLE_IDENTIFIER = com.yqlss.www.e7lang;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				VERSIONING_SYSTEM = "apple-generic";
 			};
@@ -319,7 +391,6 @@
 		};
 		97C147031CF9000F007C117D /* Debug */ = {
 			isa = XCBuildConfiguration;
-			baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				CLANG_ANALYZER_NONNULL = YES;
@@ -365,7 +436,7 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
 				MTL_ENABLE_DEBUG_INFO = YES;
 				ONLY_ACTIVE_ARCH = YES;
 				SDKROOT = iphoneos;
@@ -375,7 +446,6 @@
 		};
 		97C147041CF9000F007C117D /* Release */ = {
 			isa = XCBuildConfiguration;
-			baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				CLANG_ANALYZER_NONNULL = YES;
@@ -415,7 +485,7 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
 				MTL_ENABLE_DEBUG_INFO = NO;
 				SDKROOT = iphoneos;
 				SUPPORTED_PLATFORMS = iphoneos;
@@ -429,19 +499,24 @@
 			baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+				CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
 				CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+				DEVELOPMENT_TEAM = ZFPP7C44Q5;
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(PROJECT_DIR)/Flutter",
 				);
 				INFOPLIST_FILE = Runner/Info.plist;
-				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+				);
 				LIBRARY_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(PROJECT_DIR)/Flutter",
 				);
-				PRODUCT_BUNDLE_IDENTIFIER = com.flutter.flutterAliyunPushExample;
+				PRODUCT_BUNDLE_IDENTIFIER = com.yqlss.www.e7lang;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				VERSIONING_SYSTEM = "apple-generic";
 			};
@@ -452,19 +527,24 @@
 			baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+				CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
 				CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+				DEVELOPMENT_TEAM = ZFPP7C44Q5;
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(PROJECT_DIR)/Flutter",
 				);
 				INFOPLIST_FILE = Runner/Info.plist;
-				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+				LD_RUNPATH_SEARCH_PATHS = (
+					"$(inherited)",
+					"@executable_path/Frameworks",
+				);
 				LIBRARY_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(PROJECT_DIR)/Flutter",
 				);
-				PRODUCT_BUNDLE_IDENTIFIER = com.flutter.flutterAliyunPushExample;
+				PRODUCT_BUNDLE_IDENTIFIER = com.yqlss.www.e7lang;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				VERSIONING_SYSTEM = "apple-generic";
 			};

+ 3 - 0
example/ios/Runner.xcworkspace/contents.xcworkspacedata

@@ -4,4 +4,7 @@
    <FileRef
       location = "group:Runner.xcodeproj">
    </FileRef>
+   <FileRef
+      location = "group:Pods/Pods.xcodeproj">
+   </FileRef>
 </Workspace>

+ 38 - 1
example/ios/Runner/AppDelegate.m

@@ -1,13 +1,50 @@
 #import "AppDelegate.h"
 #import "GeneratedPluginRegistrant.h"
+#import <flutter_aliyun_push/FlutterAliyunPushPlugin.h>
 
 @implementation AppDelegate
 
 - (BOOL)application:(UIApplication *)application
     didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
-  [GeneratedPluginRegistrant registerWithRegistry:self];
+    
+    [FlutterAliyunPushPlugin initKey:@"333354905" appSecret:@"eeb5f0e8b09442b29b64658a0c5fa9b7"];
+    
+    [GeneratedPluginRegistrant registerWithRegistry:self];
+
+    
   // Override point for customization after application launch.
   return [super application:application didFinishLaunchingWithOptions:launchOptions];
 }
 
+/*
+ *  APNs注册成功回调,将返回的deviceToken上传到CloudPush服务器
+ */
+//- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
+//    NSLog(@"appdelegate didRegisterForRemoteNotificationsWithDeviceToken ---");
+//    [FlutterAliyunPushPlugin application:application
+//        didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
+//}
+
+/*
+ *  APNs注册失败回调
+ */
+//- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
+//    NSLog(@"didFailToRegisterForRemoteNotificationsWithError %@", error);
+//}
+
+
+/*
+ *  App处于启动状态时,通知打开回调
+ */
+//- (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary*)userInfo {
+//    NSLog(@"didReceiveRemoteNotification------- Receive one notification.");
+////    [FlutterAliyunPushPlugin application:application didReceiveRemoteNotification:userInfo];
+//
+//}
+
+#pragma mark 禁止横屏
+- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
+    return UIInterfaceOrientationMaskPortrait;
+}
+
 @end

+ 6 - 0
example/ios/Runner/Info.plist

@@ -4,6 +4,8 @@
 <dict>
 	<key>CFBundleDevelopmentRegion</key>
 	<string>$(DEVELOPMENT_LANGUAGE)</string>
+	<key>CFBundleDisplayName</key>
+	<string>test</string>
 	<key>CFBundleExecutable</key>
 	<string>$(EXECUTABLE_NAME)</string>
 	<key>CFBundleIdentifier</key>
@@ -22,6 +24,10 @@
 	<string>$(FLUTTER_BUILD_NUMBER)</string>
 	<key>LSRequiresIPhoneOS</key>
 	<true/>
+	<key>UIBackgroundModes</key>
+	<array>
+		<string>remote-notification</string>
+	</array>
 	<key>UILaunchStoryboardName</key>
 	<string>LaunchScreen</string>
 	<key>UIMainStoryboardFile</key>

+ 8 - 0
example/ios/Runner/Runner.entitlements

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>aps-environment</key>
+	<string>development</string>
+</dict>
+</plist>

+ 8 - 6
example/lib/main.dart

@@ -1,4 +1,5 @@
 import 'dart:convert';
+import 'dart:core' ;
 
 import 'package:flutter/material.dart';
 import 'dart:async';
@@ -21,6 +22,7 @@ class _MyAppState extends State<MyApp> {
   @override
   void initState() {
     super.initState();
+    print("0000000000000000000000000000000"); 
     initPlatformState();
   }
 
@@ -30,17 +32,17 @@ class _MyAppState extends State<MyApp> {
     String platformVersion;
     // Platform messages may fail, so we use a try/catch PlatformException.
     try {
-      platformVersion = await FlutterAliyunPush.platformVersion;
+      // platformVersion = await FlutterAliyunPush.platformVersion;
 //      await FlutterAliyunPush.initPush;
     } on PlatformException {
       platformVersion = 'Failed to get platform version.';
     }
 
-    FlutterAliyunPush.reigistOnRegistSuccess((msg){
-//      platformVersion = msg;
-//      setState(() {
-//        _platformVersion = platformVersion;
-//      });
+    FlutterAliyunPush.reigistOnRegistSuccess((msg){ 
+     platformVersion = 'reigistOnRegistSuccess';
+     setState(() {
+       _platformVersion = platformVersion;
+     });
     });
 
     FlutterAliyunPush.reigistOnReceiveNotification((msg){

+ 26 - 0
flutter_aliyun_push.podspec

@@ -0,0 +1,26 @@
+#
+# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
+# Run `pod lib lint flutter_aliyun_push.podspec' to validate before publishing.
+#
+Pod::Spec.new do |s|
+  s.name             = 'flutter_aliyun_push'
+  s.version          = '0.0.1'
+  s.summary          = 'A new flutter plugin project.'
+  s.description      = <<-DESC
+A new flutter plugin project.
+                       DESC
+  s.homepage         = 'http://example.com'
+  s.license          = { :file => '../LICENSE' }
+  s.author           = { 'Your Company' => 'email@example.com' }
+  s.source           = { :path => '.' }
+  s.source_files = 'Classes/**/*'
+  s.public_header_files = 'Classes/**/*.h'
+  s.dependency 'Flutter'
+  s.platform = :ios, '8.0'
+
+  # Flutter.framework does not contain a i386 slice.
+  s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
+  
+  #s.frameworks =
+  s.dependency 'AlicloudPush'
+end

+ 9 - 0
ios/Classes/FlutterAliyunPushPlugin.h

@@ -1,4 +1,13 @@
 #import <Flutter/Flutter.h>
 
 @interface FlutterAliyunPushPlugin : NSObject<FlutterPlugin>
+
+extern NSString * AliyunAppKey;
+extern NSString * AliyunAppSecret;
+
+@property (nonatomic, strong) FlutterMethodChannel *channel;
+
++(void)initKey:(NSString *) appkey appSecret:(NSString *) appSecret ;
+
+
 @end

+ 292 - 5
ios/Classes/FlutterAliyunPushPlugin.m

@@ -1,20 +1,307 @@
 #import "FlutterAliyunPushPlugin.h"
+#import <CloudPushSDK/CloudPushSDK.h>
+// iOS 10 notification
+#import <UserNotifications/UserNotifications.h>
+#import <Flutter/Flutter.h>
+
+NSString * AliyunAppKey = @"";
+NSString * AliyunAppSecret = @"";
+
+const static NSString * onPushRegistSuccess = @"onPushRegistSuccess";
+const static NSString * onPushRegistError = @"onPushRegistError";
+const static NSString * onReceiverNotification = @"onReceiverNotification";
+const static NSString * onReceiverMessage = @"onReceiverMessage";
+
+@implementation FlutterAliyunPushPlugin {
+    NSDictionary *_launchNotification;
+}
+
++(void)initKey:(NSString *) appkey appSecret:(NSString *) appSecret {
+    AliyunAppKey = appkey;
+    AliyunAppSecret = appSecret;
+}
 
-@implementation FlutterAliyunPushPlugin
 + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
-  FlutterMethodChannel* channel = [FlutterMethodChannel
-      methodChannelWithName:@"flutter_aliyun_push"
+  
+    FlutterMethodChannel* channel = [FlutterMethodChannel
+      methodChannelWithName:@"aliyun_push"
             binaryMessenger:[registrar messenger]];
-  FlutterAliyunPushPlugin* instance = [[FlutterAliyunPushPlugin alloc] init];
-  [registrar addMethodCallDelegate:instance channel:channel];
+
+    FlutterAliyunPushPlugin* instance = [[FlutterAliyunPushPlugin alloc] init];
+    instance.channel = channel;
+    
+   
+    [registrar addMethodCallDelegate:instance channel:channel];
+    [registrar addApplicationDelegate:instance];
 }
 
+
+
+
+-(void) callFlutter:(NSString *)eventName withDatas:(id _Nullable) datas {
+    if(_channel == nil) {
+        return;
+    }
+    
+    [_channel invokeMethod:eventName arguments:datas];
+    
+}
+ 
+
+
 - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
   if ([@"getPlatformVersion" isEqualToString:call.method]) {
     result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]);
+      
   } else {
     result(FlutterMethodNotImplemented);
   }
 }
 
+
+
+/**
+ 初始化推送
+ */
+-(void) initPush:(UIApplication *)application
+    launchOptions:(NSDictionary *)launchOptions  {
+    
+    
+    // APNs注册,获取deviceToken并上报
+    [self registerAPNS:application];
+    // 初始化SDK
+    [self initCloudPush:AliyunAppKey appSecret:AliyunAppSecret];
+    
+    // 监听推送通道打开动作
+    [self listenerOnChannelOpened];
+    
+    // 监听推送消息到达
+    [self registerMessageReceive];
+    
+    
+    // 点击通知将App从关闭状态启动时,将通知打开回执上报
+    [CloudPushSDK sendNotificationAck:launchOptions];
+}
+
+
+- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
+    NSLog(@"plugin didRegisterForRemoteNotificationsWithDeviceToken ---");
+    [CloudPushSDK registerDevice:deviceToken withCallback:^(CloudPushCallbackResult *res) {
+        if (res.success) {
+            NSLog(@"Register deviceToken success, deviceToken: %@", [CloudPushSDK getApnsDeviceToken]);
+        } else {
+            NSLog(@"Register deviceToken failed, error: %@", res.error);
+        }
+    }];
+    
+}
+
+
+/*
+ *  APNs注册失败回调
+ */
+- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
+    NSLog(@"didFailToRegisterForRemoteNotificationsWithError --- %@", error);
+}
+
+#pragma mark - AppDelegate
+
+//- (void)applicationDidBecomeActive:(UIApplication *)application {
+//    NSLog(@"FlutterAliyunPushPlugin applicationDidBecomeActive----");
+//}
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+    NSLog(@"FlutterAliyunPushPlugin didFinishLaunchingWithOptions----");
+    [self initPush:application launchOptions:launchOptions];
+    
+    
+     if (launchOptions != nil) {
+        _launchNotification = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];
+    }
+    
+    if ([launchOptions valueForKey:UIApplicationLaunchOptionsLocalNotificationKey]) {
+        NSLog(@"launchOptions has Notification----");
+        UILocalNotification *localNotification = [launchOptions valueForKey:UIApplicationLaunchOptionsLocalNotificationKey];
+        NSMutableDictionary *localNotificationEvent = @{}.mutableCopy;
+        localNotificationEvent[@"content"] = localNotification.alertBody;
+        localNotificationEvent[@"badge"] = @(localNotification.applicationIconBadgeNumber);
+        localNotificationEvent[@"extras"] = localNotification.userInfo;
+        localNotificationEvent[@"fireTime"] = [NSNumber numberWithLong:[localNotification.fireDate timeIntervalSince1970] * 1000];
+        localNotificationEvent[@"soundName"] = [localNotification.soundName isEqualToString:UILocalNotificationDefaultSoundName] ? @"" : localNotification.soundName;
+        
+        if (@available(iOS 8.2, *)) {
+            localNotificationEvent[@"title"] = localNotification.alertTitle;
+        }
+        _launchNotification = localNotificationEvent;
+    }
+    //[self performSelector:@selector(addNotificationWithDateTrigger) withObject:nil afterDelay:2];
+    return YES;
+}
+
+
+//在后台未被干掉收到消息
+- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler {
+    NSLog(@"didReceiveRemoteNotification------- Receive one notification.");
+    // 取得APNS通知内容
+    NSDictionary *aps = [userInfo valueForKey:@"aps"];
+    // 内容
+    NSString *content = [aps valueForKey:@"alert"];
+    // badge数量
+    NSInteger badge = [[aps valueForKey:@"badge"] integerValue];
+    // 播放声音
+    NSString *sound = [aps valueForKey:@"sound"];
+    // 取得Extras字段内容
+    NSString *Extras = [userInfo valueForKey:@"Extras"]; //服务端中Extras字段,key是自己定义的
+    NSLog(@"content = [%@], badge = [%ld], sound = [%@], Extras = [%@]",
+          content, (long)badge, sound, Extras);
+
+
+    [self callFlutter:onReceiverNotification withDatas:userInfo];
+    
+    // iOS badge 清0
+    application.applicationIconBadgeNumber = 0;
+
+    
+    // 通知打开回执上报
+    [CloudPushSDK sendNotificationAck:userInfo];
+
+}
+
+
+#pragma mark APNs Register
+/**
+ *    向APNs注册,获取deviceToken用于推送
+ *
+ *    @param     application
+ */
+- (void)registerAPNS:(UIApplication *)application {
+    float systemVersionNum = [[[UIDevice currentDevice] systemVersion] floatValue];
+    if (systemVersionNum >= 10.0) {
+        // iOS 10 notifications
+        UNUserNotificationCenter* _notificationCenter = [UNUserNotificationCenter currentNotificationCenter];
+        // 创建category,并注册到通知中心
+        [self createCustomNotificationCategory];
+        // 请求推送权限
+        [_notificationCenter requestAuthorizationWithOptions:UNAuthorizationOptionAlert | UNAuthorizationOptionBadge | UNAuthorizationOptionSound completionHandler:^(BOOL granted, NSError * _Nullable error) {
+            if (granted) {
+                // granted
+                NSLog(@"User authored notification.");
+                // 向APNs注册,获取deviceToken
+                dispatch_async(dispatch_get_main_queue(), ^{
+                    [application registerForRemoteNotifications];
+                });
+            } else {
+                // not granted
+                NSLog(@"User denied notification.");
+            }
+        }];
+    } else if (systemVersionNum >= 8.0) {
+        // iOS 8 Notifications
+        #pragma clang diagnostic push
+        #pragma clang diagnostic ignored"-Wdeprecated-declarations"
+                [application registerUserNotificationSettings:
+                 [UIUserNotificationSettings settingsForTypes:
+                  (UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge)
+                                                   categories:nil]];
+                [application registerForRemoteNotifications];
+        #pragma clang diagnostic pop
+            } else {
+                // iOS < 8 Notifications
+        #pragma clang diagnostic push
+        #pragma clang diagnostic ignored"-Wdeprecated-declarations"
+                [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
+                 (UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
+        #pragma clang diagnostic pop
+    }
+}
+
+/**
+ *  创建并注册通知category(iOS 10+)
+ */
+- (void)createCustomNotificationCategory {
+    // 自定义`action1`和`action2`
+    UNNotificationAction *action1 = [UNNotificationAction actionWithIdentifier:@"action1" title:@"test1" options: UNNotificationActionOptionNone];
+    UNNotificationAction *action2 = [UNNotificationAction actionWithIdentifier:@"action2" title:@"test2" options: UNNotificationActionOptionNone];
+    // 创建id为`test_category`的category,并注册两个action到category
+    // UNNotificationCategoryOptionCustomDismissAction表明可以触发通知的dismiss回调
+    UNNotificationCategory *category = [UNNotificationCategory categoryWithIdentifier:@"test_category" actions:@[action1, action2] intentIdentifiers:@[] options:
+                                        UNNotificationCategoryOptionCustomDismissAction];
+    // 注册category到通知中心
+    UNUserNotificationCenter* _notificationCenter = [UNUserNotificationCenter currentNotificationCenter];
+    [_notificationCenter setNotificationCategories:[NSSet setWithObjects:category, nil]];
+}
+
+#pragma mark SDK Init
+- (void)initCloudPush:(NSString*)appkey appSecret:(NSString*)appSecret {
+    NSLog(@"start initCloudPush----");
+    // 正式上线建议关闭
+    [CloudPushSDK turnOnDebug];
+    // SDK初始化,手动输出appKey和appSecret
+    [CloudPushSDK asyncInit:appkey appSecret:appSecret callback:^(CloudPushCallbackResult *res) {
+        if (res.success) {
+            NSLog(@"Push SDK init success, deviceId: %@.", [CloudPushSDK getDeviceId]);
+            [self callFlutter:onPushRegistSuccess withDatas:nil];
+        } else {
+            NSLog(@"Push SDK init failed, error: %@", res.error);
+            [_channel invokeMethod:onPushRegistError arguments:res.error];
+            [self callFlutter:onPushRegistError withDatas:res.error];
+        }
+    }];
+    
+   
+}
+
+/**
+ *    注册推送通道打开监听
+ */
+- (void)listenerOnChannelOpened {
+    [[NSNotificationCenter defaultCenter] addObserver:self
+                                             selector:@selector(onChannelOpened:)
+                                                 name:@"CCPDidChannelConnectedSuccess"
+                                               object:nil];
+}
+
+/**
+ *    推送通道打开回调
+ *
+ *    @param     notification
+ */
+- (void)onChannelOpened:(NSNotification *)notification {
+    NSLog(@"消息通道建立成功-----");
+}
+
+#pragma mark Receive Message
+/**
+ *    @brief    注册推送消息到来监听
+ */
+- (void)registerMessageReceive {
+    [[NSNotificationCenter defaultCenter] addObserver:self
+                                             selector:@selector(onMessageReceived:)
+                                                 name:@"CCPDidReceiveMessageNotification"
+                                               object:nil];
+}
+
+/**
+ *    处理在前台到来推送消息
+ *
+ *    @param     notification
+ */
+- (void)onMessageReceived:(NSNotification *)notification {
+    NSLog(@"onMessageReceived------ Receive one message!");
+   
+    CCPSysMessage *message = [notification object];
+    NSString *title = [[NSString alloc] initWithData:message.title encoding:NSUTF8StringEncoding];
+    NSString *body = [[NSString alloc] initWithData:message.body encoding:NSUTF8StringEncoding];
+    NSLog(@"Receive message title: %@, content: %@.", title, body);
+
+    if(![NSThread isMainThread]) {
+        dispatch_async(dispatch_get_main_queue(), ^{
+            [self callFlutter:onReceiverMessage withDatas:body];
+        });
+    } else {
+        [self callFlutter:onReceiverMessage withDatas:body];
+    }
+}
+
+
 @end

+ 7 - 4
ios/flutter_aliyun_push.podspec

@@ -5,9 +5,9 @@
 Pod::Spec.new do |s|
   s.name             = 'flutter_aliyun_push'
   s.version          = '0.0.1'
-  s.summary          = 'A new Flutter plugin.'
+  s.summary          = 'A new flutter plugin project.'
   s.description      = <<-DESC
-A new Flutter plugin.
+A new flutter plugin project.
                        DESC
   s.homepage         = 'http://example.com'
   s.license          = { :file => '../LICENSE' }
@@ -18,6 +18,9 @@ A new Flutter plugin.
   s.dependency 'Flutter'
   s.platform = :ios, '8.0'
 
-  # Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported.
-  s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' }
+  # Flutter.framework does not contain a i386 slice.
+  s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
+  
+  #s.frameworks =
+  s.dependency 'AlicloudPush'
 end

+ 20 - 2
lib/flutter_aliyun_push.dart

@@ -1,5 +1,6 @@
 import 'dart:async';
 import 'dart:convert';
+import 'dart:io';
 import 'package:flutter/services.dart';
 import 'push_message.dart';
 
@@ -9,6 +10,9 @@ typedef OnReceiveNotification = Function(PushNotification);
 class FlutterAliyunPush {
   static const MethodChannel _channel =
       const MethodChannel('aliyun_push');
+
+  static const EventChannel eventChannel = EventChannel("App/Event/Channel", const StandardMethodCodec());
+      
   static bool registCallback = false;
 
   static Function onRegistSuccess;
@@ -29,7 +33,10 @@ class FlutterAliyunPush {
     if(registCallback) {
       return;
     }
+    print("registCallHandler---------------");
     registCallback = true;
+
+
     _channel.setMethodCallHandler((call) {
       print("setMethodCallHandler:"+call.method);
       switch(call.method) {
@@ -47,7 +54,18 @@ class FlutterAliyunPush {
           if(onReceiveNotification != null) {
             var param = call.arguments;
             if(param != null) {
-              param = PushNotification.fromJson(json.decode(param));
+              if(Platform.isIOS) {
+                if(param['aps'] != null && param['aps']['alert'] != null) {
+                  var content = param['aps']['alert'];
+                  var title = content['title'];
+                  String body = content['body']; 
+                  param = PushNotification(title,body,param);
+                }
+
+
+              }else {
+                 param = PushNotification.fromJson(json.decode(param));
+              }
             }
             onReceiveNotification(param);
           }
@@ -63,7 +81,7 @@ class FlutterAliyunPush {
           break;
       }
     });
-    _channel.invokeMethod('initPush');
+    // _channel.invokeMethod('initPush');
   }
 
   static void  reigistOnRegistSuccess(Function callback) {