1 | +// !$*UTF8*$! | ||
2 | +{ | ||
3 | + archiveVersion = 1; | ||
4 | + classes = { | ||
5 | + }; | ||
6 | + objectVersion = 46; | ||
7 | + objects = { | ||
8 | + | ||
9 | +/* Begin PBXBuildFile section */ | ||
10 | + 844544B81EFA5EE7004BDC50 /* YouaiSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 844544B71EFA5EE7004BDC50 /* YouaiSDK.framework */; settings = {ASSET_TAGS = (); }; }; | ||
11 | + 845D18221C8D778400F27EB9 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 845D181B1C8D778400F27EB9 /* Images.xcassets */; settings = {ASSET_TAGS = (); }; }; | ||
12 | + 846BD2241EE9342700E89A1D /* pool_setting in Resources */ = {isa = PBXBuildFile; fileRef = 846BD21F1EE9342700E89A1D /* pool_setting */; settings = {ASSET_TAGS = (); }; }; | ||
13 | + 846BD2251EE9342700E89A1D /* PoolSdk.m in Sources */ = {isa = PBXBuildFile; fileRef = 846BD2211EE9342700E89A1D /* PoolSdk.m */; settings = {ASSET_TAGS = (); }; }; | ||
14 | + 846BD2261EE9342700E89A1D /* SDKInterface.m in Sources */ = {isa = PBXBuildFile; fileRef = 846BD2231EE9342700E89A1D /* SDKInterface.m */; settings = {ASSET_TAGS = (); }; }; | ||
15 | + 847EE5E21EE9007E003A4B7B /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 847EE5E11EE9007E003A4B7B /* MainViewController.m */; settings = {ASSET_TAGS = (); }; }; | ||
16 | + 8484E4F51EE7E0DC00B402D1 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8484E4F21EE7E0DC00B402D1 /* AppDelegate.m */; settings = {ASSET_TAGS = (); }; }; | ||
17 | + 8484E4F61EE7E0DC00B402D1 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8484E4F41EE7E0DC00B402D1 /* ViewController.m */; settings = {ASSET_TAGS = (); }; }; | ||
18 | + 8484E4FA1EE7E15B00B402D1 /* TrackingIO.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8484E4F91EE7E15B00B402D1 /* TrackingIO.a */; settings = {ASSET_TAGS = (); }; }; | ||
19 | + 8484E4FC1EE7E1D800B402D1 /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8484E4FB1EE7E1D800B402D1 /* libsqlite3.dylib */; }; | ||
20 | + 8484E4FE1EE7E1F700B402D1 /* CoreTelephony.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8484E4FD1EE7E1F700B402D1 /* CoreTelephony.framework */; }; | ||
21 | + 8484E5001EE7E20C00B402D1 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8484E4FF1EE7E20C00B402D1 /* CFNetwork.framework */; }; | ||
22 | + 8484E5021EE7E21F00B402D1 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8484E5011EE7E21F00B402D1 /* UIKit.framework */; }; | ||
23 | + 8484E5041EE7E24400B402D1 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8484E5031EE7E24400B402D1 /* StoreKit.framework */; }; | ||
24 | + 8484E5061EE7E24A00B402D1 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8484E5051EE7E24A00B402D1 /* CoreMotion.framework */; }; | ||
25 | + 8484E5081EE7E25600B402D1 /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8484E5071EE7E25600B402D1 /* CoreText.framework */; }; | ||
26 | + 8484E50A1EE7E26200B402D1 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8484E5091EE7E26200B402D1 /* Security.framework */; }; | ||
27 | + 8484E50C1EE7E27100B402D1 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8484E50B1EE7E27100B402D1 /* CoreGraphics.framework */; }; | ||
28 | + 8484E50E1EE7E28000B402D1 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8484E50D1EE7E28000B402D1 /* QuartzCore.framework */; }; | ||
29 | + 8484E5101EE7E29A00B402D1 /* libc++.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8484E50F1EE7E29A00B402D1 /* libc++.1.dylib */; }; | ||
30 | + 8484E5121EE7E2B800B402D1 /* libz.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8484E5111EE7E2B800B402D1 /* libz.1.dylib */; }; | ||
31 | + 8484E5141EE7E2DE00B402D1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8484E5131EE7E2DE00B402D1 /* Foundation.framework */; }; | ||
32 | + 8484E5161EE7E36800B402D1 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8484E5151EE7E36800B402D1 /* SystemConfiguration.framework */; }; | ||
33 | + 84C38CFC1EFCC7B50092D033 /* PoolSdk.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84C38CFB1EFCC7B50092D033 /* PoolSdk.framework */; settings = {ASSET_TAGS = (); }; }; | ||
34 | + BB5F3C8E1C1811BC00DA339D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BB5F3C8D1C1811BC00DA339D /* main.m */; }; | ||
35 | + BB5F3C971C1811BC00DA339D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BB5F3C951C1811BC00DA339D /* Main.storyboard */; }; | ||
36 | + BB5F3C9C1C1811BC00DA339D /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB5F3C9A1C1811BC00DA339D /* LaunchScreen.xib */; }; | ||
37 | + BB5F3CA81C1811BC00DA339D /* DemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = BB5F3CA71C1811BC00DA339D /* DemoTests.m */; }; | ||
38 | +/* End PBXBuildFile section */ | ||
39 | + | ||
40 | +/* Begin PBXContainerItemProxy section */ | ||
41 | + BB5F3CA21C1811BC00DA339D /* PBXContainerItemProxy */ = { | ||
42 | + isa = PBXContainerItemProxy; | ||
43 | + containerPortal = BB5F3C801C1811BC00DA339D /* Project object */; | ||
44 | + proxyType = 1; | ||
45 | + remoteGlobalIDString = BB5F3C871C1811BC00DA339D; | ||
46 | + remoteInfo = Demo; | ||
47 | + }; | ||
48 | +/* End PBXContainerItemProxy section */ | ||
49 | + | ||
50 | +/* Begin PBXCopyFilesBuildPhase section */ | ||
51 | + 84398BFB1C4C83EC0082D774 /* Embed Frameworks */ = { | ||
52 | + isa = PBXCopyFilesBuildPhase; | ||
53 | + buildActionMask = 2147483647; | ||
54 | + dstPath = ""; | ||
55 | + dstSubfolderSpec = 10; | ||
56 | + files = ( | ||
57 | + ); | ||
58 | + name = "Embed Frameworks"; | ||
59 | + runOnlyForDeploymentPostprocessing = 0; | ||
60 | + }; | ||
61 | +/* End PBXCopyFilesBuildPhase section */ | ||
62 | + | ||
63 | +/* Begin PBXFileReference section */ | ||
64 | + 844544B71EFA5EE7004BDC50 /* YouaiSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = YouaiSDK.framework; path = poolsdk_file/poolsdk/YouaiSDK.framework; sourceTree = "<group>"; }; | ||
65 | + 845D181B1C8D778400F27EB9 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = poolsdk_file/poolsdk/Images.xcassets; sourceTree = "<group>"; }; | ||
66 | + 845D181C1C8D778400F27EB9 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = poolsdk_file/poolsdk/Info.plist; sourceTree = "<group>"; }; | ||
67 | + 846BD21F1EE9342700E89A1D /* pool_setting */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = pool_setting; path = poolsdk_file/poolsdk/pool_setting; sourceTree = "<group>"; }; | ||
68 | + 846BD2201EE9342700E89A1D /* PoolSdk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PoolSdk.h; path = poolsdk_file/poolsdk/PoolSdk.h; sourceTree = "<group>"; }; | ||
69 | + 846BD2211EE9342700E89A1D /* PoolSdk.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PoolSdk.m; path = poolsdk_file/poolsdk/PoolSdk.m; sourceTree = "<group>"; }; | ||
70 | + 846BD2221EE9342700E89A1D /* SDKInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDKInterface.h; path = poolsdk_file/poolsdk/SDKInterface.h; sourceTree = "<group>"; }; | ||
71 | + 846BD2231EE9342700E89A1D /* SDKInterface.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDKInterface.m; path = poolsdk_file/poolsdk/SDKInterface.m; sourceTree = "<group>"; }; | ||
72 | + 847EE5E01EE9007E003A4B7B /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = "<group>"; }; | ||
73 | + 847EE5E11EE9007E003A4B7B /* MainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainViewController.m; sourceTree = "<group>"; }; | ||
74 | + 8484E4F11EE7E0DC00B402D1 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; | ||
75 | + 8484E4F21EE7E0DC00B402D1 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; | ||
76 | + 8484E4F31EE7E0DC00B402D1 /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; }; | ||
77 | + 8484E4F41EE7E0DC00B402D1 /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; }; | ||
78 | + 8484E4F91EE7E15B00B402D1 /* TrackingIO.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = TrackingIO.a; sourceTree = "<group>"; }; | ||
79 | + 8484E4FB1EE7E1D800B402D1 /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = ../../../../../../../../usr/lib/libsqlite3.dylib; sourceTree = "<group>"; }; | ||
80 | + 8484E4FD1EE7E1F700B402D1 /* CoreTelephony.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreTelephony.framework; path = System/Library/Frameworks/CoreTelephony.framework; sourceTree = SDKROOT; }; | ||
81 | + 8484E4FF1EE7E20C00B402D1 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; }; | ||
82 | + 8484E5011EE7E21F00B402D1 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; | ||
83 | + 8484E5031EE7E24400B402D1 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; }; | ||
84 | + 8484E5051EE7E24A00B402D1 /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; }; | ||
85 | + 8484E5071EE7E25600B402D1 /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; }; | ||
86 | + 8484E5091EE7E26200B402D1 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; | ||
87 | + 8484E50B1EE7E27100B402D1 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; | ||
88 | + 8484E50D1EE7E28000B402D1 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; | ||
89 | + 8484E50F1EE7E29A00B402D1 /* libc++.1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libc++.1.dylib"; path = "../../../../../../../../usr/lib/libc++.1.dylib"; sourceTree = "<group>"; }; | ||
90 | + 8484E5111EE7E2B800B402D1 /* libz.1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.1.dylib; path = ../../../../../../../../usr/lib/libz.1.dylib; sourceTree = "<group>"; }; | ||
91 | + 8484E5131EE7E2DE00B402D1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; | ||
92 | + 8484E5151EE7E36800B402D1 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; | ||
93 | + 84C38CFB1EFCC7B50092D033 /* PoolSdk.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = PoolSdk.framework; sourceTree = "<group>"; }; | ||
94 | + BB5F3C881C1811BC00DA339D /* Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Demo.app; sourceTree = BUILT_PRODUCTS_DIR; }; | ||
95 | + BB5F3C8D1C1811BC00DA339D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; | ||
96 | + BB5F3C961C1811BC00DA339D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; | ||
97 | + BB5F3C9B1C1811BC00DA339D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; }; | ||
98 | + BB5F3CA11C1811BC00DA339D /* DemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; | ||
99 | + BB5F3CA61C1811BC00DA339D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; | ||
100 | + BB5F3CA71C1811BC00DA339D /* DemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DemoTests.m; sourceTree = "<group>"; }; | ||
101 | +/* End PBXFileReference section */ | ||
102 | + | ||
103 | +/* Begin PBXFrameworksBuildPhase section */ | ||
104 | + BB5F3C851C1811BC00DA339D /* Frameworks */ = { | ||
105 | + isa = PBXFrameworksBuildPhase; | ||
106 | + buildActionMask = 2147483647; | ||
107 | + files = ( | ||
108 | + 8484E5161EE7E36800B402D1 /* SystemConfiguration.framework in Frameworks */, | ||
109 | + 8484E4FC1EE7E1D800B402D1 /* libsqlite3.dylib in Frameworks */, | ||
110 | + 844544B81EFA5EE7004BDC50 /* YouaiSDK.framework in Frameworks */, | ||
111 | + 8484E5121EE7E2B800B402D1 /* libz.1.dylib in Frameworks */, | ||
112 | + 8484E5101EE7E29A00B402D1 /* libc++.1.dylib in Frameworks */, | ||
113 | + 8484E5001EE7E20C00B402D1 /* CFNetwork.framework in Frameworks */, | ||
114 | + 8484E5061EE7E24A00B402D1 /* CoreMotion.framework in Frameworks */, | ||
115 | + 8484E5021EE7E21F00B402D1 /* UIKit.framework in Frameworks */, | ||
116 | + 8484E50C1EE7E27100B402D1 /* CoreGraphics.framework in Frameworks */, | ||
117 | + 8484E5081EE7E25600B402D1 /* CoreText.framework in Frameworks */, | ||
118 | + 8484E50E1EE7E28000B402D1 /* QuartzCore.framework in Frameworks */, | ||
119 | + 8484E5141EE7E2DE00B402D1 /* Foundation.framework in Frameworks */, | ||
120 | + 8484E50A1EE7E26200B402D1 /* Security.framework in Frameworks */, | ||
121 | + 8484E5041EE7E24400B402D1 /* StoreKit.framework in Frameworks */, | ||
122 | + 84C38CFC1EFCC7B50092D033 /* PoolSdk.framework in Frameworks */, | ||
123 | + 8484E4FE1EE7E1F700B402D1 /* CoreTelephony.framework in Frameworks */, | ||
124 | + 8484E4FA1EE7E15B00B402D1 /* TrackingIO.a in Frameworks */, | ||
125 | + ); | ||
126 | + runOnlyForDeploymentPostprocessing = 0; | ||
127 | + }; | ||
128 | + BB5F3C9E1C1811BC00DA339D /* Frameworks */ = { | ||
129 | + isa = PBXFrameworksBuildPhase; | ||
130 | + buildActionMask = 2147483647; | ||
131 | + files = ( | ||
132 | + ); | ||
133 | + runOnlyForDeploymentPostprocessing = 0; | ||
134 | + }; | ||
135 | +/* End PBXFrameworksBuildPhase section */ | ||
136 | + | ||
137 | +/* Begin PBXGroup section */ | ||
138 | + 8476DF631C4DD70500EC42BA /* poolsdk_file */ = { | ||
139 | + isa = PBXGroup; | ||
140 | + children = ( | ||
141 | + 8476DF641C4DD71D00EC42BA /* poolsdk */, | ||
142 | + ); | ||
143 | + name = poolsdk_file; | ||
144 | + sourceTree = "<group>"; | ||
145 | + }; | ||
146 | + 8476DF641C4DD71D00EC42BA /* poolsdk */ = { | ||
147 | + isa = PBXGroup; | ||
148 | + children = ( | ||
149 | + 844544B71EFA5EE7004BDC50 /* YouaiSDK.framework */, | ||
150 | + 846BD21F1EE9342700E89A1D /* pool_setting */, | ||
151 | + 846BD2201EE9342700E89A1D /* PoolSdk.h */, | ||
152 | + 846BD2211EE9342700E89A1D /* PoolSdk.m */, | ||
153 | + 846BD2221EE9342700E89A1D /* SDKInterface.h */, | ||
154 | + 846BD2231EE9342700E89A1D /* SDKInterface.m */, | ||
155 | + 845D181B1C8D778400F27EB9 /* Images.xcassets */, | ||
156 | + 845D181C1C8D778400F27EB9 /* Info.plist */, | ||
157 | + ); | ||
158 | + name = poolsdk; | ||
159 | + sourceTree = "<group>"; | ||
160 | + }; | ||
161 | + BB5F3C7F1C1811BC00DA339D = { | ||
162 | + isa = PBXGroup; | ||
163 | + children = ( | ||
164 | + 8484E5151EE7E36800B402D1 /* SystemConfiguration.framework */, | ||
165 | + 8484E5131EE7E2DE00B402D1 /* Foundation.framework */, | ||
166 | + 8484E5111EE7E2B800B402D1 /* libz.1.dylib */, | ||
167 | + 8484E50F1EE7E29A00B402D1 /* libc++.1.dylib */, | ||
168 | + 8484E50D1EE7E28000B402D1 /* QuartzCore.framework */, | ||
169 | + 8484E50B1EE7E27100B402D1 /* CoreGraphics.framework */, | ||
170 | + 8484E5091EE7E26200B402D1 /* Security.framework */, | ||
171 | + 8484E5071EE7E25600B402D1 /* CoreText.framework */, | ||
172 | + 8484E5051EE7E24A00B402D1 /* CoreMotion.framework */, | ||
173 | + 8484E5031EE7E24400B402D1 /* StoreKit.framework */, | ||
174 | + 8484E5011EE7E21F00B402D1 /* UIKit.framework */, | ||
175 | + 8484E4FF1EE7E20C00B402D1 /* CFNetwork.framework */, | ||
176 | + 8484E4FD1EE7E1F700B402D1 /* CoreTelephony.framework */, | ||
177 | + 8484E4FB1EE7E1D800B402D1 /* libsqlite3.dylib */, | ||
178 | + 8476DF631C4DD70500EC42BA /* poolsdk_file */, | ||
179 | + BB5F3C8A1C1811BC00DA339D /* Demo */, | ||
180 | + BB5F3CA41C1811BC00DA339D /* DemoTests */, | ||
181 | + BB5F3C891C1811BC00DA339D /* Products */, | ||
182 | + ); | ||
183 | + sourceTree = "<group>"; | ||
184 | + }; | ||
185 | + BB5F3C891C1811BC00DA339D /* Products */ = { | ||
186 | + isa = PBXGroup; | ||
187 | + children = ( | ||
188 | + BB5F3C881C1811BC00DA339D /* Demo.app */, | ||
189 | + BB5F3CA11C1811BC00DA339D /* DemoTests.xctest */, | ||
190 | + ); | ||
191 | + name = Products; | ||
192 | + sourceTree = "<group>"; | ||
193 | + }; | ||
194 | + BB5F3C8A1C1811BC00DA339D /* Demo */ = { | ||
195 | + isa = PBXGroup; | ||
196 | + children = ( | ||
197 | + 84C38CFB1EFCC7B50092D033 /* PoolSdk.framework */, | ||
198 | + 8484E4F91EE7E15B00B402D1 /* TrackingIO.a */, | ||
199 | + 8484E4F11EE7E0DC00B402D1 /* AppDelegate.h */, | ||
200 | + 8484E4F21EE7E0DC00B402D1 /* AppDelegate.m */, | ||
201 | + 8484E4F31EE7E0DC00B402D1 /* ViewController.h */, | ||
202 | + 8484E4F41EE7E0DC00B402D1 /* ViewController.m */, | ||
203 | + 847EE5E01EE9007E003A4B7B /* MainViewController.h */, | ||
204 | + 847EE5E11EE9007E003A4B7B /* MainViewController.m */, | ||
205 | + BB5F3C951C1811BC00DA339D /* Main.storyboard */, | ||
206 | + BB5F3C9A1C1811BC00DA339D /* LaunchScreen.xib */, | ||
207 | + BB5F3C8B1C1811BC00DA339D /* Supporting Files */, | ||
208 | + ); | ||
209 | + path = Demo; | ||
210 | + sourceTree = "<group>"; | ||
211 | + }; | ||
212 | + BB5F3C8B1C1811BC00DA339D /* Supporting Files */ = { | ||
213 | + isa = PBXGroup; | ||
214 | + children = ( | ||
215 | + BB5F3C8D1C1811BC00DA339D /* main.m */, | ||
216 | + ); | ||
217 | + name = "Supporting Files"; | ||
218 | + sourceTree = "<group>"; | ||
219 | + }; | ||
220 | + BB5F3CA41C1811BC00DA339D /* DemoTests */ = { | ||
221 | + isa = PBXGroup; | ||
222 | + children = ( | ||
223 | + BB5F3CA71C1811BC00DA339D /* DemoTests.m */, | ||
224 | + BB5F3CA51C1811BC00DA339D /* Supporting Files */, | ||
225 | + ); | ||
226 | + path = DemoTests; | ||
227 | + sourceTree = "<group>"; | ||
228 | + }; | ||
229 | + BB5F3CA51C1811BC00DA339D /* Supporting Files */ = { | ||
230 | + isa = PBXGroup; | ||
231 | + children = ( | ||
232 | + BB5F3CA61C1811BC00DA339D /* Info.plist */, | ||
233 | + ); | ||
234 | + name = "Supporting Files"; | ||
235 | + sourceTree = "<group>"; | ||
236 | + }; | ||
237 | +/* End PBXGroup section */ | ||
238 | + | ||
239 | +/* Begin PBXNativeTarget section */ | ||
240 | + BB5F3C871C1811BC00DA339D /* Demo */ = { | ||
241 | + isa = PBXNativeTarget; | ||
242 | + buildConfigurationList = BB5F3CAB1C1811BC00DA339D /* Build configuration list for PBXNativeTarget "Demo" */; | ||
243 | + buildPhases = ( | ||
244 | + BB5F3C841C1811BC00DA339D /* Sources */, | ||
245 | + BB5F3C851C1811BC00DA339D /* Frameworks */, | ||
246 | + BB5F3C861C1811BC00DA339D /* Resources */, | ||
247 | + 84398BFB1C4C83EC0082D774 /* Embed Frameworks */, | ||
248 | + ); | ||
249 | + buildRules = ( | ||
250 | + ); | ||
251 | + dependencies = ( | ||
252 | + ); | ||
253 | + name = Demo; | ||
254 | + productName = Demo; | ||
255 | + productReference = BB5F3C881C1811BC00DA339D /* Demo.app */; | ||
256 | + productType = "com.apple.product-type.application"; | ||
257 | + }; | ||
258 | + BB5F3CA01C1811BC00DA339D /* DemoTests */ = { | ||
259 | + isa = PBXNativeTarget; | ||
260 | + buildConfigurationList = BB5F3CAE1C1811BC00DA339D /* Build configuration list for PBXNativeTarget "DemoTests" */; | ||
261 | + buildPhases = ( | ||
262 | + BB5F3C9D1C1811BC00DA339D /* Sources */, | ||
263 | + BB5F3C9E1C1811BC00DA339D /* Frameworks */, | ||
264 | + BB5F3C9F1C1811BC00DA339D /* Resources */, | ||
265 | + ); | ||
266 | + buildRules = ( | ||
267 | + ); | ||
268 | + dependencies = ( | ||
269 | + BB5F3CA31C1811BC00DA339D /* PBXTargetDependency */, | ||
270 | + ); | ||
271 | + name = DemoTests; | ||
272 | + productName = DemoTests; | ||
273 | + productReference = BB5F3CA11C1811BC00DA339D /* DemoTests.xctest */; | ||
274 | + productType = "com.apple.product-type.bundle.unit-test"; | ||
275 | + }; | ||
276 | +/* End PBXNativeTarget section */ | ||
277 | + | ||
278 | +/* Begin PBXProject section */ | ||
279 | + BB5F3C801C1811BC00DA339D /* Project object */ = { | ||
280 | + isa = PBXProject; | ||
281 | + attributes = { | ||
282 | + LastUpgradeCheck = 0640; | ||
283 | + ORGANIZATIONNAME = winFan; | ||
284 | + TargetAttributes = { | ||
285 | + BB5F3C871C1811BC00DA339D = { | ||
286 | + CreatedOnToolsVersion = 6.4; | ||
287 | + }; | ||
288 | + BB5F3CA01C1811BC00DA339D = { | ||
289 | + CreatedOnToolsVersion = 6.4; | ||
290 | + TestTargetID = BB5F3C871C1811BC00DA339D; | ||
291 | + }; | ||
292 | + }; | ||
293 | + }; | ||
294 | + buildConfigurationList = BB5F3C831C1811BC00DA339D /* Build configuration list for PBXProject "Demo" */; | ||
295 | + compatibilityVersion = "Xcode 3.2"; | ||
296 | + developmentRegion = English; | ||
297 | + hasScannedForEncodings = 0; | ||
298 | + knownRegions = ( | ||
299 | + en, | ||
300 | + Base, | ||
301 | + ); | ||
302 | + mainGroup = BB5F3C7F1C1811BC00DA339D; | ||
303 | + productRefGroup = BB5F3C891C1811BC00DA339D /* Products */; | ||
304 | + projectDirPath = ""; | ||
305 | + projectRoot = ""; | ||
306 | + targets = ( | ||
307 | + BB5F3C871C1811BC00DA339D /* Demo */, | ||
308 | + BB5F3CA01C1811BC00DA339D /* DemoTests */, | ||
309 | + ); | ||
310 | + }; | ||
311 | +/* End PBXProject section */ | ||
312 | + | ||
313 | +/* Begin PBXResourcesBuildPhase section */ | ||
314 | + BB5F3C861C1811BC00DA339D /* Resources */ = { | ||
315 | + isa = PBXResourcesBuildPhase; | ||
316 | + buildActionMask = 2147483647; | ||
317 | + files = ( | ||
318 | + 845D18221C8D778400F27EB9 /* Images.xcassets in Resources */, | ||
319 | + BB5F3C971C1811BC00DA339D /* Main.storyboard in Resources */, | ||
320 | + BB5F3C9C1C1811BC00DA339D /* LaunchScreen.xib in Resources */, | ||
321 | + 846BD2241EE9342700E89A1D /* pool_setting in Resources */, | ||
322 | + ); | ||
323 | + runOnlyForDeploymentPostprocessing = 0; | ||
324 | + }; | ||
325 | + BB5F3C9F1C1811BC00DA339D /* Resources */ = { | ||
326 | + isa = PBXResourcesBuildPhase; | ||
327 | + buildActionMask = 2147483647; | ||
328 | + files = ( | ||
329 | + ); | ||
330 | + runOnlyForDeploymentPostprocessing = 0; | ||
331 | + }; | ||
332 | +/* End PBXResourcesBuildPhase section */ | ||
333 | + | ||
334 | +/* Begin PBXSourcesBuildPhase section */ | ||
335 | + BB5F3C841C1811BC00DA339D /* Sources */ = { | ||
336 | + isa = PBXSourcesBuildPhase; | ||
337 | + buildActionMask = 2147483647; | ||
338 | + files = ( | ||
339 | + 846BD2261EE9342700E89A1D /* SDKInterface.m in Sources */, | ||
340 | + 846BD2251EE9342700E89A1D /* PoolSdk.m in Sources */, | ||
341 | + 8484E4F51EE7E0DC00B402D1 /* AppDelegate.m in Sources */, | ||
342 | + 847EE5E21EE9007E003A4B7B /* MainViewController.m in Sources */, | ||
343 | + BB5F3C8E1C1811BC00DA339D /* main.m in Sources */, | ||
344 | + 8484E4F61EE7E0DC00B402D1 /* ViewController.m in Sources */, | ||
345 | + ); | ||
346 | + runOnlyForDeploymentPostprocessing = 0; | ||
347 | + }; | ||
348 | + BB5F3C9D1C1811BC00DA339D /* Sources */ = { | ||
349 | + isa = PBXSourcesBuildPhase; | ||
350 | + buildActionMask = 2147483647; | ||
351 | + files = ( | ||
352 | + BB5F3CA81C1811BC00DA339D /* DemoTests.m in Sources */, | ||
353 | + ); | ||
354 | + runOnlyForDeploymentPostprocessing = 0; | ||
355 | + }; | ||
356 | +/* End PBXSourcesBuildPhase section */ | ||
357 | + | ||
358 | +/* Begin PBXTargetDependency section */ | ||
359 | + BB5F3CA31C1811BC00DA339D /* PBXTargetDependency */ = { | ||
360 | + isa = PBXTargetDependency; | ||
361 | + target = BB5F3C871C1811BC00DA339D /* Demo */; | ||
362 | + targetProxy = BB5F3CA21C1811BC00DA339D /* PBXContainerItemProxy */; | ||
363 | + }; | ||
364 | +/* End PBXTargetDependency section */ | ||
365 | + | ||
366 | +/* Begin PBXVariantGroup section */ | ||
367 | + BB5F3C951C1811BC00DA339D /* Main.storyboard */ = { | ||
368 | + isa = PBXVariantGroup; | ||
369 | + children = ( | ||
370 | + BB5F3C961C1811BC00DA339D /* Base */, | ||
371 | + ); | ||
372 | + name = Main.storyboard; | ||
373 | + sourceTree = "<group>"; | ||
374 | + }; | ||
375 | + BB5F3C9A1C1811BC00DA339D /* LaunchScreen.xib */ = { | ||
376 | + isa = PBXVariantGroup; | ||
377 | + children = ( | ||
378 | + BB5F3C9B1C1811BC00DA339D /* Base */, | ||
379 | + ); | ||
380 | + name = LaunchScreen.xib; | ||
381 | + sourceTree = "<group>"; | ||
382 | + }; | ||
383 | +/* End PBXVariantGroup section */ | ||
384 | + | ||
385 | +/* Begin XCBuildConfiguration section */ | ||
386 | + BB5F3CA91C1811BC00DA339D /* Debug */ = { | ||
387 | + isa = XCBuildConfiguration; | ||
388 | + buildSettings = { | ||
389 | + ALWAYS_SEARCH_USER_PATHS = NO; | ||
390 | + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = ""; | ||
391 | + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; | ||
392 | + CLANG_CXX_LIBRARY = "libc++"; | ||
393 | + CLANG_ENABLE_MODULES = YES; | ||
394 | + CLANG_ENABLE_OBJC_ARC = YES; | ||
395 | + CLANG_WARN_BOOL_CONVERSION = YES; | ||
396 | + CLANG_WARN_CONSTANT_CONVERSION = YES; | ||
397 | + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | ||
398 | + CLANG_WARN_EMPTY_BODY = YES; | ||
399 | + CLANG_WARN_ENUM_CONVERSION = YES; | ||
400 | + CLANG_WARN_INT_CONVERSION = YES; | ||
401 | + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | ||
402 | + CLANG_WARN_UNREACHABLE_CODE = YES; | ||
403 | + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | ||
404 | + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | ||
405 | + COPY_PHASE_STRIP = NO; | ||
406 | + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; | ||
407 | + ENABLE_BITCODE = NO; | ||
408 | + ENABLE_STRICT_OBJC_MSGSEND = YES; | ||
409 | + GCC_C_LANGUAGE_STANDARD = gnu99; | ||
410 | + GCC_DYNAMIC_NO_PIC = NO; | ||
411 | + GCC_NO_COMMON_BLOCKS = YES; | ||
412 | + GCC_OPTIMIZATION_LEVEL = 0; | ||
413 | + GCC_PREPROCESSOR_DEFINITIONS = ( | ||
414 | + "DEBUG=1", | ||
415 | + "$(inherited)", | ||
416 | + ); | ||
417 | + GCC_SYMBOLS_PRIVATE_EXTERN = NO; | ||
418 | + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | ||
419 | + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | ||
420 | + GCC_WARN_UNDECLARED_SELECTOR = YES; | ||
421 | + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | ||
422 | + GCC_WARN_UNUSED_FUNCTION = YES; | ||
423 | + GCC_WARN_UNUSED_VARIABLE = YES; | ||
424 | + IPHONEOS_DEPLOYMENT_TARGET = 8.4; | ||
425 | + MTL_ENABLE_DEBUG_INFO = YES; | ||
426 | + ONLY_ACTIVE_ARCH = YES; | ||
427 | + SDKROOT = iphoneos; | ||
428 | + }; | ||
429 | + name = Debug; | ||
430 | + }; | ||
431 | + BB5F3CAA1C1811BC00DA339D /* Release */ = { | ||
432 | + isa = XCBuildConfiguration; | ||
433 | + buildSettings = { | ||
434 | + ALWAYS_SEARCH_USER_PATHS = NO; | ||
435 | + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; | ||
436 | + CLANG_CXX_LIBRARY = "libc++"; | ||
437 | + CLANG_ENABLE_MODULES = YES; | ||
438 | + CLANG_ENABLE_OBJC_ARC = YES; | ||
439 | + CLANG_WARN_BOOL_CONVERSION = YES; | ||
440 | + CLANG_WARN_CONSTANT_CONVERSION = YES; | ||
441 | + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | ||
442 | + CLANG_WARN_EMPTY_BODY = YES; | ||
443 | + CLANG_WARN_ENUM_CONVERSION = YES; | ||
444 | + CLANG_WARN_INT_CONVERSION = YES; | ||
445 | + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | ||
446 | + CLANG_WARN_UNREACHABLE_CODE = YES; | ||
447 | + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | ||
448 | + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | ||
449 | + COPY_PHASE_STRIP = NO; | ||
450 | + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; | ||
451 | + ENABLE_BITCODE = NO; | ||
452 | + ENABLE_NS_ASSERTIONS = NO; | ||
453 | + ENABLE_STRICT_OBJC_MSGSEND = YES; | ||
454 | + GCC_C_LANGUAGE_STANDARD = gnu99; | ||
455 | + GCC_NO_COMMON_BLOCKS = YES; | ||
456 | + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | ||
457 | + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | ||
458 | + GCC_WARN_UNDECLARED_SELECTOR = YES; | ||
459 | + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | ||
460 | + GCC_WARN_UNUSED_FUNCTION = YES; | ||
461 | + GCC_WARN_UNUSED_VARIABLE = YES; | ||
462 | + IPHONEOS_DEPLOYMENT_TARGET = 8.4; | ||
463 | + MTL_ENABLE_DEBUG_INFO = NO; | ||
464 | + SDKROOT = iphoneos; | ||
465 | + VALIDATE_PRODUCT = YES; | ||
466 | + }; | ||
467 | + name = Release; | ||
468 | + }; | ||
469 | + BB5F3CAC1C1811BC00DA339D /* Debug */ = { | ||
470 | + isa = XCBuildConfiguration; | ||
471 | + buildSettings = { | ||
472 | + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||
473 | + CODE_SIGN_IDENTITY = "iPhone Developer: Yongxing Yu (7SXDVCVFQZ)"; | ||
474 | + DEAD_CODE_STRIPPING = NO; | ||
475 | + ENABLE_BITCODE = NO; | ||
476 | + FRAMEWORK_SEARCH_PATHS = ( | ||
477 | + "$(inherited)", | ||
478 | + "$(PROJECT_DIR)/Demo", | ||
479 | + "$(PROJECT_DIR)/poolsdk_file/poolsdk", | ||
480 | + ); | ||
481 | + INFOPLIST_FILE = poolsdk_file/poolsdk/Info.plist; | ||
482 | + IPHONEOS_DEPLOYMENT_TARGET = 7.1; | ||
483 | + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; | ||
484 | + LIBRARY_SEARCH_PATHS = ( | ||
485 | + "$(inherited)", | ||
486 | + "$(PROJECT_DIR)/Demo", | ||
487 | + ); | ||
488 | + ONLY_ACTIVE_ARCH = YES; | ||
489 | + OTHER_LDFLAGS = ""; | ||
490 | + PRODUCT_BUNDLE_IDENTIFIER = com.xiongdi.test; | ||
491 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
492 | + VALID_ARCHS = "arm64 armv7"; | ||
493 | + }; | ||
494 | + name = Debug; | ||
495 | + }; | ||
496 | + BB5F3CAD1C1811BC00DA339D /* Release */ = { | ||
497 | + isa = XCBuildConfiguration; | ||
498 | + buildSettings = { | ||
499 | + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||
500 | + CODE_SIGN_IDENTITY = "iPhone Developer: Yongxing Yu (7SXDVCVFQZ)"; | ||
501 | + DEAD_CODE_STRIPPING = NO; | ||
502 | + ENABLE_BITCODE = NO; | ||
503 | + FRAMEWORK_SEARCH_PATHS = ( | ||
504 | + "$(inherited)", | ||
505 | + "$(PROJECT_DIR)/Demo", | ||
506 | + "$(PROJECT_DIR)/poolsdk_file/poolsdk", | ||
507 | + ); | ||
508 | + INFOPLIST_FILE = poolsdk_file/poolsdk/Info.plist; | ||
509 | + IPHONEOS_DEPLOYMENT_TARGET = 7.1; | ||
510 | + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; | ||
511 | + LIBRARY_SEARCH_PATHS = ( | ||
512 | + "$(inherited)", | ||
513 | + "$(PROJECT_DIR)/Demo", | ||
514 | + ); | ||
515 | + ONLY_ACTIVE_ARCH = YES; | ||
516 | + OTHER_LDFLAGS = ""; | ||
517 | + PRODUCT_BUNDLE_IDENTIFIER = com.xiongdi.test; | ||
518 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
519 | + VALID_ARCHS = "arm64 armv7"; | ||
520 | + }; | ||
521 | + name = Release; | ||
522 | + }; | ||
523 | + BB5F3CAF1C1811BC00DA339D /* Debug */ = { | ||
524 | + isa = XCBuildConfiguration; | ||
525 | + buildSettings = { | ||
526 | + BUNDLE_LOADER = "$(TEST_HOST)"; | ||
527 | + FRAMEWORK_SEARCH_PATHS = ( | ||
528 | + "$(SDKROOT)/Developer/Library/Frameworks", | ||
529 | + "$(inherited)", | ||
530 | + ); | ||
531 | + GCC_PREPROCESSOR_DEFINITIONS = ( | ||
532 | + "DEBUG=1", | ||
533 | + "$(inherited)", | ||
534 | + ); | ||
535 | + INFOPLIST_FILE = DemoTests/Info.plist; | ||
536 | + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; | ||
537 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
538 | + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Demo.app/Demo"; | ||
539 | + }; | ||
540 | + name = Debug; | ||
541 | + }; | ||
542 | + BB5F3CB01C1811BC00DA339D /* Release */ = { | ||
543 | + isa = XCBuildConfiguration; | ||
544 | + buildSettings = { | ||
545 | + BUNDLE_LOADER = "$(TEST_HOST)"; | ||
546 | + FRAMEWORK_SEARCH_PATHS = ( | ||
547 | + "$(SDKROOT)/Developer/Library/Frameworks", | ||
548 | + "$(inherited)", | ||
549 | + ); | ||
550 | + INFOPLIST_FILE = DemoTests/Info.plist; | ||
551 | + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; | ||
552 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
553 | + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Demo.app/Demo"; | ||
554 | + }; | ||
555 | + name = Release; | ||
556 | + }; | ||
557 | +/* End XCBuildConfiguration section */ | ||
558 | + | ||
559 | +/* Begin XCConfigurationList section */ | ||
560 | + BB5F3C831C1811BC00DA339D /* Build configuration list for PBXProject "Demo" */ = { | ||
561 | + isa = XCConfigurationList; | ||
562 | + buildConfigurations = ( | ||
563 | + BB5F3CA91C1811BC00DA339D /* Debug */, | ||
564 | + BB5F3CAA1C1811BC00DA339D /* Release */, | ||
565 | + ); | ||
566 | + defaultConfigurationIsVisible = 0; | ||
567 | + defaultConfigurationName = Release; | ||
568 | + }; | ||
569 | + BB5F3CAB1C1811BC00DA339D /* Build configuration list for PBXNativeTarget "Demo" */ = { | ||
570 | + isa = XCConfigurationList; | ||
571 | + buildConfigurations = ( | ||
572 | + BB5F3CAC1C1811BC00DA339D /* Debug */, | ||
573 | + BB5F3CAD1C1811BC00DA339D /* Release */, | ||
574 | + ); | ||
575 | + defaultConfigurationIsVisible = 0; | ||
576 | + defaultConfigurationName = Release; | ||
577 | + }; | ||
578 | + BB5F3CAE1C1811BC00DA339D /* Build configuration list for PBXNativeTarget "DemoTests" */ = { | ||
579 | + isa = XCConfigurationList; | ||
580 | + buildConfigurations = ( | ||
581 | + BB5F3CAF1C1811BC00DA339D /* Debug */, | ||
582 | + BB5F3CB01C1811BC00DA339D /* Release */, | ||
583 | + ); | ||
584 | + defaultConfigurationIsVisible = 0; | ||
585 | + defaultConfigurationName = Release; | ||
586 | + }; | ||
587 | +/* End XCConfigurationList section */ | ||
588 | + }; | ||
589 | + rootObject = BB5F3C801C1811BC00DA339D /* Project object */; | ||
590 | +} |
1 | +{ | ||
2 | + "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "5b13317c-0110-4367-8746-06bc6aadd3cd++2397", | ||
3 | + "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { | ||
4 | + "5b13317c-0110-4367-8746-06bc6aadd3cd++2397" : { | ||
5 | + | ||
6 | + } | ||
7 | + }, | ||
8 | + "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { | ||
9 | + "5b13317c-0110-4367-8746-06bc6aadd3cd++2397" : 0 | ||
10 | + }, | ||
11 | + "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "8119CC7B-EDC1-4646-9378-8ECAC2EEB94B", | ||
12 | + "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { | ||
13 | + "5b13317c-0110-4367-8746-06bc6aadd3cd++2397" : "youai_foolsdk_ios\/" | ||
14 | + }, | ||
15 | + "DVTSourceControlWorkspaceBlueprintNameKey" : "Demo", | ||
16 | + "DVTSourceControlWorkspaceBlueprintVersion" : 204, | ||
17 | + "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "PoolSdk_Demo\/Demo.xcodeproj", | ||
18 | + "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ | ||
19 | + { | ||
20 | + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "svn:\/\/10.21.210.99", | ||
21 | + "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Subversion", | ||
22 | + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "5b13317c-0110-4367-8746-06bc6aadd3cd++2397" | ||
23 | + } | ||
24 | + ] | ||
25 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<Bucket | ||
3 | + type = "1" | ||
4 | + version = "2.0"> | ||
5 | + <Breakpoints> | ||
6 | + <BreakpointProxy | ||
7 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | ||
8 | + <BreakpointContent | ||
9 | + shouldBeEnabled = "Yes" | ||
10 | + ignoreCount = "0" | ||
11 | + continueAfterRunningActions = "No" | ||
12 | + filePath = "../PoolSdk/PoolSdk/SDKInterface.m" | ||
13 | + timestampString = "471440051.171901" | ||
14 | + startingColumnNumber = "9223372036854775807" | ||
15 | + endingColumnNumber = "9223372036854775807" | ||
16 | + startingLineNumber = "77" | ||
17 | + endingLineNumber = "77" | ||
18 | + landmarkName = "-receiveLoginMessage:" | ||
19 | + landmarkType = "5"> | ||
20 | + </BreakpointContent> | ||
21 | + </BreakpointProxy> | ||
22 | + <BreakpointProxy | ||
23 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | ||
24 | + <BreakpointContent | ||
25 | + shouldBeEnabled = "Yes" | ||
26 | + ignoreCount = "0" | ||
27 | + continueAfterRunningActions = "No" | ||
28 | + filePath = "../PoolSdk/PoolSdk/SDKInterface.m" | ||
29 | + timestampString = "471440051.171901" | ||
30 | + startingColumnNumber = "9223372036854775807" | ||
31 | + endingColumnNumber = "9223372036854775807" | ||
32 | + startingLineNumber = "43" | ||
33 | + endingLineNumber = "43" | ||
34 | + landmarkName = "-SDKloginSDK" | ||
35 | + landmarkType = "5"> | ||
36 | + </BreakpointContent> | ||
37 | + </BreakpointProxy> | ||
38 | + </Breakpoints> | ||
39 | +</Bucket> |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<Scheme | ||
3 | + LastUpgradeVersion = "0640" | ||
4 | + version = "1.3"> | ||
5 | + <BuildAction | ||
6 | + parallelizeBuildables = "YES" | ||
7 | + buildImplicitDependencies = "YES"> | ||
8 | + <BuildActionEntries> | ||
9 | + <BuildActionEntry | ||
10 | + buildForTesting = "YES" | ||
11 | + buildForRunning = "YES" | ||
12 | + buildForProfiling = "YES" | ||
13 | + buildForArchiving = "YES" | ||
14 | + buildForAnalyzing = "YES"> | ||
15 | + <BuildableReference | ||
16 | + BuildableIdentifier = "primary" | ||
17 | + BlueprintIdentifier = "BB5F3C871C1811BC00DA339D" | ||
18 | + BuildableName = "Demo.app" | ||
19 | + BlueprintName = "Demo" | ||
20 | + ReferencedContainer = "container:Demo.xcodeproj"> | ||
21 | + </BuildableReference> | ||
22 | + </BuildActionEntry> | ||
23 | + <BuildActionEntry | ||
24 | + buildForTesting = "YES" | ||
25 | + buildForRunning = "YES" | ||
26 | + buildForProfiling = "NO" | ||
27 | + buildForArchiving = "NO" | ||
28 | + buildForAnalyzing = "YES"> | ||
29 | + <BuildableReference | ||
30 | + BuildableIdentifier = "primary" | ||
31 | + BlueprintIdentifier = "BB5F3CA01C1811BC00DA339D" | ||
32 | + BuildableName = "DemoTests.xctest" | ||
33 | + BlueprintName = "DemoTests" | ||
34 | + ReferencedContainer = "container:Demo.xcodeproj"> | ||
35 | + </BuildableReference> | ||
36 | + </BuildActionEntry> | ||
37 | + </BuildActionEntries> | ||
38 | + </BuildAction> | ||
39 | + <TestAction | ||
40 | + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
41 | + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
42 | + shouldUseLaunchSchemeArgsEnv = "YES" | ||
43 | + buildConfiguration = "Debug"> | ||
44 | + <Testables> | ||
45 | + <TestableReference | ||
46 | + skipped = "NO"> | ||
47 | + <BuildableReference | ||
48 | + BuildableIdentifier = "primary" | ||
49 | + BlueprintIdentifier = "BB5F3CA01C1811BC00DA339D" | ||
50 | + BuildableName = "DemoTests.xctest" | ||
51 | + BlueprintName = "DemoTests" | ||
52 | + ReferencedContainer = "container:Demo.xcodeproj"> | ||
53 | + </BuildableReference> | ||
54 | + </TestableReference> | ||
55 | + </Testables> | ||
56 | + <MacroExpansion> | ||
57 | + <BuildableReference | ||
58 | + BuildableIdentifier = "primary" | ||
59 | + BlueprintIdentifier = "BB5F3C871C1811BC00DA339D" | ||
60 | + BuildableName = "Demo.app" | ||
61 | + BlueprintName = "Demo" | ||
62 | + ReferencedContainer = "container:Demo.xcodeproj"> | ||
63 | + </BuildableReference> | ||
64 | + </MacroExpansion> | ||
65 | + </TestAction> | ||
66 | + <LaunchAction | ||
67 | + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
68 | + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
69 | + launchStyle = "0" | ||
70 | + useCustomWorkingDirectory = "NO" | ||
71 | + buildConfiguration = "Debug" | ||
72 | + ignoresPersistentStateOnLaunch = "NO" | ||
73 | + debugDocumentVersioning = "YES" | ||
74 | + allowLocationSimulation = "YES"> | ||
75 | + <BuildableProductRunnable | ||
76 | + runnableDebuggingMode = "0"> | ||
77 | + <BuildableReference | ||
78 | + BuildableIdentifier = "primary" | ||
79 | + BlueprintIdentifier = "BB5F3C871C1811BC00DA339D" | ||
80 | + BuildableName = "Demo.app" | ||
81 | + BlueprintName = "Demo" | ||
82 | + ReferencedContainer = "container:Demo.xcodeproj"> | ||
83 | + </BuildableReference> | ||
84 | + </BuildableProductRunnable> | ||
85 | + <AdditionalOptions> | ||
86 | + </AdditionalOptions> | ||
87 | + </LaunchAction> | ||
88 | + <ProfileAction | ||
89 | + shouldUseLaunchSchemeArgsEnv = "YES" | ||
90 | + savedToolIdentifier = "" | ||
91 | + useCustomWorkingDirectory = "NO" | ||
92 | + buildConfiguration = "Release" | ||
93 | + debugDocumentVersioning = "YES"> | ||
94 | + <BuildableProductRunnable | ||
95 | + runnableDebuggingMode = "0"> | ||
96 | + <BuildableReference | ||
97 | + BuildableIdentifier = "primary" | ||
98 | + BlueprintIdentifier = "BB5F3C871C1811BC00DA339D" | ||
99 | + BuildableName = "Demo.app" | ||
100 | + BlueprintName = "Demo" | ||
101 | + ReferencedContainer = "container:Demo.xcodeproj"> | ||
102 | + </BuildableReference> | ||
103 | + </BuildableProductRunnable> | ||
104 | + </ProfileAction> | ||
105 | + <AnalyzeAction | ||
106 | + buildConfiguration = "Debug"> | ||
107 | + </AnalyzeAction> | ||
108 | + <ArchiveAction | ||
109 | + buildConfiguration = "Release" | ||
110 | + revealArchiveInOrganizer = "YES"> | ||
111 | + </ArchiveAction> | ||
112 | +</Scheme> |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
3 | +<plist version="1.0"> | ||
4 | +<dict> | ||
5 | + <key>SchemeUserState</key> | ||
6 | + <dict> | ||
7 | + <key>Demo.xcscheme</key> | ||
8 | + <dict> | ||
9 | + <key>orderHint</key> | ||
10 | + <integer>0</integer> | ||
11 | + </dict> | ||
12 | + </dict> | ||
13 | + <key>SuppressBuildableAutocreation</key> | ||
14 | + <dict> | ||
15 | + <key>BB5F3C871C1811BC00DA339D</key> | ||
16 | + <dict> | ||
17 | + <key>primary</key> | ||
18 | + <true/> | ||
19 | + </dict> | ||
20 | + <key>BB5F3CA01C1811BC00DA339D</key> | ||
21 | + <dict> | ||
22 | + <key>primary</key> | ||
23 | + <true/> | ||
24 | + </dict> | ||
25 | + </dict> | ||
26 | +</dict> | ||
27 | +</plist> |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<Bucket | ||
3 | + type = "1" | ||
4 | + version = "2.0"> | ||
5 | + <Breakpoints> | ||
6 | + <BreakpointProxy | ||
7 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | ||
8 | + <BreakpointContent | ||
9 | + shouldBeEnabled = "No" | ||
10 | + ignoreCount = "0" | ||
11 | + continueAfterRunningActions = "No" | ||
12 | + filePath = "Demo/SDKInterface.h" | ||
13 | + timestampString = "474775745.083759" | ||
14 | + startingColumnNumber = "9223372036854775807" | ||
15 | + endingColumnNumber = "9223372036854775807" | ||
16 | + startingLineNumber = "9" | ||
17 | + endingLineNumber = "9" | ||
18 | + landmarkName = "@interface SDKInterface" | ||
19 | + landmarkType = "2"> | ||
20 | + </BreakpointContent> | ||
21 | + </BreakpointProxy> | ||
22 | + </Breakpoints> | ||
23 | +</Bucket> |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<Scheme | ||
3 | + LastUpgradeVersion = "0700" | ||
4 | + version = "1.3"> | ||
5 | + <BuildAction | ||
6 | + parallelizeBuildables = "YES" | ||
7 | + buildImplicitDependencies = "YES"> | ||
8 | + <BuildActionEntries> | ||
9 | + <BuildActionEntry | ||
10 | + buildForTesting = "YES" | ||
11 | + buildForRunning = "YES" | ||
12 | + buildForProfiling = "YES" | ||
13 | + buildForArchiving = "YES" | ||
14 | + buildForAnalyzing = "YES"> | ||
15 | + <BuildableReference | ||
16 | + BuildableIdentifier = "primary" | ||
17 | + BlueprintIdentifier = "BB5F3C871C1811BC00DA339D" | ||
18 | + BuildableName = "Demo.app" | ||
19 | + BlueprintName = "Demo" | ||
20 | + ReferencedContainer = "container:Demo.xcodeproj"> | ||
21 | + </BuildableReference> | ||
22 | + </BuildActionEntry> | ||
23 | + </BuildActionEntries> | ||
24 | + </BuildAction> | ||
25 | + <TestAction | ||
26 | + buildConfiguration = "Debug" | ||
27 | + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
28 | + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
29 | + shouldUseLaunchSchemeArgsEnv = "YES"> | ||
30 | + <Testables> | ||
31 | + <TestableReference | ||
32 | + skipped = "NO"> | ||
33 | + <BuildableReference | ||
34 | + BuildableIdentifier = "primary" | ||
35 | + BlueprintIdentifier = "BB5F3CA01C1811BC00DA339D" | ||
36 | + BuildableName = "DemoTests.xctest" | ||
37 | + BlueprintName = "DemoTests" | ||
38 | + ReferencedContainer = "container:Demo.xcodeproj"> | ||
39 | + </BuildableReference> | ||
40 | + </TestableReference> | ||
41 | + </Testables> | ||
42 | + <MacroExpansion> | ||
43 | + <BuildableReference | ||
44 | + BuildableIdentifier = "primary" | ||
45 | + BlueprintIdentifier = "BB5F3C871C1811BC00DA339D" | ||
46 | + BuildableName = "Demo.app" | ||
47 | + BlueprintName = "Demo" | ||
48 | + ReferencedContainer = "container:Demo.xcodeproj"> | ||
49 | + </BuildableReference> | ||
50 | + </MacroExpansion> | ||
51 | + <AdditionalOptions> | ||
52 | + </AdditionalOptions> | ||
53 | + </TestAction> | ||
54 | + <LaunchAction | ||
55 | + buildConfiguration = "Debug" | ||
56 | + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
57 | + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
58 | + launchStyle = "0" | ||
59 | + useCustomWorkingDirectory = "NO" | ||
60 | + ignoresPersistentStateOnLaunch = "NO" | ||
61 | + debugDocumentVersioning = "YES" | ||
62 | + debugServiceExtension = "internal" | ||
63 | + allowLocationSimulation = "YES"> | ||
64 | + <BuildableProductRunnable | ||
65 | + runnableDebuggingMode = "0"> | ||
66 | + <BuildableReference | ||
67 | + BuildableIdentifier = "primary" | ||
68 | + BlueprintIdentifier = "BB5F3C871C1811BC00DA339D" | ||
69 | + BuildableName = "Demo.app" | ||
70 | + BlueprintName = "Demo" | ||
71 | + ReferencedContainer = "container:Demo.xcodeproj"> | ||
72 | + </BuildableReference> | ||
73 | + </BuildableProductRunnable> | ||
74 | + <AdditionalOptions> | ||
75 | + </AdditionalOptions> | ||
76 | + </LaunchAction> | ||
77 | + <ProfileAction | ||
78 | + buildConfiguration = "Release" | ||
79 | + shouldUseLaunchSchemeArgsEnv = "YES" | ||
80 | + savedToolIdentifier = "" | ||
81 | + useCustomWorkingDirectory = "NO" | ||
82 | + debugDocumentVersioning = "YES"> | ||
83 | + <BuildableProductRunnable | ||
84 | + runnableDebuggingMode = "0"> | ||
85 | + <BuildableReference | ||
86 | + BuildableIdentifier = "primary" | ||
87 | + BlueprintIdentifier = "BB5F3C871C1811BC00DA339D" | ||
88 | + BuildableName = "Demo.app" | ||
89 | + BlueprintName = "Demo" | ||
90 | + ReferencedContainer = "container:Demo.xcodeproj"> | ||
91 | + </BuildableReference> | ||
92 | + </BuildableProductRunnable> | ||
93 | + </ProfileAction> | ||
94 | + <AnalyzeAction | ||
95 | + buildConfiguration = "Debug"> | ||
96 | + </AnalyzeAction> | ||
97 | + <ArchiveAction | ||
98 | + buildConfiguration = "Release" | ||
99 | + revealArchiveInOrganizer = "YES"> | ||
100 | + </ArchiveAction> | ||
101 | +</Scheme> |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
3 | +<plist version="1.0"> | ||
4 | +<dict> | ||
5 | + <key>SchemeUserState</key> | ||
6 | + <dict> | ||
7 | + <key>Demo.xcscheme</key> | ||
8 | + <dict> | ||
9 | + <key>orderHint</key> | ||
10 | + <integer>0</integer> | ||
11 | + </dict> | ||
12 | + </dict> | ||
13 | + <key>SuppressBuildableAutocreation</key> | ||
14 | + <dict> | ||
15 | + <key>BB5F3C871C1811BC00DA339D</key> | ||
16 | + <dict> | ||
17 | + <key>primary</key> | ||
18 | + <true/> | ||
19 | + </dict> | ||
20 | + <key>BB5F3CA01C1811BC00DA339D</key> | ||
21 | + <dict> | ||
22 | + <key>primary</key> | ||
23 | + <true/> | ||
24 | + </dict> | ||
25 | + </dict> | ||
26 | +</dict> | ||
27 | +</plist> |
1 | +// | ||
2 | +// AppDelegate.h | ||
3 | +// publiDemo | ||
4 | +// | ||
5 | +// Created by winFan on 11/30/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <UIKit/UIKit.h> | ||
10 | + | ||
11 | +@interface AppDelegate : UIResponder <UIApplicationDelegate> | ||
12 | + | ||
13 | +@property (strong, nonatomic) UIWindow *window; | ||
14 | + | ||
15 | + | ||
16 | +@end | ||
17 | + |
1 | +// | ||
2 | +// AppDelegate.m | ||
3 | +// publiDemo | ||
4 | +// | ||
5 | +// Created by winFan on 11/30/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import "AppDelegate.h" | ||
10 | +#import "ViewController.h" | ||
11 | +#import "PoolSdk.h" | ||
12 | +@interface AppDelegate () | ||
13 | + | ||
14 | +@end | ||
15 | + | ||
16 | +@implementation AppDelegate | ||
17 | + | ||
18 | + | ||
19 | +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | ||
20 | + // Override point for customization after application launch. | ||
21 | + return YES; | ||
22 | +} | ||
23 | + | ||
24 | +- (void)applicationWillResignActive:(UIApplication *)application { | ||
25 | + // 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. | ||
26 | + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. | ||
27 | +} | ||
28 | + | ||
29 | +- (void)applicationDidEnterBackground:(UIApplication *)application { | ||
30 | + // 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. | ||
31 | + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. | ||
32 | +} | ||
33 | + | ||
34 | +- (void)applicationWillEnterForeground:(UIApplication *)application { | ||
35 | + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. | ||
36 | +} | ||
37 | + | ||
38 | +- (void)applicationDidBecomeActive:(UIApplication *)application { | ||
39 | + // 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. | ||
40 | +} | ||
41 | + | ||
42 | +- (void)applicationWillTerminate:(UIApplication *)application { | ||
43 | + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. | ||
44 | +} | ||
45 | + | ||
46 | +- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{ | ||
47 | + NSLog(@"hanldeOpenURL%@",url.path ); | ||
48 | + [[PoolSdk shareSDK] handleOpenurl:url]; | ||
49 | + return true; | ||
50 | +} | ||
51 | + | ||
52 | + | ||
53 | +@end |
1 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
2 | +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES"> | ||
3 | + <dependencies> | ||
4 | + <deployment identifier="iOS"/> | ||
5 | + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/> | ||
6 | + <capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/> | ||
7 | + </dependencies> | ||
8 | + <objects> | ||
9 | + <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> | ||
10 | + <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> | ||
11 | + <view contentMode="scaleToFill" id="iN0-l3-epB"> | ||
12 | + <rect key="frame" x="0.0" y="0.0" width="480" height="480"/> | ||
13 | + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | ||
14 | + <subviews> | ||
15 | + <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2015 winFan. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye"> | ||
16 | + <rect key="frame" x="20" y="439" width="441" height="21"/> | ||
17 | + <fontDescription key="fontDescription" type="system" pointSize="17"/> | ||
18 | + <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> | ||
19 | + <nil key="highlightedColor"/> | ||
20 | + </label> | ||
21 | + <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Demo" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX"> | ||
22 | + <rect key="frame" x="20" y="140" width="441" height="43"/> | ||
23 | + <fontDescription key="fontDescription" type="boldSystem" pointSize="36"/> | ||
24 | + <color key="textColor" cocoaTouchSystemColor="darkTextColor"/> | ||
25 | + <nil key="highlightedColor"/> | ||
26 | + </label> | ||
27 | + </subviews> | ||
28 | + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> | ||
29 | + <constraints> | ||
30 | + <constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/> | ||
31 | + <constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/> | ||
32 | + <constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/> | ||
33 | + <constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/> | ||
34 | + <constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/> | ||
35 | + <constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/> | ||
36 | + </constraints> | ||
37 | + <nil key="simulatedStatusBarMetrics"/> | ||
38 | + <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/> | ||
39 | + <point key="canvasLocation" x="548" y="455"/> | ||
40 | + </view> | ||
41 | + </objects> | ||
42 | +</document> |
1 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
2 | +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="vXZ-lx-hvc"> | ||
3 | + <dependencies> | ||
4 | + <deployment identifier="iOS"/> | ||
5 | + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/> | ||
6 | + </dependencies> | ||
7 | + <scenes> | ||
8 | + <!--Main View Controller--> | ||
9 | + <scene sceneID="ufC-wZ-h7g"> | ||
10 | + <objects> | ||
11 | + <viewController id="vXZ-lx-hvc" customClass="MainViewController" sceneMemberID="viewController"> | ||
12 | + <layoutGuides> | ||
13 | + <viewControllerLayoutGuide type="top" id="jyV-Pf-zRb"/> | ||
14 | + <viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/> | ||
15 | + </layoutGuides> | ||
16 | + <view key="view" contentMode="scaleToFill" id="kh9-bI-dsS"> | ||
17 | + <rect key="frame" x="0.0" y="0.0" width="600" height="600"/> | ||
18 | + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> | ||
19 | + <subviews> | ||
20 | + <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="GQW-et-jRb"> | ||
21 | + <rect key="frame" x="196" y="71" width="208" height="30"/> | ||
22 | + <state key="normal" title="初始化"/> | ||
23 | + <connections> | ||
24 | + <action selector="actionInit:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="Srh-bu-gYD"/> | ||
25 | + </connections> | ||
26 | + </button> | ||
27 | + <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="s0O-FE-ge8"> | ||
28 | + <rect key="frame" x="213" y="123" width="175" height="30"/> | ||
29 | + <state key="normal" title="登录"/> | ||
30 | + <connections> | ||
31 | + <action selector="actionLogin:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="381-gB-ImA"/> | ||
32 | + </connections> | ||
33 | + </button> | ||
34 | + <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="JQY-uO-q36"> | ||
35 | + <rect key="frame" x="205" y="168" width="191" height="30"/> | ||
36 | + <state key="normal" title="充值"/> | ||
37 | + <connections> | ||
38 | + <action selector="actionPay:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="bvf-M4-rqy"/> | ||
39 | + </connections> | ||
40 | + </button> | ||
41 | + <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5na-1c-IlO"> | ||
42 | + <rect key="frame" x="250" y="218" width="100" height="30"/> | ||
43 | + <state key="normal" title="数据"/> | ||
44 | + <connections> | ||
45 | + <action selector="actionSubmitRoleData:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="aNf-Iw-unv"/> | ||
46 | + </connections> | ||
47 | + </button> | ||
48 | + <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Q9b-py-Nk0"> | ||
49 | + <rect key="frame" x="233" y="268" width="134" height="30"/> | ||
50 | + <state key="normal" title="注销"/> | ||
51 | + <connections> | ||
52 | + <action selector="actionLogout:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="t6e-7P-tJU"/> | ||
53 | + </connections> | ||
54 | + </button> | ||
55 | + </subviews> | ||
56 | + <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> | ||
57 | + </view> | ||
58 | + </viewController> | ||
59 | + <placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/> | ||
60 | + </objects> | ||
61 | + <point key="canvasLocation" x="445" y="282"/> | ||
62 | + </scene> | ||
63 | + </scenes> | ||
64 | +</document> |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
3 | +<plist version="1.0"> | ||
4 | +<dict> | ||
5 | + <key>CFBundleDevelopmentRegion</key> | ||
6 | + <string>en</string> | ||
7 | + <key>CFBundleExecutable</key> | ||
8 | + <string>$(EXECUTABLE_NAME)</string> | ||
9 | + <key>CFBundleIdentifier</key> | ||
10 | + <string>com.mango.ios.fytx</string> | ||
11 | + <key>CFBundleInfoDictionaryVersion</key> | ||
12 | + <string>6.0</string> | ||
13 | + <key>CFBundleName</key> | ||
14 | + <string>$(PRODUCT_NAME)</string> | ||
15 | + <key>CFBundlePackageType</key> | ||
16 | + <string>APPL</string> | ||
17 | + <key>CFBundleShortVersionString</key> | ||
18 | + <string>1.0</string> | ||
19 | + <key>CFBundleSignature</key> | ||
20 | + <string>????</string> | ||
21 | + <key>CFBundleVersion</key> | ||
22 | + <string>1</string> | ||
23 | + <key>LSRequiresIPhoneOS</key> | ||
24 | + <true/> | ||
25 | + <key>UILaunchStoryboardName</key> | ||
26 | + <string>LaunchScreen</string> | ||
27 | + <key>UIMainStoryboardFile</key> | ||
28 | + <string>Main</string> | ||
29 | + <key>UIRequiredDeviceCapabilities</key> | ||
30 | + <array> | ||
31 | + <string>armv7</string> | ||
32 | + </array> | ||
33 | + <key>UISupportedInterfaceOrientations</key> | ||
34 | + <array> | ||
35 | + <string>UIInterfaceOrientationPortrait</string> | ||
36 | + <string>UIInterfaceOrientationLandscapeLeft</string> | ||
37 | + <string>UIInterfaceOrientationLandscapeRight</string> | ||
38 | + </array> | ||
39 | +</dict> | ||
40 | +</plist> |
1 | +// | ||
2 | +// MainViewController.m | ||
3 | +// Demo_qiyu | ||
4 | +// | ||
5 | +// Created by 许 on 17/6/7. | ||
6 | +// Copyright © 2017年 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import "MainViewController.h" | ||
10 | +#import "PoolSdk.h" | ||
11 | + | ||
12 | +@interface MainViewController () | ||
13 | + | ||
14 | +@end | ||
15 | + | ||
16 | +@implementation MainViewController | ||
17 | + | ||
18 | +- (void)viewDidLoad { | ||
19 | + [super viewDidLoad]; | ||
20 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveSDKMessage:) name:poolSDK_Notification object:nil]; | ||
21 | + // Do any additional setup after loading the view. | ||
22 | +} | ||
23 | + | ||
24 | +- (void)didReceiveMemoryWarning { | ||
25 | + [super didReceiveMemoryWarning]; | ||
26 | + // Dispose of any resources that can be recreated. | ||
27 | +} | ||
28 | + | ||
29 | +/* | ||
30 | +#pragma mark - Navigation | ||
31 | + | ||
32 | +// In a storyboard-based application, you will often want to do a little preparation before navigation | ||
33 | +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | ||
34 | + // Get the new view controller using [segue destinationViewController]. | ||
35 | + // Pass the selected object to the new view controller. | ||
36 | +} | ||
37 | +*/ | ||
38 | + | ||
39 | +-(void)viewDidAppear:(BOOL)animated{ | ||
40 | + [super viewDidAppear:animated]; | ||
41 | + //[[PoolSdk shareSDK] viewDidAppear]; | ||
42 | +} | ||
43 | + | ||
44 | + | ||
45 | +- (void)receiveSDKMessage:(NSNotification *)notification | ||
46 | +{ | ||
47 | + PoolSDKResult *result = [notification object]; | ||
48 | + if (result) { | ||
49 | + NSLog(@"notiType:%d",result.notiType); | ||
50 | + switch (result.notiType) { | ||
51 | + | ||
52 | + case PoolSDKNotificationInitSDK: | ||
53 | + { | ||
54 | + NSLog(@"sdk初始化成功"); | ||
55 | + } | ||
56 | + | ||
57 | + break; | ||
58 | + case PoolSDKNotificationLogin: | ||
59 | + { | ||
60 | + NSLog(@"result state:%d",result.statusCode); | ||
61 | + if (result.statusCode == POOLSDK_NO_ERROR) { | ||
62 | + PoolLoginInfo *loginInfo = (PoolLoginInfo*)result.extendData; | ||
63 | + NSLog(@"收到登陆信息public openid:%@", [loginInfo openId]); | ||
64 | + NSLog(@"收到登陆信息public token:%@", [loginInfo sign]); | ||
65 | + NSLog(@"收到登陆信息public timestamp:%@", [loginInfo timestamp]); | ||
66 | + NSLog(@"userType:%@",[loginInfo userType]); | ||
67 | + }else{ | ||
68 | + NSLog(@"%@",[result description]); | ||
69 | + } | ||
70 | + } | ||
71 | + break; | ||
72 | + case PoolSDKNotificationLogout: | ||
73 | + { | ||
74 | + NSLog(@"sdk注销成功,游戏处理"); | ||
75 | + } | ||
76 | + break; | ||
77 | + default: | ||
78 | + break; | ||
79 | + } | ||
80 | + } | ||
81 | +} | ||
82 | + | ||
83 | +- (IBAction)actionInit:(id)sender { | ||
84 | + [[PoolSdk shareSDK]initSDK:self]; | ||
85 | +} | ||
86 | +- (IBAction)actionLogin:(id)sender { | ||
87 | + [[PoolSdk shareSDK] loginSDK]; | ||
88 | +} | ||
89 | + | ||
90 | +- (IBAction)actionPay:(id)sender { | ||
91 | + PoolCreateOrderInfo *payInfo = [[PoolCreateOrderInfo alloc]init]; | ||
92 | + [payInfo setServerId:@"111"]; | ||
93 | + [payInfo setPlayerName:@"roleName"]; | ||
94 | + [payInfo setPlayerLevel:@"10"]; | ||
95 | + [payInfo setPostAmount:@"6"]; | ||
96 | + [payInfo setProductId:@"com.fytx.6"]; | ||
97 | + [payInfo setPlayerId:@"1231241234"]; | ||
98 | + [payInfo setTimestamp:@"1232134"]; | ||
99 | + [payInfo setExchange:@"10"]; | ||
100 | + [payInfo setCustom:@"custom"]; | ||
101 | + NSLog(@"start pay"); | ||
102 | + [[PoolSdk shareSDK] payWithPaymentInfo:payInfo]; | ||
103 | +} | ||
104 | + | ||
105 | + | ||
106 | +/** | ||
107 | + serverid | ||
108 | + servername | ||
109 | + roleid | ||
110 | + rolename | ||
111 | + rolelevel | ||
112 | +*/ | ||
113 | +- (IBAction)actionSubmitRoleData:(id)sender { | ||
114 | + NSLog(@"数据接口"); | ||
115 | + PoolReportInfo *reportInfo = [[PoolReportInfo alloc]init]; | ||
116 | + [reportInfo setReportType:REPORT_ENTER]; | ||
117 | + //[reportInfo setReportType:REPORT_CREATEROLE]; | ||
118 | + //[reportInfo setReportType:REPORT_ROLEUPGRADE] | ||
119 | + [reportInfo setServerId:@"9133"]; | ||
120 | + [reportInfo setServerName:@"serverName"]; | ||
121 | + [reportInfo setPlayerId:@"123456"]; | ||
122 | + [reportInfo setPlayerName:@"playName"]; | ||
123 | + [reportInfo setPlayerLevel:@"100"]; | ||
124 | + [[PoolSdk shareSDK] reportSDK:reportInfo]; | ||
125 | +} | ||
126 | + | ||
127 | +- (IBAction)actionLogout:(id)sender { | ||
128 | + NSLog(@"注销"); | ||
129 | + [[PoolSdk shareSDK] logoutSDK]; | ||
130 | +} | ||
131 | + | ||
132 | + | ||
133 | +@end |
1 | +// | ||
2 | +// PGLogger.h | ||
3 | +// PanguCommonLib | ||
4 | +// | ||
5 | +// Created by ouyanghua on 14-2-22. | ||
6 | +// Copyright (c) 2014年 pangu. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | + | ||
11 | +void DGLog(NSString *fmt, ...); | ||
12 | + | ||
13 | +typedef NS_ENUM(NSInteger, DGLoggerLevel) | ||
14 | +{ | ||
15 | + ELogVerbose = 1, | ||
16 | + ELogDebug, | ||
17 | + ELogInfo, | ||
18 | + ELogWarn, | ||
19 | + ELogError | ||
20 | +}; | ||
21 | + | ||
22 | +@interface DGLogger : NSObject | ||
23 | + | ||
24 | ++ (void)showLog:(NSString *)fmt,...; | ||
25 | + | ||
26 | ++ (void)showLog:(DGLoggerLevel)level log:(NSString *)fmt,...; | ||
27 | + | ||
28 | ++ (void)isShowLog:(BOOL)flag; | ||
29 | + | ||
30 | +@end |
1 | +// | ||
2 | +// Interface.h | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 12/10/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | + | ||
10 | +#include "UnionInterface.h" | ||
11 | +#import <SafariServices/SafariServices.h> | ||
12 | +@interface Interface : NSObject <UnionInterface,SFSafariViewControllerDelegate> | ||
13 | +@property(nonatomic, strong)UIViewController *controller; | ||
14 | + | ||
15 | + | ||
16 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// NetCenter.h | ||
3 | +// public_i9133 | ||
4 | +// | ||
5 | +// Created by winFan on 12/2/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | + | ||
11 | +@interface NetCenter : NSObject | ||
12 | + | ||
13 | +@property(nonatomic,retain) NSMutableData *receiveData; | ||
14 | + | ||
15 | +@property(nonatomic,assign)int dataPackSerialNo; | ||
16 | + | ||
17 | + | ||
18 | ++ (NetCenter *)getInstance; | ||
19 | + | ||
20 | +- (NSString *)httpGetSyn:(NSString *) getUrl; | ||
21 | + | ||
22 | +- (NSString *)httpPostSyn:(NSString *) postUrl : (NSDictionary *) postData; | ||
23 | + | ||
24 | +- (void)httpGetNoSyn; | ||
25 | + | ||
26 | +- (void)httpPostNoSyn:(NSString *) postUrl :(NSDictionary *)postDict; | ||
27 | + | ||
28 | +- (void)httpPostAsync:(NSString*)postUrl :(NSDictionary*)postDict; | ||
29 | + | ||
30 | +- (void)httpPostAsyncOpen:(NSString*)postUrl :(NSDictionary*)postDict; | ||
31 | + | ||
32 | +- (NSString *)dicToString:(NSDictionary *) dict; | ||
33 | +@end |
1 | +// | ||
2 | +// OtherSetting.h | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 11/23/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#ifndef __PoolSdk__OtherSetting__ | ||
10 | +#define __PoolSdk__OtherSetting__ | ||
11 | + | ||
12 | + | ||
13 | +/** | ||
14 | + 应用支持的方向 | ||
15 | + */ | ||
16 | +typedef NS_ENUM(NSUInteger, ESDKOrientation) { | ||
17 | + ESDKOrientationPortrait = 1,//竖 | ||
18 | + ESDKOrientationLandscape,//横 | ||
19 | + ESDKOrientationNone//自动旋转 | ||
20 | +}; | ||
21 | + | ||
22 | +/** | ||
23 | + 应用支持的方向 | ||
24 | + */ | ||
25 | +typedef NS_ENUM(NSUInteger, REPORT_TYPE) { | ||
26 | + REPORT_TYPE_OPEN = 1,//竖 | ||
27 | + REPORT_TYPE_ENTER,//横 | ||
28 | + REPORT_TYPE_DEFINE//自动旋转 | ||
29 | +}; | ||
30 | + | ||
31 | +#endif /* defined(__PoolSdk__OtherSetting__) */ |
1 | +// | ||
2 | +// PoolBaseModel.h | ||
3 | +// public_i9133 | ||
4 | +// | ||
5 | +// Created by winFan on 12/2/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | + | ||
10 | +#import <Foundation/Foundation.h> | ||
11 | +#import "OtherSetting.h" | ||
12 | +@interface PoolBaseModel : NSObject | ||
13 | + | ||
14 | +- (NSString *)objectToJsonString; | ||
15 | +- (NSMutableString *)paramAddToString; | ||
16 | +- (id)initWithDiction:(NSDictionary *)diction; | ||
17 | + | ||
18 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// PoolLoginChecker.h | ||
3 | +// public_i9133 | ||
4 | +// | ||
5 | +// Created by winFan on 12/1/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | +#import <Foundation/Foundation.h> | ||
9 | +#import "PoolSdk/PoolLoginInfo.h" | ||
10 | +#import "PoolSdk/PoolNotification.h" | ||
11 | +#import "PoolSdk/PoolCreateOrderInfo.h" | ||
12 | +#import "PoolSdk/PoolPayInfo.h" | ||
13 | +#import "PoolReportInfo.h" | ||
14 | +#import "PoolSdkDelegate.h" | ||
15 | + | ||
16 | +@interface PoolChecker : NSObject<PoolSdkDelegate> | ||
17 | +@property(nonatomic, strong)NSString *userId; | ||
18 | +@property(nonatomic, strong)id<PoolSdkDelegate> mPoolSdkDelegate; | ||
19 | + | ||
20 | +@property bool onlyOneTimePay; | ||
21 | ++ (PoolChecker *)getInstance; | ||
22 | +- (void)initChecker; | ||
23 | +- (void)startCheck:(PoolLoginInfo *)loginInfo; | ||
24 | +- (void) createOrder:(PoolCreateOrderInfo *)payInfo; | ||
25 | +- (void) reportOpen; | ||
26 | +- (void) reportSDKOpen; | ||
27 | +- (void)handleFirstOpenApp:(NSString*) path; | ||
28 | +- (void) reportEnter:(PoolReportInfo *)reInfo; | ||
29 | +- (void) report:(NSString *)_action :(PoolReportInfo *)reInfo; | ||
30 | +- (void)sendNotice:(PoolSDKNotificationType)notiType | ||
31 | + notiName:(NSString *)notiName | ||
32 | + statusCode:(int)nCode | ||
33 | + description:(NSString *)szDescripton | ||
34 | + extendData:(NSObject *)extendData; | ||
35 | + | ||
36 | +- (void)startCheckDelegate:(PoolLoginInfo *)loginInfo; | ||
37 | +- (void)setPoolSdkDelegate:(nullable id<PoolSdkDelegate>)poolSdkDeletate; | ||
38 | +@end | ||
39 | + | ||
40 | + | ||
41 | + | ||
42 | + |
1 | +// | ||
2 | +// PoolConfig.h | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 12/11/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | + | ||
11 | +@interface PoolConfig : NSObject | ||
12 | + | ||
13 | +@property(nonatomic, strong)NSString *gameSimpleName; | ||
14 | +@property(nonatomic, strong)NSString *sdkSimpleName; | ||
15 | +@property(nonatomic, strong)NSString *sdkVersionCode; | ||
16 | +@property(nonatomic, strong)NSString *loginCheckUrl; | ||
17 | +@property(nonatomic, strong)NSString *payOrderUrl; | ||
18 | +@property(nonatomic, strong)NSString *payCheckUrl; | ||
19 | +@property(nonatomic, strong)NSString *c1; | ||
20 | +@property(nonatomic, strong)NSString *c2; | ||
21 | +@property(nonatomic, strong)NSString *custom; | ||
22 | + | ||
23 | ++ (PoolConfig *)getInstance; | ||
24 | + | ||
25 | +- (void) loadFile:(NSString *) fileName; | ||
26 | + | ||
27 | +- (NSString *)getValueByKey:(NSString *) key; | ||
28 | + | ||
29 | +- (void) updateC1C2Value:(NSString *)c1 c2:(NSString *)c2; | ||
30 | + | ||
31 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// PayInfo.h | ||
3 | +// public_i9133 | ||
4 | +// | ||
5 | +// Created by winFan on 12/3/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | + | ||
10 | +#import "PoolSdk/PoolBaseModel.h" | ||
11 | +@interface PoolCreateOrderInfo : PoolBaseModel | ||
12 | + | ||
13 | +@property(nonatomic,strong)NSString *serverId;//服务器ID | ||
14 | +@property(nonatomic, strong)NSString *serverName;//角色名称 | ||
15 | +@property(nonatomic, strong)NSString *playerId;//玩家ID | ||
16 | +@property(nonatomic, strong)NSString *playerName;//玩家名称 | ||
17 | +@property(nonatomic, strong)NSString *playerLevel;//玩家等级 | ||
18 | +@property(nonatomic, strong)NSString *postAmount;//金额 | ||
19 | +@property(nonatomic, strong)NSString *productId;//产品ID | ||
20 | +@property(nonatomic, strong)NSString *productName;//产品名称 | ||
21 | +@property(nonatomic, strong)NSString *productDesc;//产品描述 | ||
22 | +@property(nonatomic, strong)NSString *custom;//透传参数 | ||
23 | +@property(nonatomic, strong)NSString *exchange;//兑换比例 | ||
24 | +@property(nonatomic, strong)NSString *otherInfo;//扩展参数 | ||
25 | +@property(nonatomic, strong)NSString *userId;//用户ID | ||
26 | +@property(nonatomic, strong)NSString *timestamp;//时间戳 | ||
27 | + | ||
28 | +- (NSString *) getTsign ; | ||
29 | +- (NSString *) getTimestamp ; | ||
30 | + | ||
31 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// PoolLoginInfo.h | ||
3 | +// public_i9133 | ||
4 | +// | ||
5 | +// Created by winFan on 12/1/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import "PoolSdk/PoolBaseModel.h" | ||
10 | +@interface PoolLoginInfo : PoolBaseModel | ||
11 | + | ||
12 | +@property(nonatomic,strong)NSString *timestamp; | ||
13 | +@property(nonatomic, strong)NSString *sign;//serverSign | ||
14 | +@property(nonatomic, strong)NSString *other;//透传 | ||
15 | +@property(nonatomic, strong)NSString *openId; | ||
16 | +@property(nonatomic, strong)NSString *userType; | ||
17 | + | ||
18 | + | ||
19 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// PoolNotification.h | ||
3 | +// public_i9133 | ||
4 | +// | ||
5 | +// Created by winFan on 12/1/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | + | ||
11 | +extern NSString * const poolSDK_Notification; /**< */ | ||
12 | +extern NSString * const _create_order_notification; /**< */ | ||
13 | + | ||
14 | + | ||
15 | +/** | ||
16 | + 应用支持的方向 | ||
17 | + */ | ||
18 | +typedef NS_ENUM(int, PoolSDKNotificationType) { | ||
19 | + PoolSDKNotificationLogin = 1,//登录 | ||
20 | + PoolSDKNotificationLogout,//注销 | ||
21 | + PoolSDKNotificationPay,//支付完成 | ||
22 | + PoolSDKNotificationPause,//暂停退出 | ||
23 | + PoolSDKNotificationRole,//创建角色 | ||
24 | + PoolSDKNotificationInitSDK//初始化SDK | ||
25 | +}; | ||
26 | + | ||
27 | + | ||
28 | + | ||
29 | +@interface PoolNotification : NSObject | ||
30 | + | ||
31 | +@end | ||
32 | + | ||
33 | + | ||
34 | +////////////////////////////////////////////////////////////////////// | ||
35 | +@interface PoolSDKResult : NSObject | ||
36 | +@property(nonatomic, assign)int statusCode;//请参照此文件下面状态标识 | ||
37 | +@property(nonatomic, strong)NSString *resultDescription; | ||
38 | +@property(nonatomic, strong)NSObject *extendData; | ||
39 | +//V1.2.0新增 | ||
40 | +@property(nonatomic, assign)PoolSDKNotificationType notiType;//消息类型 | ||
41 | +@property(nonatomic, strong)NSString *notiName;//消息名称 | ||
42 | +@end | ||
43 | +////////////////////////////////////////////////////////////////////// | ||
44 | + | ||
45 | +////////////////////////////////////////////////////////////////////// | ||
46 | +/* 状态标识 */ | ||
47 | +#define POOLSDK_NO_ERROR 0 /*操作成功*/ | ||
48 | + | ||
49 | +#define POOLSDK_ERROR_LOGIN_FAILED -100 /*登录失败*/ | ||
50 | +#define POOLSDK_ERROR_LOGIN_CANCEL -101 /*登录取消*/ | ||
51 | +#define POOLSDK_ERROR_LOGIN_GAMGEACCOUNT -102 /*游戏帐号登录,非平台账号*/ | ||
52 | + | ||
53 | +#define POOLSDK_ERROR_PAY_FAILED -200 /*支付失败*/ | ||
54 | +#define POOLSDK_ERROR_PAY_CANCEL -201 /*支付取消*/ | ||
55 | +#define POOLSDK_ERROR_PAY_VERSIGN -202 /*支付验签失败*/ | ||
56 | +#define POOLSDK_ERROR_CREATE_ORDER_FAILED -203 /*支付验签失败*/ | ||
57 | + | ||
58 | +#define POOLSDK_ERROR_ROLE_CREATE_FAILED -300 /*角色创建失败*/ | ||
59 | + | ||
60 | +#define POOLSDK_ERROR_INIT_FAILED -400 /*初始化失败*/ | ||
61 | + | ||
62 | +////////////////////////////////////////////////////////////////////// |
1 | +// | ||
2 | +// PoolPayInfo.h | ||
3 | +// public_i9133 | ||
4 | +// | ||
5 | +// Created by winFan on 12/3/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | + | ||
10 | +#import "PoolSdk/PoolBaseModel.h" | ||
11 | +@interface PoolPayInfo : PoolBaseModel | ||
12 | + | ||
13 | +@property(nonatomic, strong)NSString *serverId; | ||
14 | +@property(nonatomic, strong)NSString *queryId; | ||
15 | +@property(nonatomic, strong)NSString *playerId; | ||
16 | +@property(nonatomic, strong)NSString *playerName; | ||
17 | +@property(nonatomic, strong)NSString *postAmount; | ||
18 | +@property(nonatomic, strong)NSString *productId; | ||
19 | +@property(nonatomic, strong)NSString *products; | ||
20 | +@property(nonatomic, strong)NSString *custom; | ||
21 | +@property(nonatomic, strong)NSString *postTime; | ||
22 | +@property(nonatomic, strong)NSString *other; | ||
23 | +@property(nonatomic, strong)NSString *isOpenThirdPay;//是否开启第三方充值 | ||
24 | + | ||
25 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// PoolReportInfo.h | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 12/21/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import "PoolSdk/PoolBaseModel.h" | ||
10 | +@interface PoolReportInfo : PoolBaseModel | ||
11 | + | ||
12 | +@property(nonatomic, strong)NSString *serverId;//服务器ID | ||
13 | +@property(nonatomic, strong)NSString *serverName;//服务器名称 | ||
14 | +@property(nonatomic, strong)NSString *playerId;//玩家ID | ||
15 | +@property(nonatomic, strong)NSString *playerName;//玩家名称 | ||
16 | +@property(nonatomic, strong)NSString *playerLevel;//玩家等级 | ||
17 | +@property(nonatomic, strong)NSString *custom;//透传参数 | ||
18 | +@property(nonatomic, strong)NSString *reportType;//类型 | ||
19 | + | ||
20 | + | ||
21 | +@property(nonatomic, strong)NSString *openId; | ||
22 | + | ||
23 | +#define REPORT_URL @"https://statistic.public.sdk.gzyouai.com/sdk/statistic" //@http://public.sdk.gzyouai.com:9030/sdk/statistic"//@"http://10.200.201.230:9001/sdk/statistic"//@"https://statistic.public.sdk.gzyouai.com/sdk/statistic"// | ||
24 | +#define REPORT_OPEN @"open" | ||
25 | +#define REPORT_ENTER @"enter" | ||
26 | +#define REPORT_CREATEROLE @"createrole" | ||
27 | +#define REPORT_ROLEUPGRADE @"roleupgrade" | ||
28 | +#define REPORT_SDK_OPEN @"opensdk" | ||
29 | + | ||
30 | +@end |
1 | +// | ||
2 | +// PoolSdk.h | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 11/23/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | +#import <PoolSdk/PoolSdk2.h> | ||
11 | +#import <UIKit/UIKit.h> | ||
12 | +#import "TrackingIO.h" | ||
13 | + | ||
14 | +@interface PoolSdk : NSObject | ||
15 | +/** | ||
16 | + * 当前SDK的版本 | ||
17 | + */ | ||
18 | +@property(nonatomic, strong, readonly)NSString *sdkVersion; | ||
19 | + | ||
20 | +/** | ||
21 | + * 用于设置url types schemes 默认为工程名 | ||
22 | + */ | ||
23 | +@property(nonatomic, strong)NSString *urlSchemes; | ||
24 | + | ||
25 | +/** | ||
26 | + 获取SDK实例对象 | ||
27 | + */ | ||
28 | ++ (PoolSdk *)shareSDK; | ||
29 | + | ||
30 | +/** | ||
31 | + 初始化SDK | ||
32 | + */ | ||
33 | +- (void)initSDK:(UIViewController *) control; | ||
34 | + | ||
35 | + | ||
36 | +-(void)viewDidAppear; | ||
37 | + | ||
38 | +/** | ||
39 | + 登录SDK | ||
40 | + */ | ||
41 | +- (void)loginSDK; | ||
42 | + | ||
43 | +/** | ||
44 | + 进行支付 | ||
45 | + */ | ||
46 | +- (void)payWithPaymentInfo:(PoolCreateOrderInfo *)payInfo; | ||
47 | + | ||
48 | +/** | ||
49 | + 用户中心 | ||
50 | + */ | ||
51 | +- (void)gotoUserCenter; | ||
52 | + | ||
53 | +/** | ||
54 | + report | ||
55 | + */ | ||
56 | +- (void)reportSDK:(PoolReportInfo *)reportInfo; | ||
57 | + | ||
58 | +/** | ||
59 | + 注销 | ||
60 | + */ | ||
61 | +- (void)logoutSDK; | ||
62 | + | ||
63 | +/** | ||
64 | + 退出 | ||
65 | + */ | ||
66 | +- (void)exitSDK; | ||
67 | + | ||
68 | + | ||
69 | + | ||
70 | +/** | ||
71 | + 显示/隐藏浮标 | ||
72 | + */ | ||
73 | +//- (void)showFloatIcon:(BOOL)bFlag; | ||
74 | + | ||
75 | + | ||
76 | +/** | ||
77 | + // called in - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url | ||
78 | + */ | ||
79 | +- (void)handleOpenurl:(NSURL *)url; | ||
80 | + | ||
81 | +- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window; | ||
82 | +/** | ||
83 | + 应用 appid | ||
84 | + */ | ||
85 | + | ||
86 | +/** | ||
87 | + 应用支持的方向 默认为 EDreamSDKOrientationLandscape | ||
88 | + */ | ||
89 | +@property(nonatomic, assign)ESDKOrientation sdkOrientation; | ||
90 | + | ||
91 | +/** | ||
92 | + 浮标是否已经显示,默认为NO | ||
93 | + */ | ||
94 | +@property(nonatomic, assign)BOOL bShowedFloat; | ||
95 | + | ||
96 | + | ||
97 | +/** | ||
98 | + serverId | ||
99 | + */ | ||
100 | +@property(nonatomic, assign)int serverId; | ||
101 | + | ||
102 | +/** | ||
103 | + 获取gamechannelid | ||
104 | + */ | ||
105 | +-(NSString *) getGameChannelId; | ||
106 | + | ||
107 | +/** | ||
108 | + 获取Custom | ||
109 | + */ | ||
110 | +- (NSString *) getCustomValue; | ||
111 | + | ||
112 | +/** | ||
113 | + 获取ChannelParameter1 | ||
114 | + */ | ||
115 | +- (NSString *) getChannelParameter1; | ||
116 | + | ||
117 | +/** | ||
118 | + 获取ChannelParameter2 | ||
119 | + */ | ||
120 | +- (NSString *) getChannelParameter2; | ||
121 | + | ||
122 | + | ||
123 | +@end |
1 | +// | ||
2 | +// PoolSdk.h | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by 许 on 16/1/15. | ||
6 | +// Copyright © 2016年 许. All rights reserved. | ||
7 | +// | ||
8 | +// In this header, you should import all the public headers of your framework using statements like #import <PoolSdk/PublicHeader.h> | ||
9 | + | ||
10 | +#import <UIKit/UIKit.h> | ||
11 | +#import "PoolChecker.h" | ||
12 | +#import "Interface.h" | ||
13 | +#import "PoolReportInfo.h" | ||
14 | +#import "PoolLoginInfo.h" | ||
15 | +#import "PoolNotification.h" | ||
16 | +#import "PoolPayInfo.h" | ||
17 | +#import "UnionInterface.h" | ||
18 | +#import "PoolCreateOrderInfo.h" | ||
19 | +#import "PoolConfig.h" | ||
20 | +#import "TrackingIO.h" | ||
21 | +#import "PoolUtils.h" | ||
22 | +#import "NetCenter.h" | ||
23 | +#import "PoolSdkDelegate.h" | ||
24 | + |
1 | +// | ||
2 | +// PoolSdkDelegate.h | ||
3 | +// PoolSdk_i9133 | ||
4 | +// | ||
5 | +// Created by 许 on 17/6/30. | ||
6 | +// Copyright © 2017年 许. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | + | ||
11 | +@protocol PoolSdkDelegate <NSObject> | ||
12 | +@optional | ||
13 | +-(void)PoolSdkLoginSuccess:(PoolLoginInfo*)loginInfo; | ||
14 | +-(void)PoolSdkLoginFail:(NSString*)msg; | ||
15 | +@end |
1 | +// | ||
2 | +// PoolUtils.h | ||
3 | +// public_i9133 | ||
4 | +// | ||
5 | +// Created by winFan on 12/3/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | + | ||
10 | +#import <Foundation/Foundation.h> | ||
11 | +@interface PoolUtils : NSObject | ||
12 | + | ||
13 | ++(NSString *)md5:(NSString *)str; | ||
14 | ++ (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString; | ||
15 | ++(NSString *)createPayOrderUrl; | ||
16 | +//*充值回调地址 | ||
17 | ++(NSString *)createPayUrl; | ||
18 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// NewTtack.h | ||
3 | +// NewTtack | ||
4 | +// | ||
5 | +// Created by yun on 16/1/11. | ||
6 | +// Copyright © 2016年 yun. All rights reserved. | ||
7 | +// | ||
8 | +#define TRACK_VERSION @"1.0.1" | ||
9 | + | ||
10 | +#import <Foundation/Foundation.h> | ||
11 | +#import <UIKit/UIKit.h> | ||
12 | + | ||
13 | + | ||
14 | +/* | ||
15 | + 热云移动广告效果监测 平台 api 请选择对应的api进行使用 | ||
16 | + */ | ||
17 | +NS_ASSUME_NONNULL_BEGIN | ||
18 | +@interface TrackingIO : NSObject | ||
19 | +//开启打印日志 正式上线包请关掉 | ||
20 | ++(void) setPrintLog :(BOOL)print; | ||
21 | +// 开启数据统计 | ||
22 | ++ (void)initWithappKey:(NSString *)appKey withChannelId:(NSString *)channelId; | ||
23 | +//注册成功后调用 | ||
24 | ++ (void)setRegisterWithAccountID:(NSString *)account; | ||
25 | +//登陆成功后调用 | ||
26 | ++ (void)setLoginWithAccountID:(NSString *)account; | ||
27 | +//开始付费时 调用(人民币单位是元) | ||
28 | ++(void)setPaymentStart:(NSString *)transactionId paymentType:(NSString*)paymentType currentType:(NSString*)currencyType currencyAmount:(float)currencyAmount; | ||
29 | +// 支付完成,付费分析,记录玩家充值的金额(人民币单位是元) | ||
30 | ++(void)setPayment:(NSString *)transactionId paymentType:(NSString*)paymentType currentType:(NSString*)currencyType currencyAmount:(float)currencyAmount; | ||
31 | +//自定义事件 | ||
32 | ++(void)setEvent:(NSString *)eventName andExtra:(nullable NSDictionary *)extra; | ||
33 | +//标准接口 | ||
34 | ++(void)setProfile:(NSDictionary *)dataDic; | ||
35 | +//获取设备信息 | ||
36 | ++(NSString*)getDeviceId; | ||
37 | +@end | ||
38 | +NS_ASSUME_NONNULL_END |
1 | +// | ||
2 | +// UnionInterface.h | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 11/23/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | +#import <Foundation/Foundation.h> | ||
9 | +#import <UIKit/UIKit.h> | ||
10 | +#import "PoolCreateOrderInfo.h" | ||
11 | +#import "PoolReportInfo.h" | ||
12 | +@protocol UnionInterface | ||
13 | +/** | ||
14 | + 初始化SDK | ||
15 | + */ | ||
16 | + | ||
17 | +//[[PoolChecker getInstance] sendNotice:PoolSDKNotificationPay notiName:@"" statusCode:POOLSDK_NO_ERROR description:@"" extendData:order_id]; | ||
18 | + | ||
19 | +- (void)SDKinit:(UIViewController *) control; | ||
20 | + | ||
21 | +/** | ||
22 | + 登录SDK | ||
23 | + */ | ||
24 | +- (void)SDKloginSDK; | ||
25 | + | ||
26 | +/** | ||
27 | + 注销 | ||
28 | + */ | ||
29 | +- (void)SDKlogoutSDK; | ||
30 | + | ||
31 | +/** | ||
32 | + 退出 | ||
33 | + */ | ||
34 | +- (void)SDKexitSDK; | ||
35 | + | ||
36 | +/** | ||
37 | + 用户中心 | ||
38 | + */ | ||
39 | +- (void)SDKgotoUserCenter; | ||
40 | + | ||
41 | +- (void)viewDidAppear; | ||
42 | + | ||
43 | +/** | ||
44 | + 提交数据 | ||
45 | + */ | ||
46 | +- (void)SDKreport:(PoolReportInfo *) reportInfo; | ||
47 | + | ||
48 | +/** | ||
49 | + 进行支付 | ||
50 | + */ | ||
51 | + | ||
52 | +- (void)SDKpayWithPaymentInfo:(PoolCreateOrderInfo *)payInfo; | ||
53 | +- (void)receiveCreateOrder: (NSNotification *)notification; | ||
54 | + | ||
55 | +- (void)handleOpenurl:(NSURL *)url; | ||
56 | +- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window; | ||
57 | + | ||
58 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// ViewController.h | ||
3 | +// publiDemo | ||
4 | +// | ||
5 | +// Created by winFan on 11/30/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <UIKit/UIKit.h> | ||
10 | + | ||
11 | +@interface ViewController : UIViewController | ||
12 | + | ||
13 | +- (void)receiveSDKMessage : (NSNotification *)notification; | ||
14 | + | ||
15 | +@end | ||
16 | + |
1 | + | ||
2 | +#import "ViewController.h" | ||
3 | +#import "PoolSdk.h" | ||
4 | + | ||
5 | +@interface ViewController () | ||
6 | + | ||
7 | +@end | ||
8 | + | ||
9 | +@implementation ViewController | ||
10 | + | ||
11 | + | ||
12 | +- (void)viewDidLoad { | ||
13 | + [super viewDidLoad]; | ||
14 | + // Do any additional setup after loading the view, typically from a nib. | ||
15 | + UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
16 | + [button1 setTitle:@"登陆" forState:UIControlStateNormal]; | ||
17 | + button1.frame = CGRectMake(50.0f, 100.0f, 50.0f, 40.0f); | ||
18 | + button1.tag = 1; | ||
19 | + [button1 addTarget:self action:@selector(toggleButton:) forControlEvents: UIControlEventTouchUpInside]; | ||
20 | + [self.view addSubview:button1]; | ||
21 | + | ||
22 | + UIButton *button2 = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
23 | + [button2 setTitle:@"数据" forState:UIControlStateNormal]; | ||
24 | + button2.frame = CGRectMake(150.0f, 100.0f, 50.0f, 40.0f); | ||
25 | + button2.tag = 2; | ||
26 | + [button2 addTarget:self action:@selector(toggleButton:) forControlEvents: UIControlEventTouchUpInside]; | ||
27 | + [self.view addSubview:button2]; | ||
28 | + | ||
29 | + UIButton *button4 = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
30 | + [button4 setTitle:@"充值" forState:UIControlStateNormal]; | ||
31 | + button4.frame = CGRectMake(150.0f, 50.0f, 50.0f, 40.0f); | ||
32 | + button4.tag = 4; | ||
33 | + [button4 addTarget:self action:@selector(toggleButton:) forControlEvents: UIControlEventTouchUpInside]; | ||
34 | + [self.view addSubview:button4]; | ||
35 | + | ||
36 | + | ||
37 | + UIButton *button6 = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
38 | + [button6 setTitle:@"获取配置参数" forState:UIControlStateNormal]; | ||
39 | + button6.frame = CGRectMake(10.0f, 50.0f, 150.0f, 40.0f); | ||
40 | + button6.tag = 6; | ||
41 | + [button6 addTarget:self action:@selector(toggleButton:) forControlEvents: UIControlEventTouchUpInside]; | ||
42 | + [self.view addSubview:button6]; | ||
43 | + | ||
44 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveSDKMessage:) name:poolSDK_Notification object:nil]; | ||
45 | + | ||
46 | + [[PoolSdk shareSDK]initSDK:self]; | ||
47 | +} | ||
48 | + | ||
49 | +-(void)viewDidAppear:(BOOL)animated{ | ||
50 | + [super viewDidAppear:animated]; | ||
51 | + //[[PoolSdk shareSDK] viewDidAppear]; | ||
52 | +} | ||
53 | + | ||
54 | + | ||
55 | +- (void) toggleButton: (UIButton *) button | ||
56 | +{ | ||
57 | + int tag = (int)button.tag; | ||
58 | + if (tag == 1) { | ||
59 | + [[PoolSdk shareSDK] loginSDK]; | ||
60 | + } | ||
61 | + else if (tag == 2) | ||
62 | + { | ||
63 | + NSLog(@"数据接口"); | ||
64 | + PoolReportInfo *reportInfo = [[PoolReportInfo alloc]init]; | ||
65 | + [reportInfo setReportType:REPORT_ENTER]; | ||
66 | + //[reportInfo setReportType:REPORT_CREATEROLE]; | ||
67 | + //[reportInfo setReportType:REPORT_ROLEUPGRADE] | ||
68 | + [reportInfo setServerId:@"9133"]; | ||
69 | + [reportInfo setPlayerName:@"roleName"]; | ||
70 | + [reportInfo setPlayerId:@"pserverName"]; | ||
71 | + [[PoolSdk shareSDK] reportSDK:reportInfo]; | ||
72 | + } | ||
73 | + else if (tag == 4) | ||
74 | + { | ||
75 | + PoolCreateOrderInfo *payInfo = [[PoolCreateOrderInfo alloc]init]; | ||
76 | + [payInfo setServerId:@"111"]; | ||
77 | + [payInfo setPostAmount:@"6"]; | ||
78 | + [payInfo setPlayerId:@"1231241234"]; | ||
79 | + [payInfo setTimestamp:@"1232134"]; | ||
80 | + [payInfo setExchange:@"10"]; | ||
81 | + [payInfo setCustom:@"custom"]; | ||
82 | + NSLog(@"start pay"); | ||
83 | + [[PoolSdk shareSDK] payWithPaymentInfo:payInfo]; | ||
84 | + } | ||
85 | + else if(tag == 6){ | ||
86 | + PoolSdk *poolSdk = [PoolSdk shareSDK]; | ||
87 | + NSLog(@"channelId:%@parame1:%@parame2:%@custom:%@",[poolSdk getGameChannelId],[poolSdk getChannelParameter1],[poolSdk getChannelParameter2],[poolSdk getCustomValue]); | ||
88 | + } | ||
89 | +} | ||
90 | + | ||
91 | + | ||
92 | +- (void)didReceiveMemoryWarning { | ||
93 | + [super didReceiveMemoryWarning]; | ||
94 | +} | ||
95 | + | ||
96 | +- (void)receiveSDKMessage:(NSNotification *)notification | ||
97 | +{ | ||
98 | + NSLog(@"receiveSDKMessage"); | ||
99 | + [[PoolConfig getInstance] getValueByKey:@"gamechannelid"]; | ||
100 | + PoolSDKResult *result = [notification object]; | ||
101 | + if (result == nil ) { | ||
102 | + return; | ||
103 | + } | ||
104 | + switch (result.notiType) { | ||
105 | + | ||
106 | + case PoolSDKNotificationInitSDK: | ||
107 | + { | ||
108 | + NSLog(@"收到PoolSDKNotificationInitSDK"); | ||
109 | + } | ||
110 | + | ||
111 | + break; | ||
112 | + case PoolSDKNotificationLogin: | ||
113 | + { | ||
114 | + NSLog(@"result state:%d",result.statusCode); | ||
115 | + if (result.statusCode == POOLSDK_NO_ERROR) { | ||
116 | + PoolLoginInfo *loginInfo = (PoolLoginInfo*)result.extendData; | ||
117 | + NSLog(@"收到登陆信息public openid:%@", [loginInfo openId]); | ||
118 | + NSLog(@"收到登陆信息public token:%@", [loginInfo sign]); | ||
119 | + NSLog(@"收到登陆信息public timestamp:%@", [loginInfo timestamp]); | ||
120 | + NSLog(@"userType:%@",[loginInfo userType]); | ||
121 | + }else{ | ||
122 | + NSLog(@"%@",[result description]); | ||
123 | + } | ||
124 | + } | ||
125 | + break; | ||
126 | + case PoolSDKNotificationPay: | ||
127 | + { | ||
128 | + NSLog(@"收到登陆信息PoolSDKNotificationPay"); | ||
129 | + } | ||
130 | + break; | ||
131 | + default: | ||
132 | + break; | ||
133 | + } | ||
134 | +} | ||
135 | + | ||
136 | +@end |
1 | +// | ||
2 | +// main.m | ||
3 | +// Demo | ||
4 | +// | ||
5 | +// Created by winFan on 12/9/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <UIKit/UIKit.h> | ||
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 | +} |
1 | +// | ||
2 | +// DemoTests.m | ||
3 | +// DemoTests | ||
4 | +// | ||
5 | +// Created by winFan on 12/9/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <UIKit/UIKit.h> | ||
10 | +#import <XCTest/XCTest.h> | ||
11 | + | ||
12 | +@interface DemoTests : XCTestCase | ||
13 | + | ||
14 | +@end | ||
15 | + | ||
16 | +@implementation DemoTests | ||
17 | + | ||
18 | +- (void)setUp { | ||
19 | + [super setUp]; | ||
20 | + // Put setup code here. This method is called before the invocation of each test method in the class. | ||
21 | +} | ||
22 | + | ||
23 | +- (void)tearDown { | ||
24 | + // Put teardown code here. This method is called after the invocation of each test method in the class. | ||
25 | + [super tearDown]; | ||
26 | +} | ||
27 | + | ||
28 | +- (void)testExample { | ||
29 | + // This is an example of a functional test case. | ||
30 | + XCTAssert(YES, @"Pass"); | ||
31 | +} | ||
32 | + | ||
33 | +- (void)testPerformanceExample { | ||
34 | + // This is an example of a performance test case. | ||
35 | + [self measureBlock:^{ | ||
36 | + // Put the code you want to measure the time of here. | ||
37 | + }]; | ||
38 | +} | ||
39 | + | ||
40 | +@end |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
3 | +<plist version="1.0"> | ||
4 | +<dict> | ||
5 | + <key>CFBundleDevelopmentRegion</key> | ||
6 | + <string>en</string> | ||
7 | + <key>CFBundleExecutable</key> | ||
8 | + <string>$(EXECUTABLE_NAME)</string> | ||
9 | + <key>CFBundleIdentifier</key> | ||
10 | + <string>com.mango.ios.fytx.$(PRODUCT_NAME:rfc1034identifier)</string> | ||
11 | + <key>CFBundleInfoDictionaryVersion</key> | ||
12 | + <string>6.0</string> | ||
13 | + <key>CFBundleName</key> | ||
14 | + <string>$(PRODUCT_NAME)</string> | ||
15 | + <key>CFBundlePackageType</key> | ||
16 | + <string>BNDL</string> | ||
17 | + <key>CFBundleShortVersionString</key> | ||
18 | + <string>1.0</string> | ||
19 | + <key>CFBundleSignature</key> | ||
20 | + <string>????</string> | ||
21 | + <key>CFBundleVersion</key> | ||
22 | + <string>1</string> | ||
23 | +</dict> | ||
24 | +</plist> |
1 | +import shutil | ||
2 | +import os | ||
3 | +import plistlib | ||
4 | + | ||
5 | +import config | ||
6 | +import json | ||
7 | +import packageProj | ||
8 | + | ||
9 | +from mod_pbxproj import XcodeProject | ||
10 | + | ||
11 | + | ||
12 | +gameProjName = config.gameProjName | ||
13 | +channelName = "linyou" | ||
14 | +#copy dir xcodeproj | ||
15 | +copyNewDirName = gameProjName + '_' + channelName + '.xcodeproj' | ||
16 | +currentPath = os.path.abspath('.') | ||
17 | +currentPath += '/' + copyNewDirName | ||
18 | + | ||
19 | + | ||
20 | +if os.path.exists(currentPath): | ||
21 | + shutil.rmtree(currentPath) | ||
22 | + | ||
23 | +shutil.copytree(gameProjName + '.xcodeproj',currentPath) | ||
24 | + | ||
25 | +project = XcodeProject.Load(copyNewDirName + '/project.pbxproj') | ||
26 | + | ||
27 | +#project.add_other_ldflags('-ObjC') | ||
28 | +#frameworks = project.add_folder('poolsdk_file/poolsdk_itools') | ||
29 | +#print(frameworks); | ||
30 | +#add search path | ||
31 | + | ||
32 | +channelRootPath = config.channelRootPath#'poolsdk_file' | ||
33 | + | ||
34 | +frameworksPath = '$(PROJECT_DIR)/' + channelRootPath + '/poolsdk_' + channelName + '/SDK' | ||
35 | +print(frameworksPath); | ||
36 | +#add header search path | ||
37 | +project.add_header_search_paths(frameworksPath, recursive=False) | ||
38 | +#add framework search path | ||
39 | +project.add_framework_search_paths(frameworksPath, recursive=False) | ||
40 | +#add library search path | ||
41 | +project.add_library_search_paths(frameworksPath, recursive=False) | ||
42 | + | ||
43 | +#add poolsdk_xy dir all file into project | ||
44 | +project.remove_group_by_name('poolsdk') | ||
45 | +frameworkRelativePath = project.add_folder(channelRootPath + '/poolsdk_' + channelName + '/SDK') | ||
46 | + | ||
47 | +project.add_file_if_doesnt_exist('pool_setting',parent=frameworkRelativePath, weak=True,ignore_unknown_type=True) | ||
48 | + | ||
49 | + | ||
50 | +systemFrameworks = project.get_or_create_group('Frameworks') | ||
51 | +#add system framework | ||
52 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/CoreTelephony.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
53 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/Security.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
54 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/QuartzCore.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
55 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/SystemConfiguration.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
56 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/AdSupport.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
57 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/StoreKit.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
58 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/CoreText.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
59 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/CoreMotion.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
60 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/CFNetwork.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
61 | + | ||
62 | +#add system dylib | ||
63 | +systemLibs = project.get_or_create_group('Libraries') | ||
64 | +project.add_file_if_doesnt_exist('/usr/lib/libsqlite3.dylib',parent=systemLibs, weak=True, tree='<absolute>')#absolute path | ||
65 | +project.add_file_if_doesnt_exist('/usr/lib/libz.1.dylib',parent=systemLibs, weak=True, tree='<absolute>') | ||
66 | +project.add_file_if_doesnt_exist('/usr/lib/libc++.1.dylib',parent=systemLibs, weak=True, tree='<absolute>') | ||
67 | + | ||
68 | +#modify info.plist reference path | ||
69 | +project.add_single_valued_flag('INFOPLIST_FILE',channelRootPath + '/poolsdk_' + channelName + '/Info.plist') | ||
70 | + | ||
71 | +project.add_single_valued_flag('ENABLE_BITCODE', 'NO') | ||
72 | + | ||
73 | +readInfoPlistFilePath = channelRootPath + '/poolsdk/Info.plist' | ||
74 | +writeInfoFilePath = channelRootPath + '/poolsdk_' + channelName + '/Info.plist' | ||
75 | +infoContent = plistlib.readPlist(readInfoPlistFilePath) | ||
76 | + | ||
77 | +xyInfoPath = channelRootPath + '/poolsdk_' + channelName + '/Info_' + channelName + '.plist' | ||
78 | +xyInfoContent = plistlib.readPlist(xyInfoPath) | ||
79 | + | ||
80 | +#read pool_setting file | ||
81 | +settingFile = open(channelRootPath + '/poolsdk_' + channelName + '/SDK/pool_setting','rw') | ||
82 | +try: | ||
83 | + settingFileContent = settingFile.read( ) | ||
84 | +finally: | ||
85 | + settingFile.close( ) | ||
86 | +#json op | ||
87 | +jsonStr = json.loads(settingFileContent) | ||
88 | + | ||
89 | +#modify bundle id | ||
90 | +project.add_single_valued_flag('PRODUCT_BUNDLE_IDENTIFIER',jsonStr["appScheme"]) | ||
91 | + | ||
92 | +#update and add info.plist content | ||
93 | +infoContent.update(xyInfoContent) | ||
94 | +#write | ||
95 | +plistlib.writePlist(infoContent,writeInfoFilePath) | ||
96 | + | ||
97 | +project.save() | ||
98 | + | ||
99 | + | ||
100 | +packageProj.buildProjName = gameProjName + '_' + channelName | ||
101 | +packageProj.targetName = gameProjName | ||
102 | +packageProj.buildProj() |
1 | +# Copyright 2012 Calvin Rien | ||
2 | +# | ||
3 | +# Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | +# you may not use this file except in compliance with the License. | ||
5 | +# You may obtain a copy of the License at | ||
6 | +# | ||
7 | +# http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | +# | ||
9 | +# Unless required by applicable law or agreed to in writing, software | ||
10 | +# distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | +# See the License for the specific language governing permissions and | ||
13 | +# limitations under the License. | ||
14 | + | ||
15 | +# A pbxproj file is an OpenStep format plist | ||
16 | +# {} represents dictionary of key=value pairs delimited by ; | ||
17 | +# () represents list of values delimited by , | ||
18 | +# file starts with a comment specifying the character type | ||
19 | +# // !$*UTF8*$! | ||
20 | + | ||
21 | +# when adding a file to a project, create the PBXFileReference | ||
22 | +# add the PBXFileReference's guid to a group | ||
23 | +# create a PBXBuildFile with the PBXFileReference's guid | ||
24 | +# add the PBXBuildFile to the appropriate build phase | ||
25 | + | ||
26 | +# when adding a header search path add | ||
27 | +# HEADER_SEARCH_PATHS = "path/**"; | ||
28 | +# to each XCBuildConfiguration object | ||
29 | + | ||
30 | +# Xcode4 will read either a OpenStep or XML plist. | ||
31 | +# this script uses `plutil` to validate, read and write | ||
32 | +# the pbxproj file. Plutil is available in OS X 10.2 and higher | ||
33 | +# Plutil can't write OpenStep plists, so I save as XML | ||
34 | + | ||
35 | +import datetime | ||
36 | +import json | ||
37 | +import ntpath | ||
38 | +import os | ||
39 | +import plistlib | ||
40 | +import re | ||
41 | +import shutil | ||
42 | +import subprocess | ||
43 | +import uuid | ||
44 | + | ||
45 | +from UserDict import IterableUserDict | ||
46 | +from UserList import UserList | ||
47 | + | ||
48 | +regex = '[a-zA-Z0-9\\._/-]*' | ||
49 | + | ||
50 | + | ||
51 | +class PBXEncoder(json.JSONEncoder): | ||
52 | + def default(self, obj): | ||
53 | + """Tests the input object, obj, to encode as JSON.""" | ||
54 | + | ||
55 | + if isinstance(obj, (PBXList, PBXDict)): | ||
56 | + return obj.data | ||
57 | + | ||
58 | + return json.JSONEncoder.default(self, obj) | ||
59 | + | ||
60 | + | ||
61 | +class PBXDict(IterableUserDict): | ||
62 | + def __init__(self, d=None): | ||
63 | + if d: | ||
64 | + d = dict([(PBXType.Convert(k), PBXType.Convert(v)) for k, v in d.items()]) | ||
65 | + | ||
66 | + IterableUserDict.__init__(self, d) | ||
67 | + | ||
68 | + def __setitem__(self, key, value): | ||
69 | + IterableUserDict.__setitem__(self, PBXType.Convert(key), PBXType.Convert(value)) | ||
70 | + | ||
71 | + def remove(self, key): | ||
72 | + self.data.pop(PBXType.Convert(key), None) | ||
73 | + | ||
74 | + | ||
75 | +class PBXList(UserList): | ||
76 | + def __init__(self, l=None): | ||
77 | + if isinstance(l, basestring): | ||
78 | + UserList.__init__(self) | ||
79 | + self.add(l) | ||
80 | + return | ||
81 | + elif l: | ||
82 | + l = [PBXType.Convert(v) for v in l] | ||
83 | + | ||
84 | + UserList.__init__(self, l) | ||
85 | + | ||
86 | + def add(self, value): | ||
87 | + value = PBXType.Convert(value) | ||
88 | + | ||
89 | + if value in self.data: | ||
90 | + return False | ||
91 | + | ||
92 | + self.data.append(value) | ||
93 | + return True | ||
94 | + | ||
95 | + def remove(self, value): | ||
96 | + value = PBXType.Convert(value) | ||
97 | + | ||
98 | + if value in self.data: | ||
99 | + self.data.remove(value) | ||
100 | + return True | ||
101 | + return False | ||
102 | + | ||
103 | + def __setitem__(self, key, value): | ||
104 | + UserList.__setitem__(self, PBXType.Convert(key), PBXType.Convert(value)) | ||
105 | + | ||
106 | + | ||
107 | +class PBXType(PBXDict): | ||
108 | + def __init__(self, d=None): | ||
109 | + PBXDict.__init__(self, d) | ||
110 | + | ||
111 | + if 'isa' not in self: | ||
112 | + self['isa'] = self.__class__.__name__ | ||
113 | + self.id = None | ||
114 | + | ||
115 | + @staticmethod | ||
116 | + def Convert(o): | ||
117 | + if isinstance(o, list): | ||
118 | + return PBXList(o) | ||
119 | + elif isinstance(o, dict): | ||
120 | + isa = o.get('isa') | ||
121 | + | ||
122 | + if not isa: | ||
123 | + return PBXDict(o) | ||
124 | + | ||
125 | + cls = globals().get(isa) | ||
126 | + | ||
127 | + if cls and issubclass(cls, PBXType): | ||
128 | + return cls(o) | ||
129 | + | ||
130 | + print 'warning: unknown PBX type: %s' % isa | ||
131 | + return PBXDict(o) | ||
132 | + else: | ||
133 | + return o | ||
134 | + | ||
135 | + @staticmethod | ||
136 | + def IsGuid(o): | ||
137 | + return re.match('^[A-F0-9]{24}$', str(o)) | ||
138 | + | ||
139 | + @classmethod | ||
140 | + def GenerateId(cls): | ||
141 | + return ''.join(str(uuid.uuid4()).upper().split('-')[1:]) | ||
142 | + | ||
143 | + @classmethod | ||
144 | + def Create(cls, *args, **kwargs): | ||
145 | + return cls(*args, **kwargs) | ||
146 | + | ||
147 | + | ||
148 | +class PBXFileReference(PBXType): | ||
149 | + def __init__(self, d=None): | ||
150 | + PBXType.__init__(self, d) | ||
151 | + self.build_phase = None | ||
152 | + | ||
153 | + types = { | ||
154 | + '.a': ('archive.ar', 'PBXFrameworksBuildPhase'), | ||
155 | + '.app': ('wrapper.application', None), | ||
156 | + '.s': ('sourcecode.asm', 'PBXSourcesBuildPhase'), | ||
157 | + '.c': ('sourcecode.c.c', 'PBXSourcesBuildPhase'), | ||
158 | + '.cpp': ('sourcecode.cpp.cpp', 'PBXSourcesBuildPhase'), | ||
159 | + '.framework': ('wrapper.framework', 'PBXFrameworksBuildPhase'), | ||
160 | + '.h': ('sourcecode.c.h', None), | ||
161 | + '.hpp': ('sourcecode.c.h', None), | ||
162 | + '.d': ('sourcecode.dtrace', 'PBXSourcesBuildPhase'), | ||
163 | + '.swift': ('sourcecode.swift', 'PBXSourcesBuildPhase'), | ||
164 | + '.icns': ('image.icns', 'PBXResourcesBuildPhase'), | ||
165 | + '.m': ('sourcecode.c.objc', 'PBXSourcesBuildPhase'), | ||
166 | + '.j': ('sourcecode.c.objc', 'PBXSourcesBuildPhase'), | ||
167 | + '.mm': ('sourcecode.cpp.objcpp', 'PBXSourcesBuildPhase'), | ||
168 | + '.nib': ('wrapper.nib', 'PBXResourcesBuildPhase'), | ||
169 | + '.plist': ('text.plist.xml', 'PBXResourcesBuildPhase'), | ||
170 | + '.json': ('text.json', 'PBXResourcesBuildPhase'), | ||
171 | + '.png': ('image.png', 'PBXResourcesBuildPhase'), | ||
172 | + '.rtf': ('text.rtf', 'PBXResourcesBuildPhase'), | ||
173 | + '.tiff': ('image.tiff', 'PBXResourcesBuildPhase'), | ||
174 | + '.txt': ('text', 'PBXResourcesBuildPhase'), | ||
175 | + '.xcodeproj': ('wrapper.pb-project', None), | ||
176 | + '.xib': ('file.xib', 'PBXResourcesBuildPhase'), | ||
177 | + '.strings': ('text.plist.strings', 'PBXResourcesBuildPhase'), | ||
178 | + '.bundle': ('wrapper.plug-in', 'PBXResourcesBuildPhase'), | ||
179 | + '.dylib': ('compiled.mach-o.dylib', 'PBXFrameworksBuildPhase'), | ||
180 | + '.xcdatamodeld': ('wrapper.xcdatamodel', 'PBXSourcesBuildPhase'), | ||
181 | + '.xcassets': ('folder.assetcatalog', 'PBXResourcesBuildPhase'), | ||
182 | + '.tbd': ('sourcecode.text-based-dylib-definition', 'PBXFrameworksBuildPhase'), | ||
183 | + } | ||
184 | + | ||
185 | + trees = [ | ||
186 | + '<absolute>', | ||
187 | + '<group>', | ||
188 | + 'BUILT_PRODUCTS_DIR', | ||
189 | + 'DEVELOPER_DIR', | ||
190 | + 'SDKROOT', | ||
191 | + 'SOURCE_ROOT', | ||
192 | + ] | ||
193 | + | ||
194 | + def guess_file_type(self, ignore_unknown_type=False): | ||
195 | + self.remove('explicitFileType') | ||
196 | + self.remove('lastKnownFileType') | ||
197 | + | ||
198 | + | ||
199 | + ext = os.path.splitext(self.get('name', ''))[1] | ||
200 | + if os.path.isdir(self.get('path')) and ext not in XcodeProject.special_folders: | ||
201 | + f_type = 'folder' | ||
202 | + build_phase = None | ||
203 | + ext = '' | ||
204 | + else: | ||
205 | + f_type, build_phase = PBXFileReference.types.get(ext, ('?', 'PBXResourcesBuildPhase')) | ||
206 | + | ||
207 | + self['lastKnownFileType'] = f_type | ||
208 | + self.build_phase = build_phase | ||
209 | + | ||
210 | + if f_type == '?' and not ignore_unknown_type: | ||
211 | + print 'unknown file extension: %s' % ext | ||
212 | + print 'please add extension and Xcode type to PBXFileReference.types' | ||
213 | + | ||
214 | + return f_type | ||
215 | + | ||
216 | + def set_file_type(self, ft): | ||
217 | + self.remove('explicitFileType') | ||
218 | + self.remove('lastKnownFileType') | ||
219 | + | ||
220 | + self['explicitFileType'] = ft | ||
221 | + | ||
222 | + @classmethod | ||
223 | + def Create(cls, os_path, tree='SOURCE_ROOT', ignore_unknown_type=False): | ||
224 | + if tree not in cls.trees: | ||
225 | + print 'Not a valid sourceTree type: %s' % tree | ||
226 | + return None | ||
227 | + | ||
228 | + fr = cls() | ||
229 | + fr.id = cls.GenerateId() | ||
230 | + fr['path'] = os_path | ||
231 | + fr['name'] = os.path.split(os_path)[1] | ||
232 | + fr['sourceTree'] = '<absolute>' if os.path.isabs(os_path) else tree | ||
233 | + fr.guess_file_type(ignore_unknown_type=ignore_unknown_type) | ||
234 | + | ||
235 | + return fr | ||
236 | + | ||
237 | + | ||
238 | +class PBXBuildFile(PBXType): | ||
239 | + def set_weak_link(self, weak=False): | ||
240 | + k_settings = 'settings' | ||
241 | + k_attributes = 'ATTRIBUTES' | ||
242 | + | ||
243 | + s = self.get(k_settings) | ||
244 | + | ||
245 | + if not s: | ||
246 | + if weak: | ||
247 | + self[k_settings] = PBXDict({k_attributes: PBXList(['Weak'])}) | ||
248 | + | ||
249 | + return True | ||
250 | + | ||
251 | + atr = s.get(k_attributes) | ||
252 | + | ||
253 | + if not atr: | ||
254 | + if weak: | ||
255 | + atr = PBXList() | ||
256 | + else: | ||
257 | + return False | ||
258 | + | ||
259 | + if weak: | ||
260 | + atr.add('Weak') | ||
261 | + else: | ||
262 | + atr.remove('Weak') | ||
263 | + | ||
264 | + self[k_settings][k_attributes] = atr | ||
265 | + | ||
266 | + return True | ||
267 | + | ||
268 | + def add_compiler_flag(self, flag): | ||
269 | + k_settings = 'settings' | ||
270 | + k_attributes = 'COMPILER_FLAGS' | ||
271 | + | ||
272 | + if k_settings not in self: | ||
273 | + self[k_settings] = PBXDict() | ||
274 | + | ||
275 | + if k_attributes not in self[k_settings]: | ||
276 | + self[k_settings][k_attributes] = flag | ||
277 | + return True | ||
278 | + | ||
279 | + flags = self[k_settings][k_attributes].split(' ') | ||
280 | + | ||
281 | + if flag in flags: | ||
282 | + return False | ||
283 | + | ||
284 | + flags.append(flag) | ||
285 | + | ||
286 | + self[k_settings][k_attributes] = ' '.join(flags) | ||
287 | + | ||
288 | + @classmethod | ||
289 | + def Create(cls, file_ref, weak=False): | ||
290 | + if isinstance(file_ref, PBXFileReference): | ||
291 | + file_ref = file_ref.id | ||
292 | + | ||
293 | + bf = cls() | ||
294 | + bf.id = cls.GenerateId() | ||
295 | + bf['fileRef'] = file_ref | ||
296 | + | ||
297 | + if weak: | ||
298 | + bf.set_weak_link(True) | ||
299 | + | ||
300 | + return bf | ||
301 | + | ||
302 | + | ||
303 | +class PBXGroup(PBXType): | ||
304 | + def add_child(self, ref): | ||
305 | + if not isinstance(ref, PBXDict): | ||
306 | + return None | ||
307 | + | ||
308 | + isa = ref.get('isa') | ||
309 | + | ||
310 | + if isa != 'PBXFileReference' and isa != 'PBXGroup': | ||
311 | + return None | ||
312 | + | ||
313 | + if 'children' not in self: | ||
314 | + self['children'] = PBXList() | ||
315 | + | ||
316 | + self['children'].add(ref.id) | ||
317 | + | ||
318 | + return ref.id | ||
319 | + | ||
320 | + def remove_child(self, id): | ||
321 | + if 'children' not in self: | ||
322 | + self['children'] = PBXList() | ||
323 | + return | ||
324 | + | ||
325 | + if not PBXType.IsGuid(id): | ||
326 | + id = id.id | ||
327 | + | ||
328 | + self['children'].remove(id) | ||
329 | + | ||
330 | + def has_child(self, id): | ||
331 | + if 'children' not in self: | ||
332 | + self['children'] = PBXList() | ||
333 | + return False | ||
334 | + | ||
335 | + if not PBXType.IsGuid(id): | ||
336 | + id = id.id | ||
337 | + | ||
338 | + return id in self['children'] | ||
339 | + | ||
340 | + def get_name(self): | ||
341 | + path_name = os.path.split(self.get('path', ''))[1] | ||
342 | + return self.get('name', path_name) | ||
343 | + | ||
344 | + @classmethod | ||
345 | + def Create(cls, name, path=None, tree='SOURCE_ROOT'): | ||
346 | + grp = cls() | ||
347 | + grp.id = cls.GenerateId() | ||
348 | + grp['name'] = name | ||
349 | + grp['children'] = PBXList() | ||
350 | + | ||
351 | + if path: | ||
352 | + grp['path'] = path | ||
353 | + grp['sourceTree'] = tree | ||
354 | + else: | ||
355 | + grp['sourceTree'] = '<group>' | ||
356 | + | ||
357 | + return grp | ||
358 | + | ||
359 | + | ||
360 | +class PBXNativeTarget(PBXType): | ||
361 | + pass | ||
362 | + | ||
363 | + | ||
364 | +class PBXProject(PBXType): | ||
365 | + pass | ||
366 | + | ||
367 | + | ||
368 | +class PBXContainerItemProxy(PBXType): | ||
369 | + pass | ||
370 | + | ||
371 | + | ||
372 | +class PBXReferenceProxy(PBXType): | ||
373 | + pass | ||
374 | + | ||
375 | + | ||
376 | +class PBXVariantGroup(PBXType): | ||
377 | + pass | ||
378 | + | ||
379 | + | ||
380 | +class PBXTargetDependency(PBXType): | ||
381 | + pass | ||
382 | + | ||
383 | + | ||
384 | +class PBXAggregateTarget(PBXType): | ||
385 | + pass | ||
386 | + | ||
387 | + | ||
388 | +class PBXHeadersBuildPhase(PBXType): | ||
389 | + pass | ||
390 | + | ||
391 | +class XCVersionGroup(PBXType): | ||
392 | + pass | ||
393 | + | ||
394 | +class PBXBuildPhase(PBXType): | ||
395 | + def add_build_file(self, bf): | ||
396 | + if bf.get('isa') != 'PBXBuildFile': | ||
397 | + return False | ||
398 | + | ||
399 | + if 'files' not in self: | ||
400 | + self['files'] = PBXList() | ||
401 | + | ||
402 | + self['files'].add(bf.id) | ||
403 | + | ||
404 | + return True | ||
405 | + | ||
406 | + def remove_build_file(self, id): | ||
407 | + if 'files' not in self: | ||
408 | + self['files'] = PBXList() | ||
409 | + return | ||
410 | + | ||
411 | + self['files'].remove(id) | ||
412 | + | ||
413 | + def has_build_file(self, id): | ||
414 | + if 'files' not in self: | ||
415 | + self['files'] = PBXList() | ||
416 | + return False | ||
417 | + | ||
418 | + if not PBXType.IsGuid(id): | ||
419 | + id = id.id | ||
420 | + | ||
421 | + return id in self['files'] | ||
422 | + | ||
423 | + | ||
424 | +class PBXFrameworksBuildPhase(PBXBuildPhase): | ||
425 | + pass | ||
426 | + | ||
427 | + | ||
428 | +class PBXResourcesBuildPhase(PBXBuildPhase): | ||
429 | + pass | ||
430 | + | ||
431 | + | ||
432 | +class PBXShellScriptBuildPhase(PBXBuildPhase): | ||
433 | + @classmethod | ||
434 | + def Create(cls, script, shell="/bin/sh", files=[], input_paths=[], output_paths=[], show_in_log = '0'): | ||
435 | + bf = cls() | ||
436 | + bf.id = cls.GenerateId() | ||
437 | + bf['files'] = files | ||
438 | + bf['inputPaths'] = input_paths | ||
439 | + bf['outputPaths'] = output_paths | ||
440 | + bf['runOnlyForDeploymentPostprocessing'] = '0'; | ||
441 | + bf['shellPath'] = shell | ||
442 | + bf['shellScript'] = script | ||
443 | + bf['showEnvVarsInLog'] = show_in_log | ||
444 | + | ||
445 | + return bf | ||
446 | + | ||
447 | + | ||
448 | +class PBXSourcesBuildPhase(PBXBuildPhase): | ||
449 | + pass | ||
450 | + | ||
451 | + | ||
452 | +class PBXCopyFilesBuildPhase(PBXBuildPhase): | ||
453 | + pass | ||
454 | + | ||
455 | + | ||
456 | +class XCBuildConfiguration(PBXType): | ||
457 | + def add_search_paths(self, paths, base, key, recursive=True, escape=True): | ||
458 | + modified = False | ||
459 | + | ||
460 | + if not isinstance(paths, list): | ||
461 | + paths = [paths] | ||
462 | + | ||
463 | + if base not in self: | ||
464 | + self[base] = PBXDict() | ||
465 | + | ||
466 | + for path in paths: | ||
467 | + if recursive and not path.endswith('/**'): | ||
468 | + path = os.path.join(path, '**') | ||
469 | + | ||
470 | + if key not in self[base]: | ||
471 | + self[base][key] = PBXList() | ||
472 | + elif isinstance(self[base][key], basestring): | ||
473 | + self[base][key] = PBXList(self[base][key]) | ||
474 | + | ||
475 | + if path == '$(inherited)': | ||
476 | + escape = False | ||
477 | + | ||
478 | + if escape: | ||
479 | + if self[base][key].add('"%s"' % path): # '\\"%s\\"' % path | ||
480 | + modified = True | ||
481 | + else: | ||
482 | + if self[base][key].add(path): # '\\"%s\\"' % path | ||
483 | + modified = True | ||
484 | + | ||
485 | + return modified | ||
486 | + | ||
487 | + def add_header_search_paths(self, paths, recursive=True): | ||
488 | + return self.add_search_paths(paths, 'buildSettings', 'HEADER_SEARCH_PATHS', recursive=recursive) | ||
489 | + | ||
490 | + def add_library_search_paths(self, paths, recursive=True): | ||
491 | + return self.add_search_paths(paths, 'buildSettings', 'LIBRARY_SEARCH_PATHS', recursive=recursive) | ||
492 | + | ||
493 | + def add_framework_search_paths(self, paths, recursive=True): | ||
494 | + return self.add_search_paths(paths, 'buildSettings', 'FRAMEWORK_SEARCH_PATHS', recursive=recursive) | ||
495 | + | ||
496 | + def add_other_cflags(self, flags): | ||
497 | + return self.add_flag('OTHER_CFLAGS', flags) | ||
498 | + | ||
499 | + def add_other_ldflags(self, flags): | ||
500 | + return self.add_flag('OTHER_LDFLAGS', flags) | ||
501 | + | ||
502 | + def add_flag(self, key, flags): | ||
503 | + modified = False | ||
504 | + base = 'buildSettings' | ||
505 | + | ||
506 | + if isinstance(flags, basestring): | ||
507 | + flags = PBXList(flags) | ||
508 | + | ||
509 | + if base not in self: | ||
510 | + self[base] = PBXDict() | ||
511 | + | ||
512 | + for flag in flags: | ||
513 | + if key not in self[base]: | ||
514 | + self[base][key] = PBXList() | ||
515 | + elif isinstance(self[base][key], basestring): | ||
516 | + self[base][key] = PBXList(self[base][key]) | ||
517 | + | ||
518 | + if self[base][key].add(flag): | ||
519 | + self[base][key] = [e for e in self[base][key] if e] | ||
520 | + modified = True | ||
521 | + | ||
522 | + return modified | ||
523 | + | ||
524 | + def remove_flag(self, key, flags): | ||
525 | + modified = False | ||
526 | + base = 'buildSettings' | ||
527 | + | ||
528 | + if isinstance(flags, basestring): | ||
529 | + flags = PBXList(flags) | ||
530 | + | ||
531 | + if base in self: # there are flags, so we can "remove" something | ||
532 | + for flag in flags: | ||
533 | + if key not in self[base]: | ||
534 | + return False | ||
535 | + elif isinstance(self[base][key], basestring): | ||
536 | + self[base][key] = PBXList(self[base][key]) | ||
537 | + | ||
538 | + if self[base][key].remove(flag): | ||
539 | + self[base][key] = [e for e in self[base][key] if e] | ||
540 | + modified = True | ||
541 | + | ||
542 | + if len(self[base][key]) == 0: | ||
543 | + self[base].pop(key, None) | ||
544 | + | ||
545 | + return modified | ||
546 | + | ||
547 | + def remove_other_ldflags(self, flags): | ||
548 | + return self.remove_flag('OTHER_LD_FLAGS', flags) | ||
549 | + | ||
550 | + # Set a single-valued flag under buildSettings | ||
551 | + def add_single_valued_flag(self, flag, value): | ||
552 | + modified = False | ||
553 | + base = 'buildSettings' | ||
554 | + key = flag | ||
555 | + | ||
556 | + if not self.has_key(base): | ||
557 | + self[base] = PBXDict() | ||
558 | + if self[base].has_key(key): | ||
559 | + if self[base][key] == value: | ||
560 | + return False | ||
561 | + self[base][key] = value | ||
562 | + modified = True | ||
563 | + return modified | ||
564 | + | ||
565 | + # Remove a single-valued flag under buildSettings | ||
566 | + def remove_single_valued_flag(self, flag): | ||
567 | + modified = False | ||
568 | + base = 'buildSettings' | ||
569 | + key = flag | ||
570 | + | ||
571 | + if self.has_key(base) and self[base].has_key(key): | ||
572 | + self[base].pop(key, None) | ||
573 | + modified = True | ||
574 | + return modified | ||
575 | + | ||
576 | +class XCConfigurationList(PBXType): | ||
577 | + pass | ||
578 | + | ||
579 | + | ||
580 | +class XcodeProject(PBXDict): | ||
581 | + plutil_path = 'plutil' | ||
582 | + special_folders = ['.bundle', '.framework', '.xcodeproj', '.xcassets', '.xcdatamodeld'] | ||
583 | + | ||
584 | + def __init__(self, d=None, path=None): | ||
585 | + if not path: | ||
586 | + path = os.path.join(os.getcwd(), 'project.pbxproj') | ||
587 | + | ||
588 | + self.pbxproj_path = os.path.abspath(path) | ||
589 | + self.source_root = os.path.abspath(os.path.join(os.path.split(path)[0], '..')) | ||
590 | + | ||
591 | + IterableUserDict.__init__(self, d) | ||
592 | + | ||
593 | + self.data = PBXDict(self.data) | ||
594 | + self.objects = self.get('objects') | ||
595 | + self.modified = False | ||
596 | + | ||
597 | + root_id = self.get('rootObject') | ||
598 | + | ||
599 | + if root_id: | ||
600 | + self.root_object = self.objects[root_id] | ||
601 | + root_group_id = self.root_object.get('mainGroup') | ||
602 | + self.root_group = self.objects[root_group_id] | ||
603 | + else: | ||
604 | + print "error: project has no root object" | ||
605 | + self.root_object = None | ||
606 | + self.root_group = None | ||
607 | + | ||
608 | + for k, v in self.objects.iteritems(): | ||
609 | + v.id = k | ||
610 | + | ||
611 | + def add_other_cflags(self, flags): | ||
612 | + build_configs = [b for b in self.objects.values() if b.get('isa') == 'XCBuildConfiguration'] | ||
613 | + | ||
614 | + for b in build_configs: | ||
615 | + if b.add_other_cflags(flags): | ||
616 | + self.modified = True | ||
617 | + | ||
618 | + def add_other_ldflags(self, flags): | ||
619 | + build_configs = [b for b in self.objects.values() if b.get('isa') == 'XCBuildConfiguration'] | ||
620 | + | ||
621 | + for b in build_configs: | ||
622 | + if b.add_other_ldflags(flags): | ||
623 | + self.modified = True | ||
624 | + | ||
625 | + def remove_other_ldflags(self, flags): | ||
626 | + build_configs = [b for b in self.objects.values() if b.get('isa') == 'XCBuildConfiguration'] | ||
627 | + | ||
628 | + for b in build_configs: | ||
629 | + if b.remove_other_ldflags(flags): | ||
630 | + self.modified = True | ||
631 | + | ||
632 | + def add_header_search_paths(self, paths, recursive=True): | ||
633 | + build_configs = [b for b in self.objects.values() if b.get('isa') == 'XCBuildConfiguration'] | ||
634 | + | ||
635 | + for b in build_configs: | ||
636 | + if b.add_header_search_paths(paths, recursive): | ||
637 | + self.modified = True | ||
638 | + | ||
639 | + def add_framework_search_paths(self, paths, recursive=True): | ||
640 | + build_configs = [b for b in self.objects.values() if b.get('isa') == 'XCBuildConfiguration'] | ||
641 | + | ||
642 | + for b in build_configs: | ||
643 | + if b.add_framework_search_paths(paths, recursive): | ||
644 | + self.modified = True | ||
645 | + | ||
646 | + def add_library_search_paths(self, paths, recursive=True): | ||
647 | + build_configs = [b for b in self.objects.values() if b.get('isa') == 'XCBuildConfiguration'] | ||
648 | + | ||
649 | + for b in build_configs: | ||
650 | + if b.add_library_search_paths(paths, recursive): | ||
651 | + self.modified = True | ||
652 | + | ||
653 | + def add_flags(self, pairs, configuration='All'): | ||
654 | + build_configs = [b for b in self.objects.values() if b.get('isa') == 'XCBuildConfiguration'] | ||
655 | + | ||
656 | + # iterate over all the pairs of configurations | ||
657 | + for b in build_configs: | ||
658 | + if configuration != "All" and b.get('name') != configuration : | ||
659 | + continue | ||
660 | + | ||
661 | + for k in pairs: | ||
662 | + if b.add_flag(k, pairs[k]): | ||
663 | + self.modified = True | ||
664 | + | ||
665 | + def remove_flags(self, pairs, configuration='All'): | ||
666 | + build_configs = [b for b in self.objects.values() if b.get('isa') == 'XCBuildConfiguration'] | ||
667 | + | ||
668 | + # iterate over all the pairs of configurations | ||
669 | + for b in build_configs: | ||
670 | + if configuration != "All" and b.get('name') != configuration : | ||
671 | + continue | ||
672 | + for k in pairs: | ||
673 | + if b.remove_flag(k, pairs[k]): | ||
674 | + self.modified = True | ||
675 | + | ||
676 | + # Set a single-valued flag (whereas add_flags adds a flag to a list of flags with a given key) | ||
677 | + def add_single_valued_flag(self, flag, value, configuration='All'): | ||
678 | + build_configs = [b for b in self.objects.values() if b.get('isa') == 'XCBuildConfiguration'] | ||
679 | + | ||
680 | + for b in build_configs: | ||
681 | + if configuration != "All" and b.get('name') != configuration : | ||
682 | + continue | ||
683 | + | ||
684 | + if b.add_single_valued_flag(flag, value): | ||
685 | + self.modified = True | ||
686 | + | ||
687 | + # Remove a single-valued flag (whereas remove_flags deletes a flag from a list of flags with a given key) | ||
688 | + def remove_single_valued_flag(self, flag, configuration='All'): | ||
689 | + build_configs = [b for b in self.objects.values() if b.get('isa') == 'XCBuildConfiguration'] | ||
690 | + | ||
691 | + for b in build_configs: | ||
692 | + if configuration != "All" and b.get('name') != configuration : | ||
693 | + continue | ||
694 | + | ||
695 | + if b.remove_single_valued_flag(flag): | ||
696 | + self.modified = True | ||
697 | + | ||
698 | + def get_obj(self, id): | ||
699 | + return self.objects.get(id) | ||
700 | + | ||
701 | + def get_ids(self): | ||
702 | + return self.objects.keys() | ||
703 | + | ||
704 | + def get_files_by_os_path(self, os_path, tree='SOURCE_ROOT'): | ||
705 | + files = [f for f in self.objects.values() if f.get('isa') == 'PBXFileReference' | ||
706 | + and f.get('path') == os_path | ||
707 | + and f.get('sourceTree') == tree] | ||
708 | + | ||
709 | + return files | ||
710 | + | ||
711 | + def get_files_by_name(self, name, parent=None): | ||
712 | + if parent: | ||
713 | + files = [f for f in self.objects.values() if f.get('isa') == 'PBXFileReference' | ||
714 | + and f.get('name') == name | ||
715 | + and parent.has_child(f)] | ||
716 | + else: | ||
717 | + files = [f for f in self.objects.values() if f.get('isa') == 'PBXFileReference' | ||
718 | + and f.get('name') == name] | ||
719 | + | ||
720 | + return files | ||
721 | + | ||
722 | + def get_keys_for_files_by_name(self, name): | ||
723 | + keys = [key for key in self.objects if self.objects.data[key].get('name') == name | ||
724 | + and self.objects.data[key].get('isa') == 'PBXFileReference'] | ||
725 | + return keys | ||
726 | + | ||
727 | + | ||
728 | + def get_build_files(self, id): | ||
729 | + files = [f for f in self.objects.values() if f.get('isa') == 'PBXBuildFile' | ||
730 | + and f.get('fileRef') == id] | ||
731 | + return files | ||
732 | + | ||
733 | + def get_groups_by_name(self, name, parent=None): | ||
734 | + if parent: | ||
735 | + groups = [g for g in self.objects.values() if g.get('isa') == 'PBXGroup' | ||
736 | + and g.get_name() == name | ||
737 | + and parent.has_child(g)] | ||
738 | + else: | ||
739 | + groups = [g for g in self.objects.values() if g.get('isa') == 'PBXGroup' | ||
740 | + and g.get_name() == name] | ||
741 | + | ||
742 | + return groups | ||
743 | + | ||
744 | + def get_or_create_group(self, name, path=None, parent=None): | ||
745 | + if not name: | ||
746 | + return None | ||
747 | + | ||
748 | + if not parent: | ||
749 | + parent = self.root_group | ||
750 | + elif not isinstance(parent, PBXGroup): | ||
751 | + # assume it's an id | ||
752 | + parent = self.objects.get(parent, self.root_group) | ||
753 | + | ||
754 | + groups = self.get_groups_by_name(name) | ||
755 | + | ||
756 | + for grp in groups: | ||
757 | + if parent.has_child(grp.id): | ||
758 | + return grp | ||
759 | + | ||
760 | + grp = PBXGroup.Create(name, path) | ||
761 | + parent.add_child(grp) | ||
762 | + | ||
763 | + self.objects[grp.id] = grp | ||
764 | + | ||
765 | + self.modified = True | ||
766 | + | ||
767 | + return grp | ||
768 | + | ||
769 | + def get_groups_by_os_path(self, path): | ||
770 | + path = os.path.abspath(path) | ||
771 | + | ||
772 | + groups = [g for g in self.objects.values() if g.get('isa') == 'PBXGroup' | ||
773 | + and os.path.abspath(g.get('path', '/dev/null')) == path] | ||
774 | + | ||
775 | + return groups | ||
776 | + | ||
777 | + def get_build_phases(self, phase_name): | ||
778 | + phases = [p for p in self.objects.values() if p.get('isa') == phase_name] | ||
779 | + | ||
780 | + return phases | ||
781 | + | ||
782 | + def get_target_by_name(self, name): | ||
783 | + targets = self.get_build_phases('PBXNativeTarget') | ||
784 | + target = None | ||
785 | + for t in targets: | ||
786 | + if t.get("name") == name: | ||
787 | + target = t | ||
788 | + break | ||
789 | + return target | ||
790 | + | ||
791 | + def get_relative_path(self, os_path): | ||
792 | + return os.path.relpath(os_path, self.source_root) | ||
793 | + | ||
794 | + def verify_files(self, file_list, parent=None): | ||
795 | + # returns list of files not in the current project. | ||
796 | + if not file_list: | ||
797 | + return [] | ||
798 | + | ||
799 | + if parent: | ||
800 | + exists_list = [f.get('name') for f in self.objects.values() if f.get('isa') == 'PBXFileReference' and f.get('name') in file_list and parent.has_child(f)] | ||
801 | + else: | ||
802 | + exists_list = [f.get('name') for f in self.objects.values() if f.get('isa') == 'PBXFileReference' and f.get('name') in file_list] | ||
803 | + | ||
804 | + return set(file_list).difference(exists_list) | ||
805 | + | ||
806 | + def add_run_script(self, target, script=None, insert_before_compile=False): | ||
807 | + result = [] | ||
808 | + targets = [t for t in self.get_build_phases('PBXNativeTarget') + self.get_build_phases('PBXAggregateTarget') if t.get('name') == target] | ||
809 | + if len(targets) != 0 : | ||
810 | + script_phase = PBXShellScriptBuildPhase.Create(script) | ||
811 | + for t in targets: | ||
812 | + skip = False | ||
813 | + for buildPhase in t['buildPhases']: | ||
814 | + if self.objects[buildPhase].get('isa') == 'PBXShellScriptBuildPhase' and self.objects[buildPhase].get('shellScript') == script: | ||
815 | + skip = True | ||
816 | + | ||
817 | + if not skip: | ||
818 | + if insert_before_compile: | ||
819 | + t['buildPhases'].insert(0, script_phase.id) | ||
820 | + else: | ||
821 | + t['buildPhases'].add(script_phase.id) | ||
822 | + self.objects[script_phase.id] = script_phase | ||
823 | + result.append(script_phase) | ||
824 | + | ||
825 | + return result | ||
826 | + | ||
827 | + def add_run_script_all_targets(self, script=None): | ||
828 | + result = [] | ||
829 | + targets = self.get_build_phases('PBXNativeTarget') + self.get_build_phases('PBXAggregateTarget') | ||
830 | + if len(targets) != 0 : | ||
831 | + script_phase = PBXShellScriptBuildPhase.Create(script) | ||
832 | + for t in targets: | ||
833 | + skip = False | ||
834 | + for buildPhase in t['buildPhases']: | ||
835 | + if self.objects[buildPhase].get('isa') == 'PBXShellScriptBuildPhase' and self.objects[buildPhase].get('shellScript') == script: | ||
836 | + skip = True | ||
837 | + | ||
838 | + if not skip: | ||
839 | + t['buildPhases'].add(script_phase.id) | ||
840 | + self.objects[script_phase.id] = script_phase | ||
841 | + result.append(script_phase) | ||
842 | + | ||
843 | + return result | ||
844 | + | ||
845 | + def add_folder(self, os_path, parent=None, excludes=None, recursive=True, create_build_files=True): | ||
846 | + if not os.path.isdir(os_path): | ||
847 | + return [] | ||
848 | + | ||
849 | + if not excludes: | ||
850 | + excludes = [] | ||
851 | + | ||
852 | + results = [] | ||
853 | + | ||
854 | + if not parent: | ||
855 | + parent = self.root_group | ||
856 | + elif not isinstance(parent, PBXGroup): | ||
857 | + # assume it's an id | ||
858 | + parent = self.objects.get(parent, self.root_group) | ||
859 | + | ||
860 | + path_dict = {os.path.split(os_path)[0]: parent} | ||
861 | + special_list = [] | ||
862 | + | ||
863 | + for (grp_path, subdirs, files) in os.walk(os_path): | ||
864 | + parent_folder, folder_name = os.path.split(grp_path) | ||
865 | + parent = path_dict.get(parent_folder, parent) | ||
866 | + | ||
867 | + if [sp for sp in special_list if parent_folder.startswith(sp)]: | ||
868 | + continue | ||
869 | + | ||
870 | + if folder_name.startswith('.'): | ||
871 | + special_list.append(grp_path) | ||
872 | + continue | ||
873 | + | ||
874 | + if os.path.splitext(grp_path)[1] in XcodeProject.special_folders: | ||
875 | + # if this file has a special extension (bundle or framework mainly) treat it as a file | ||
876 | + special_list.append(grp_path) | ||
877 | + new_files = self.verify_files([folder_name], parent=parent) | ||
878 | + | ||
879 | + # Ignore this file if it is in excludes | ||
880 | + if new_files and not [m for m in excludes if re.match(m, grp_path)]: | ||
881 | + results.extend(self.add_file(grp_path, parent, create_build_files=create_build_files)) | ||
882 | + | ||
883 | + continue | ||
884 | + | ||
885 | + # create group | ||
886 | + grp = self.get_or_create_group(folder_name, path=self.get_relative_path(grp_path), parent=parent) | ||
887 | + path_dict[grp_path] = grp | ||
888 | + | ||
889 | + results.append(grp) | ||
890 | + | ||
891 | + file_dict = {} | ||
892 | + | ||
893 | + for f in files: | ||
894 | + if f[0] == '.' or [m for m in excludes if re.match(m, f)]: | ||
895 | + continue | ||
896 | + | ||
897 | + kwds = { | ||
898 | + 'create_build_files': create_build_files, | ||
899 | + 'parent': grp, | ||
900 | + 'name': f | ||
901 | + } | ||
902 | + | ||
903 | + f_path = os.path.join(grp_path, f) | ||
904 | + file_dict[f_path] = kwds | ||
905 | + | ||
906 | + new_files = self.verify_files([n.get('name') for n in file_dict.values()], parent=grp) | ||
907 | + add_files = [(k, v) for k, v in file_dict.items() if v.get('name') in new_files] | ||
908 | + | ||
909 | + for path, kwds in add_files: | ||
910 | + kwds.pop('name', None) | ||
911 | + self.add_file(path, **kwds) | ||
912 | + | ||
913 | + if not recursive: | ||
914 | + break | ||
915 | + | ||
916 | + for r in results: | ||
917 | + self.objects[r.id] = r | ||
918 | + | ||
919 | + return results | ||
920 | + | ||
921 | + def path_leaf(self, path): | ||
922 | + head, tail = ntpath.split(path) | ||
923 | + return tail or ntpath.basename(head) | ||
924 | + | ||
925 | + def add_file_if_doesnt_exist(self, f_path, parent=None, tree='SOURCE_ROOT', create_build_files=True, weak=False, ignore_unknown_type=False): | ||
926 | + for obj in self.objects.values(): | ||
927 | + if 'path' in obj: | ||
928 | + if self.path_leaf(f_path) == self.path_leaf(obj.get('path')): | ||
929 | + return [] | ||
930 | + | ||
931 | + return self.add_file(f_path, parent, tree, create_build_files, weak, ignore_unknown_type=ignore_unknown_type) | ||
932 | + | ||
933 | + def add_file(self, f_path, parent=None, tree='SOURCE_ROOT', create_build_files=True, weak=False, ignore_unknown_type=False, target=None): | ||
934 | + results = [] | ||
935 | + abs_path = '' | ||
936 | + | ||
937 | + if os.path.isabs(f_path): | ||
938 | + abs_path = f_path | ||
939 | + | ||
940 | + if not os.path.exists(f_path): | ||
941 | + return results | ||
942 | + elif tree == 'SOURCE_ROOT': | ||
943 | + f_path = os.path.relpath(f_path, self.source_root) | ||
944 | + else: | ||
945 | + tree = '<absolute>' | ||
946 | + | ||
947 | + if not parent: | ||
948 | + parent = self.root_group | ||
949 | + elif not isinstance(parent, PBXGroup): | ||
950 | + # assume it's an id | ||
951 | + parent = self.objects.get(parent, self.root_group) | ||
952 | + | ||
953 | + file_ref = PBXFileReference.Create(f_path, tree, ignore_unknown_type=ignore_unknown_type) | ||
954 | + parent.add_child(file_ref) | ||
955 | + results.append(file_ref) | ||
956 | + | ||
957 | + # create a build file for the file ref | ||
958 | + if file_ref.build_phase and create_build_files: | ||
959 | + phases = self.get_build_phases(file_ref.build_phase) | ||
960 | + if target: | ||
961 | + target = self.get_target_by_name(target) | ||
962 | + | ||
963 | + for phase in phases: | ||
964 | + if (not target) or (phase.id in target.get('buildPhases')): | ||
965 | + build_file = PBXBuildFile.Create(file_ref, weak=weak) | ||
966 | + phase.add_build_file(build_file) | ||
967 | + results.append(build_file) | ||
968 | + | ||
969 | + if abs_path and tree == 'SOURCE_ROOT' \ | ||
970 | + and os.path.isfile(abs_path) \ | ||
971 | + and file_ref.build_phase == 'PBXFrameworksBuildPhase': | ||
972 | + library_path = os.path.join('$(SRCROOT)', os.path.split(f_path)[0]) | ||
973 | + self.add_library_search_paths([library_path], recursive=False) | ||
974 | + | ||
975 | + if abs_path and tree == 'SOURCE_ROOT' \ | ||
976 | + and not os.path.isfile(abs_path) \ | ||
977 | + and file_ref.build_phase == 'PBXFrameworksBuildPhase': | ||
978 | + framework_path = os.path.join('$(SRCROOT)', os.path.split(f_path)[0]) | ||
979 | + self.add_framework_search_paths([framework_path, '$(inherited)'], recursive=False) | ||
980 | + | ||
981 | + for r in results: | ||
982 | + self.objects[r.id] = r | ||
983 | + | ||
984 | + if results: | ||
985 | + self.modified = True | ||
986 | + | ||
987 | + return results | ||
988 | + | ||
989 | + def check_and_repair_framework(self, base): | ||
990 | + name = os.path.basename(base) | ||
991 | + | ||
992 | + if ".framework" in name: | ||
993 | + basename = name[:-len(".framework")] | ||
994 | + | ||
995 | + finalHeaders = os.path.join(base, "Headers") | ||
996 | + finalCurrent = os.path.join(base, "Versions/Current") | ||
997 | + finalLib = os.path.join(base, basename) | ||
998 | + srcHeaders = "Versions/A/Headers" | ||
999 | + srcCurrent = "A" | ||
1000 | + srcLib = "Versions/A/" + basename | ||
1001 | + | ||
1002 | + if not os.path.exists(finalHeaders): | ||
1003 | + os.symlink(srcHeaders, finalHeaders) | ||
1004 | + if not os.path.exists(finalCurrent): | ||
1005 | + os.symlink(srcCurrent, finalCurrent) | ||
1006 | + if not os.path.exists(finalLib): | ||
1007 | + os.symlink(srcLib, finalLib) | ||
1008 | + | ||
1009 | + | ||
1010 | + def get_file_id_by_path(self, f_path): | ||
1011 | + for k, v in self.objects.iteritems(): | ||
1012 | + if str(v.get('path')) == f_path: | ||
1013 | + return k | ||
1014 | + return 0 | ||
1015 | + | ||
1016 | + | ||
1017 | + def remove_file_by_path(self, f_path, recursive=True): | ||
1018 | + id = self.get_file_id_by_path(f_path) | ||
1019 | + if id != 0: | ||
1020 | + self.remove_file(id, recursive=recursive) | ||
1021 | + return | ||
1022 | + | ||
1023 | + | ||
1024 | + def remove_file(self, id, recursive=True): | ||
1025 | + if not PBXType.IsGuid(id): | ||
1026 | + id = id.id | ||
1027 | + | ||
1028 | + if id in self.objects: | ||
1029 | + self.objects.remove(id) | ||
1030 | + # Remove from PBXResourcesBuildPhase and PBXSourcesBuildPhase if necessary | ||
1031 | + buildFiles = [f for f in self.objects.values() if f.get('isa') == 'PBXBuildFile'] | ||
1032 | + for buildFile in buildFiles: | ||
1033 | + if id == buildFile.get('fileRef'): | ||
1034 | + key = buildFile.id | ||
1035 | + PBXRBP = [f for f in self.objects.values() if f.get('isa') == 'PBXResourcesBuildPhase'] | ||
1036 | + PBXSBP = [f for f in self.objects.values() if f.get('isa') == 'PBXSourcesBuildPhase'] | ||
1037 | + self.objects.remove(key) | ||
1038 | + if len(PBXSBP) and PBXSBP[0].has_build_file(key): | ||
1039 | + PBXSBP[0].remove_build_file(key) | ||
1040 | + if len(PBXRBP) and PBXRBP[0].has_build_file(key): | ||
1041 | + PBXRBP[0].remove_build_file(key) | ||
1042 | + if recursive: | ||
1043 | + groups = [g for g in self.objects.values() if g.get('isa') == 'PBXGroup'] | ||
1044 | + | ||
1045 | + for group in groups: | ||
1046 | + if id in group['children']: | ||
1047 | + group.remove_child(id) | ||
1048 | + | ||
1049 | + self.modified = True | ||
1050 | + | ||
1051 | + def remove_group(self, id, recursive = True): | ||
1052 | + if not PBXType.IsGuid(id): | ||
1053 | + id = id.id | ||
1054 | + name = self.objects.get(id).get('path') | ||
1055 | + children = self.objects.get(id).get('children') | ||
1056 | + if name is None: | ||
1057 | + name = id | ||
1058 | + if id in self.objects: | ||
1059 | + if recursive: | ||
1060 | + for childKey in children: | ||
1061 | + childValue = self.objects.get(childKey) | ||
1062 | + if childValue.get('isa') == 'PBXGroup': | ||
1063 | + self.remove_group(childKey, True) | ||
1064 | + else: | ||
1065 | + self.remove_file(childKey, False) | ||
1066 | + | ||
1067 | + self.objects.remove(id); | ||
1068 | + | ||
1069 | + def remove_group_by_name(self, name, recursive = True): | ||
1070 | + groups = self.get_groups_by_name(name) | ||
1071 | + if len(groups): | ||
1072 | + for group in groups: | ||
1073 | + self.remove_group(group.id, recursive) | ||
1074 | + | ||
1075 | + def move_file(self, id, dest_grp=None): | ||
1076 | + pass | ||
1077 | + | ||
1078 | + def apply_patch(self, patch_path, xcode_path): | ||
1079 | + if not os.path.isfile(patch_path) or not os.path.isdir(xcode_path): | ||
1080 | + print 'ERROR: couldn\'t apply "%s" to "%s"' % (patch_path, xcode_path) | ||
1081 | + return | ||
1082 | + | ||
1083 | + print 'applying "%s" to "%s"' % (patch_path, xcode_path) | ||
1084 | + | ||
1085 | + return subprocess.call(['patch', '-p1', '--forward', '--directory=%s' % xcode_path, '--input=%s' % patch_path]) | ||
1086 | + | ||
1087 | + def apply_mods(self, mod_dict, default_path=None): | ||
1088 | + if not default_path: | ||
1089 | + default_path = os.getcwd() | ||
1090 | + | ||
1091 | + keys = mod_dict.keys() | ||
1092 | + | ||
1093 | + for k in keys: | ||
1094 | + v = mod_dict.pop(k) | ||
1095 | + mod_dict[k.lower()] = v | ||
1096 | + | ||
1097 | + parent = mod_dict.pop('group', None) | ||
1098 | + | ||
1099 | + if parent: | ||
1100 | + parent = self.get_or_create_group(parent) | ||
1101 | + | ||
1102 | + excludes = mod_dict.pop('excludes', []) | ||
1103 | + | ||
1104 | + if excludes: | ||
1105 | + excludes = [re.compile(e) for e in excludes] | ||
1106 | + | ||
1107 | + compiler_flags = mod_dict.pop('compiler_flags', {}) | ||
1108 | + | ||
1109 | + for k, v in mod_dict.items(): | ||
1110 | + if k == 'patches': | ||
1111 | + for p in v: | ||
1112 | + if not os.path.isabs(p): | ||
1113 | + p = os.path.join(default_path, p) | ||
1114 | + | ||
1115 | + self.apply_patch(p, self.source_root) | ||
1116 | + elif k == 'folders': | ||
1117 | + # get and compile excludes list | ||
1118 | + # do each folder individually | ||
1119 | + for folder in v: | ||
1120 | + kwds = {} | ||
1121 | + | ||
1122 | + # if path contains ':' remove it and set recursive to False | ||
1123 | + if ':' in folder: | ||
1124 | + args = folder.split(':') | ||
1125 | + kwds['recursive'] = False | ||
1126 | + folder = args.pop(0) | ||
1127 | + | ||
1128 | + if os.path.isabs(folder) and os.path.isdir(folder): | ||
1129 | + pass | ||
1130 | + else: | ||
1131 | + folder = os.path.join(default_path, folder) | ||
1132 | + if not os.path.isdir(folder): | ||
1133 | + continue | ||
1134 | + | ||
1135 | + if parent: | ||
1136 | + kwds['parent'] = parent | ||
1137 | + | ||
1138 | + if excludes: | ||
1139 | + kwds['excludes'] = excludes | ||
1140 | + | ||
1141 | + self.add_folder(folder, **kwds) | ||
1142 | + elif k == 'headerpaths' or k == 'librarypaths': | ||
1143 | + paths = [] | ||
1144 | + | ||
1145 | + for p in v: | ||
1146 | + if p.endswith('/**'): | ||
1147 | + p = os.path.split(p)[0] | ||
1148 | + | ||
1149 | + if not os.path.isabs(p): | ||
1150 | + p = os.path.join(default_path, p) | ||
1151 | + | ||
1152 | + if not os.path.exists(p): | ||
1153 | + continue | ||
1154 | + | ||
1155 | + p = self.get_relative_path(p) | ||
1156 | + paths.append(os.path.join('$(SRCROOT)', p, "**")) | ||
1157 | + | ||
1158 | + if k == 'headerpaths': | ||
1159 | + self.add_header_search_paths(paths) | ||
1160 | + else: | ||
1161 | + self.add_library_search_paths(paths) | ||
1162 | + elif k == 'other_cflags': | ||
1163 | + self.add_other_cflags(v) | ||
1164 | + elif k == 'other_ldflags': | ||
1165 | + self.add_other_ldflags(v) | ||
1166 | + elif k == 'libs' or k == 'frameworks' or k == 'files': | ||
1167 | + paths = {} | ||
1168 | + | ||
1169 | + for p in v: | ||
1170 | + kwds = {} | ||
1171 | + | ||
1172 | + if ':' in p: | ||
1173 | + args = p.split(':') | ||
1174 | + p = args.pop(0) | ||
1175 | + | ||
1176 | + if 'weak' in args: | ||
1177 | + kwds['weak'] = True | ||
1178 | + | ||
1179 | + file_path = os.path.join(default_path, p) | ||
1180 | + search_path, file_name = os.path.split(file_path) | ||
1181 | + | ||
1182 | + if [m for m in excludes if re.match(m, file_name)]: | ||
1183 | + continue | ||
1184 | + | ||
1185 | + try: | ||
1186 | + expr = re.compile(file_name) | ||
1187 | + except re.error: | ||
1188 | + expr = None | ||
1189 | + | ||
1190 | + if expr and os.path.isdir(search_path): | ||
1191 | + file_list = os.listdir(search_path) | ||
1192 | + | ||
1193 | + for f in file_list: | ||
1194 | + if [m for m in excludes if re.match(m, f)]: | ||
1195 | + continue | ||
1196 | + | ||
1197 | + if re.search(expr, f): | ||
1198 | + kwds['name'] = f | ||
1199 | + paths[os.path.join(search_path, f)] = kwds | ||
1200 | + p = None | ||
1201 | + | ||
1202 | + if k == 'libs': | ||
1203 | + kwds['parent'] = self.get_or_create_group('Libraries', parent=parent) | ||
1204 | + elif k == 'frameworks': | ||
1205 | + kwds['parent'] = self.get_or_create_group('Frameworks', parent=parent) | ||
1206 | + | ||
1207 | + if p: | ||
1208 | + kwds['name'] = file_name | ||
1209 | + | ||
1210 | + if k == 'libs': | ||
1211 | + p = os.path.join('usr', 'lib', p) | ||
1212 | + kwds['tree'] = 'SDKROOT' | ||
1213 | + elif k == 'frameworks': | ||
1214 | + p = os.path.join('System', 'Library', 'Frameworks', p) | ||
1215 | + kwds['tree'] = 'SDKROOT' | ||
1216 | + elif k == 'files' and not os.path.exists(file_path): | ||
1217 | + # don't add non-existent files to the project. | ||
1218 | + continue | ||
1219 | + | ||
1220 | + paths[p] = kwds | ||
1221 | + | ||
1222 | + new_files = self.verify_files([n.get('name') for n in paths.values()]) | ||
1223 | + add_files = [(k, v) for k, v in paths.items() if v.get('name') in new_files] | ||
1224 | + | ||
1225 | + for path, kwds in add_files: | ||
1226 | + kwds.pop('name', None) | ||
1227 | + | ||
1228 | + if 'parent' not in kwds and parent: | ||
1229 | + kwds['parent'] = parent | ||
1230 | + | ||
1231 | + self.add_file(path, **kwds) | ||
1232 | + | ||
1233 | + if compiler_flags: | ||
1234 | + for k, v in compiler_flags.items(): | ||
1235 | + filerefs = [] | ||
1236 | + | ||
1237 | + for f in v: | ||
1238 | + filerefs.extend([fr.id for fr in self.objects.values() if fr.get('isa') == 'PBXFileReference' | ||
1239 | + and fr.get('name') == f]) | ||
1240 | + | ||
1241 | + buildfiles = [bf for bf in self.objects.values() if bf.get('isa') == 'PBXBuildFile' | ||
1242 | + and bf.get('fileRef') in filerefs] | ||
1243 | + | ||
1244 | + for bf in buildfiles: | ||
1245 | + if bf.add_compiler_flag(k): | ||
1246 | + self.modified = True | ||
1247 | + | ||
1248 | + def backup(self, file_name=None, backup_name=None): | ||
1249 | + if not file_name: | ||
1250 | + file_name = self.pbxproj_path | ||
1251 | + | ||
1252 | + if not backup_name: | ||
1253 | + backup_name = "%s.%s.backup" % (file_name, datetime.datetime.now().strftime('%d%m%y-%H%M%S')) | ||
1254 | + | ||
1255 | + shutil.copy2(file_name, backup_name) | ||
1256 | + return backup_name | ||
1257 | + | ||
1258 | + def save(self, file_name=None, old_format=False, sort=False): | ||
1259 | + if old_format : | ||
1260 | + self.save_format_xml(file_name) | ||
1261 | + else: | ||
1262 | + self.save_new_format(file_name, sort) | ||
1263 | + | ||
1264 | + def save_format_xml(self, file_name=None): | ||
1265 | + """Saves in old (xml) format""" | ||
1266 | + if not file_name: | ||
1267 | + file_name = self.pbxproj_path | ||
1268 | + | ||
1269 | + # This code is adapted from plistlib.writePlist | ||
1270 | + with open(file_name, "w") as f: | ||
1271 | + writer = PBXWriter(f) | ||
1272 | + writer.writeln("<plist version=\"1.0\">") | ||
1273 | + writer.writeValue(self.data) | ||
1274 | + writer.writeln("</plist>") | ||
1275 | + | ||
1276 | + def save_new_format(self, file_name=None, sort=False): | ||
1277 | + """Save in Xcode 3.2 compatible (new) format""" | ||
1278 | + if not file_name: | ||
1279 | + file_name = self.pbxproj_path | ||
1280 | + | ||
1281 | + # process to get the section's info and names | ||
1282 | + objs = self.data.get('objects') | ||
1283 | + sections = dict() | ||
1284 | + uuids = dict() | ||
1285 | + | ||
1286 | + for key in objs: | ||
1287 | + l = list() | ||
1288 | + | ||
1289 | + if objs.get(key).get('isa') in sections: | ||
1290 | + l = sections.get(objs.get(key).get('isa')) | ||
1291 | + | ||
1292 | + l.append(tuple([key, objs.get(key)])) | ||
1293 | + sections[objs.get(key).get('isa')] = l | ||
1294 | + | ||
1295 | + if 'name' in objs.get(key): | ||
1296 | + uuids[key] = objs.get(key).get('name') | ||
1297 | + elif 'path' in objs.get(key): | ||
1298 | + uuids[key] = objs.get(key).get('path') | ||
1299 | + else: | ||
1300 | + if objs.get(key).get('isa') == 'PBXProject': | ||
1301 | + uuids[objs.get(key).get('buildConfigurationList')] = 'Build configuration list for PBXProject "Unity-iPhone"' | ||
1302 | + elif objs.get(key).get('isa')[0:3] == 'PBX': | ||
1303 | + uuids[key] = objs.get(key).get('isa')[3:-10] | ||
1304 | + else: | ||
1305 | + uuids[key] = 'Build configuration list for PBXNativeTarget "TARGET_NAME"' | ||
1306 | + | ||
1307 | + ro = self.data.get('rootObject') | ||
1308 | + uuids[ro] = 'Project object' | ||
1309 | + | ||
1310 | + for key in objs: | ||
1311 | + # transitive references (used in the BuildFile section) | ||
1312 | + if 'fileRef' in objs.get(key) and objs.get(key).get('fileRef') in uuids: | ||
1313 | + uuids[key] = uuids[objs.get(key).get('fileRef')] | ||
1314 | + | ||
1315 | + # transitive reference to the target name (used in the Native target section) | ||
1316 | + if objs.get(key).get('isa') == 'PBXNativeTarget': | ||
1317 | + uuids[objs.get(key).get('buildConfigurationList')] = uuids[objs.get(key).get('buildConfigurationList')].replace('TARGET_NAME', uuids[key]) | ||
1318 | + | ||
1319 | + self.uuids = uuids | ||
1320 | + self.sections = sections | ||
1321 | + | ||
1322 | + out = open(file_name, 'w') | ||
1323 | + out.write('// !$*UTF8*$!\n') | ||
1324 | + self._printNewXCodeFormat(out, self.data, '', enters=True, sort=sort) | ||
1325 | + out.close() | ||
1326 | + | ||
1327 | + @classmethod | ||
1328 | + def addslashes(cls, s): | ||
1329 | + d = {'"': '\\"', "'": "\\'", "\0": "\\\0", "\\": "\\\\", "\n":"\\n"} | ||
1330 | + return ''.join(d.get(c, c) for c in s) | ||
1331 | + | ||
1332 | + def _printNewXCodeFormat(self, out, root, deep, enters=True, sort=False): | ||
1333 | + if isinstance(root, IterableUserDict): | ||
1334 | + out.write('{') | ||
1335 | + | ||
1336 | + if enters: | ||
1337 | + out.write('\n') | ||
1338 | + | ||
1339 | + isa = root.pop('isa', '') | ||
1340 | + | ||
1341 | + if isa != '': # keep the isa in the first spot | ||
1342 | + if enters: | ||
1343 | + out.write('\t' + deep) | ||
1344 | + | ||
1345 | + out.write('isa = ') | ||
1346 | + self._printNewXCodeFormat(out, isa, '\t' + deep, enters=enters) | ||
1347 | + out.write(';') | ||
1348 | + | ||
1349 | + if enters: | ||
1350 | + out.write('\n') | ||
1351 | + else: | ||
1352 | + out.write(' ') | ||
1353 | + | ||
1354 | + for key in sorted(root.iterkeys()): # keep the same order as Apple. | ||
1355 | + if enters: | ||
1356 | + out.write('\t' + deep) | ||
1357 | + | ||
1358 | + if re.match(regex, key).group(0) == key: | ||
1359 | + out.write(key.encode("utf-8") + ' = ') | ||
1360 | + else: | ||
1361 | + out.write('"' + key.encode("utf-8") + '" = ') | ||
1362 | + | ||
1363 | + if key == 'objects': | ||
1364 | + out.write('{') # open the objects section | ||
1365 | + | ||
1366 | + if enters: | ||
1367 | + out.write('\n') | ||
1368 | + #root.remove('objects') # remove it to avoid problems | ||
1369 | + | ||
1370 | + sections = [ | ||
1371 | + ('PBXBuildFile', False), | ||
1372 | + ('PBXCopyFilesBuildPhase', True), | ||
1373 | + ('PBXFileReference', False), | ||
1374 | + ('PBXFrameworksBuildPhase', True), | ||
1375 | + ('PBXGroup', True), | ||
1376 | + ('PBXAggregateTarget', True), | ||
1377 | + ('PBXNativeTarget', True), | ||
1378 | + ('PBXProject', True), | ||
1379 | + ('PBXResourcesBuildPhase', True), | ||
1380 | + ('PBXShellScriptBuildPhase', True), | ||
1381 | + ('PBXSourcesBuildPhase', True), | ||
1382 | + ('XCBuildConfiguration', True), | ||
1383 | + ('XCConfigurationList', True), | ||
1384 | + ('PBXTargetDependency', True), | ||
1385 | + ('PBXVariantGroup', True), | ||
1386 | + ('PBXReferenceProxy', True), | ||
1387 | + ('PBXContainerItemProxy', True), | ||
1388 | + ('XCVersionGroup', True)] | ||
1389 | + | ||
1390 | + for section in sections: # iterate over the sections | ||
1391 | + if self.sections.get(section[0]) is None: | ||
1392 | + continue | ||
1393 | + | ||
1394 | + out.write('\n/* Begin %s section */' % section[0].encode("utf-8")) | ||
1395 | + self.sections.get(section[0]).sort(cmp=lambda x, y: cmp(x[0], y[0])) | ||
1396 | + | ||
1397 | + if sort and section[0] == 'PBXGroup': | ||
1398 | + for entry in self.sections.get(section[0]): | ||
1399 | + entry[1]['children'] = sorted(entry[1]['children'], | ||
1400 | + key=lambda x: self.uuids[x].encode("utf-8")) | ||
1401 | + | ||
1402 | + for pair in self.sections.get(section[0]): | ||
1403 | + key = pair[0] | ||
1404 | + value = pair[1] | ||
1405 | + out.write('\n') | ||
1406 | + | ||
1407 | + if enters: | ||
1408 | + out.write('\t\t' + deep) | ||
1409 | + | ||
1410 | + out.write(key.encode("utf-8")) | ||
1411 | + | ||
1412 | + if key in self.uuids: | ||
1413 | + out.write(" /* " + self.uuids[key].encode("utf-8") + " */") | ||
1414 | + | ||
1415 | + out.write(" = ") | ||
1416 | + self._printNewXCodeFormat(out, value, '\t\t' + deep, enters=section[1]) | ||
1417 | + out.write(';') | ||
1418 | + | ||
1419 | + out.write('\n/* End %s section */\n' % section[0].encode("utf-8")) | ||
1420 | + | ||
1421 | + out.write(deep + '\t}') # close of the objects section | ||
1422 | + else: | ||
1423 | + self._printNewXCodeFormat(out, root[key], '\t' + deep, enters=enters) | ||
1424 | + | ||
1425 | + out.write(';') | ||
1426 | + | ||
1427 | + if enters: | ||
1428 | + out.write('\n') | ||
1429 | + else: | ||
1430 | + out.write(' ') | ||
1431 | + | ||
1432 | + root['isa'] = isa # restore the isa for further calls | ||
1433 | + | ||
1434 | + if enters: | ||
1435 | + out.write(deep) | ||
1436 | + | ||
1437 | + out.write('}') | ||
1438 | + | ||
1439 | + elif isinstance(root, UserList): | ||
1440 | + out.write('(') | ||
1441 | + | ||
1442 | + if enters: | ||
1443 | + out.write('\n') | ||
1444 | + | ||
1445 | + for value in root: | ||
1446 | + if enters: | ||
1447 | + out.write('\t' + deep) | ||
1448 | + | ||
1449 | + self._printNewXCodeFormat(out, value, '\t' + deep, enters=enters) | ||
1450 | + out.write(',') | ||
1451 | + | ||
1452 | + if enters: | ||
1453 | + out.write('\n') | ||
1454 | + | ||
1455 | + if enters: | ||
1456 | + out.write(deep) | ||
1457 | + | ||
1458 | + out.write(')') | ||
1459 | + | ||
1460 | + else: | ||
1461 | + if len(root) > 0 and re.match(regex, root).group(0) == root: | ||
1462 | + out.write(root.encode("utf-8")) | ||
1463 | + else: | ||
1464 | + out.write('"' + XcodeProject.addslashes(root.encode("utf-8")) + '"') | ||
1465 | + | ||
1466 | + if root in self.uuids: | ||
1467 | + out.write(" /* " + self.uuids[root].encode("utf-8") + " */") | ||
1468 | + | ||
1469 | + @classmethod | ||
1470 | + def Load(cls, path, pure_python=False): | ||
1471 | + if pure_python: | ||
1472 | + import openstep_parser as osp | ||
1473 | + tree = osp.OpenStepDecoder.ParseFromFile(open(path, 'r')) | ||
1474 | + else: | ||
1475 | + cls.plutil_path = os.path.join(os.path.split(__file__)[0], 'plutil') | ||
1476 | + | ||
1477 | + if not os.path.isfile(XcodeProject.plutil_path): | ||
1478 | + cls.plutil_path = 'plutil' | ||
1479 | + | ||
1480 | + # load project by converting to xml and then convert that using plistlib | ||
1481 | + p = subprocess.Popen([XcodeProject.plutil_path, '-convert', 'xml1', '-o', '-', path], stdout=subprocess.PIPE) | ||
1482 | + stdout, stderr = p.communicate() | ||
1483 | + | ||
1484 | + # If the plist was malformed, return code will be non-zero | ||
1485 | + if p.returncode != 0: | ||
1486 | + print stdout | ||
1487 | + return None | ||
1488 | + | ||
1489 | + tree = plistlib.readPlistFromString(stdout) | ||
1490 | + | ||
1491 | + return XcodeProject(tree, path) | ||
1492 | + | ||
1493 | + @classmethod | ||
1494 | + def LoadFromXML(cls, path): | ||
1495 | + tree = plistlib.readPlist(path) | ||
1496 | + return XcodeProject(tree, path) | ||
1497 | + | ||
1498 | + | ||
1499 | +# The code below was adapted from plistlib.py. | ||
1500 | + | ||
1501 | +class PBXWriter(plistlib.PlistWriter): | ||
1502 | + def writeValue(self, value): | ||
1503 | + if isinstance(value, (PBXList, PBXDict)): | ||
1504 | + plistlib.PlistWriter.writeValue(self, value.data) | ||
1505 | + else: | ||
1506 | + plistlib.PlistWriter.writeValue(self, value) | ||
1507 | + | ||
1508 | + def simpleElement(self, element, value=None): | ||
1509 | + """ | ||
1510 | + We have to override this method to deal with Unicode text correctly. | ||
1511 | + Non-ascii characters have to get encoded as character references. | ||
1512 | + """ | ||
1513 | + if value is not None: | ||
1514 | + value = _escapeAndEncode(value) | ||
1515 | + self.writeln("<%s>%s</%s>" % (element, value, element)) | ||
1516 | + else: | ||
1517 | + self.writeln("<%s/>" % element) | ||
1518 | + | ||
1519 | + | ||
1520 | +# Regex to find any control chars, except for \t \n and \r | ||
1521 | +_controlCharPat = re.compile( | ||
1522 | + r"[\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0b\x0c\x0e\x0f" | ||
1523 | + r"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f]") | ||
1524 | + | ||
1525 | + | ||
1526 | +def _escapeAndEncode(text): | ||
1527 | + m = _controlCharPat.search(text) | ||
1528 | + if m is not None: | ||
1529 | + raise ValueError("strings can't contains control characters; " | ||
1530 | + "use plistlib.Data instead") | ||
1531 | + text = text.replace("\r\n", "\n") # convert DOS line endings | ||
1532 | + text = text.replace("\r", "\n") # convert Mac line endings | ||
1533 | + text = text.replace("&", "&") # escape '&' | ||
1534 | + text = text.replace("<", "<") # escape '<' | ||
1535 | + text = text.replace(">", ">") # escape '>' | ||
1536 | + return text.encode("ascii", "xmlcharrefreplace") # encode as ascii with xml character references |
1 | +import os | ||
2 | + | ||
3 | +import commands | ||
4 | + | ||
5 | + | ||
6 | +buildProjName = '' | ||
7 | +targetName = '' | ||
8 | +import shutil | ||
9 | +import os | ||
10 | + | ||
11 | +def buildProj(): | ||
12 | + | ||
13 | + if buildProjName == '': | ||
14 | + print('buildProjName is not define') | ||
15 | + | ||
16 | + else: | ||
17 | + #build project | ||
18 | + commands.getstatusoutput('xcodebuild -project ' + buildProjName + '.xcodeproj') | ||
19 | + releaseDir = os.path.abspath('.') + '/Release' | ||
20 | + if not os.path.exists(releaseDir): | ||
21 | + os.mkdir(releaseDir) | ||
22 | + | ||
23 | + ipaPath = releaseDir + '/' + buildProjName + '-Release.ipa' | ||
24 | + buildPath = os.path.abspath('.') + '/build' | ||
25 | + if os.path.exists(ipaPath): | ||
26 | + os.remove(ipaPath) | ||
27 | + | ||
28 | + resultStr = commands.getstatusoutput('xcrun -sdk iphoneos PackageApplication -v build/Release-iphoneos/' + targetName + '.app -o ' +ipaPath) | ||
29 | + #print(resultStr) | ||
30 | + | ||
31 | + if os.path.exists(buildPath): | ||
32 | + shutil.rmtree(buildPath) | ||
33 | + |
1 | +{ | ||
2 | + "images" : [ | ||
3 | + { | ||
4 | + "idiom" : "iphone", | ||
5 | + "size" : "29x29", | ||
6 | + "scale" : "2x" | ||
7 | + }, | ||
8 | + { | ||
9 | + "idiom" : "iphone", | ||
10 | + "size" : "29x29", | ||
11 | + "scale" : "3x" | ||
12 | + }, | ||
13 | + { | ||
14 | + "idiom" : "iphone", | ||
15 | + "size" : "40x40", | ||
16 | + "scale" : "2x" | ||
17 | + }, | ||
18 | + { | ||
19 | + "idiom" : "iphone", | ||
20 | + "size" : "40x40", | ||
21 | + "scale" : "3x" | ||
22 | + }, | ||
23 | + { | ||
24 | + "idiom" : "iphone", | ||
25 | + "size" : "60x60", | ||
26 | + "scale" : "2x" | ||
27 | + }, | ||
28 | + { | ||
29 | + "idiom" : "iphone", | ||
30 | + "size" : "60x60", | ||
31 | + "scale" : "3x" | ||
32 | + } | ||
33 | + ], | ||
34 | + "info" : { | ||
35 | + "version" : 1, | ||
36 | + "author" : "xcode" | ||
37 | + } | ||
38 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +{ | ||
2 | + "images" : [ | ||
3 | + { | ||
4 | + "orientation" : "portrait", | ||
5 | + "idiom" : "iphone", | ||
6 | + "minimum-system-version" : "7.0", | ||
7 | + "scale" : "2x" | ||
8 | + }, | ||
9 | + { | ||
10 | + "orientation" : "portrait", | ||
11 | + "idiom" : "iphone", | ||
12 | + "minimum-system-version" : "7.0", | ||
13 | + "subtype" : "retina4", | ||
14 | + "scale" : "2x" | ||
15 | + } | ||
16 | + ], | ||
17 | + "info" : { | ||
18 | + "version" : 1, | ||
19 | + "author" : "xcode" | ||
20 | + } | ||
21 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
3 | +<plist version="1.0"> | ||
4 | +<dict> | ||
5 | + <key>CFBundleDevelopmentRegion</key> | ||
6 | + <string>en</string> | ||
7 | + <key>CFBundleExecutable</key> | ||
8 | + <string>$(EXECUTABLE_NAME)</string> | ||
9 | + <key>CFBundleIdentifier</key> | ||
10 | + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
11 | + <key>CFBundleInfoDictionaryVersion</key> | ||
12 | + <string>6.0</string> | ||
13 | + <key>CFBundleName</key> | ||
14 | + <string>$(PRODUCT_NAME)</string> | ||
15 | + <key>CFBundlePackageType</key> | ||
16 | + <string>APPL</string> | ||
17 | + <key>CFBundleShortVersionString</key> | ||
18 | + <string>1.0</string> | ||
19 | + <key>CFBundleSignature</key> | ||
20 | + <string>????</string> | ||
21 | + <key>CFBundleURLTypes</key> | ||
22 | + <array> | ||
23 | + <dict> | ||
24 | + <key>CFBundleTypeRole</key> | ||
25 | + <string>Editor</string> | ||
26 | + <key>CFBundleURLSchemes</key> | ||
27 | + <array> | ||
28 | + <string>com.youai.sdk</string> | ||
29 | + </array> | ||
30 | + </dict> | ||
31 | + </array> | ||
32 | + <key>CFBundleVersion</key> | ||
33 | + <string>1</string> | ||
34 | + <key>LSRequiresIPhoneOS</key> | ||
35 | + <true/> | ||
36 | + <key>UILaunchStoryboardName</key> | ||
37 | + <string>LaunchScreen</string> | ||
38 | + <key>UIMainStoryboardFile</key> | ||
39 | + <string>Main</string> | ||
40 | + <key>UIRequiredDeviceCapabilities</key> | ||
41 | + <array> | ||
42 | + <string>armv7</string> | ||
43 | + </array> | ||
44 | + <key>UISupportedInterfaceOrientations</key> | ||
45 | + <array> | ||
46 | + <string>UIInterfaceOrientationLandscapeLeft</string> | ||
47 | + <string>UIInterfaceOrientationLandscapeRight</string> | ||
48 | + </array> | ||
49 | +</dict> | ||
50 | +</plist> |
1 | +// | ||
2 | +// PoolSdk.h | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 11/23/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | +#import <PoolSdk/PoolSdk2.h> | ||
11 | +#import <UIKit/UIKit.h> | ||
12 | + | ||
13 | +@interface PoolSdk : NSObject | ||
14 | +/** | ||
15 | + * 当前SDK的版本 | ||
16 | + */ | ||
17 | +@property(nonatomic, strong, readonly)NSString *sdkVersion; | ||
18 | + | ||
19 | +/** | ||
20 | + * 用于设置url types schemes 默认为工程名 | ||
21 | + */ | ||
22 | +@property(nonatomic, strong)NSString *urlSchemes; | ||
23 | + | ||
24 | +/** | ||
25 | + 获取SDK实例对象 | ||
26 | + */ | ||
27 | ++ (PoolSdk *)shareSDK; | ||
28 | + | ||
29 | +/** | ||
30 | + 初始化SDK | ||
31 | + */ | ||
32 | +- (void)initSDK:(UIViewController *) control; | ||
33 | + | ||
34 | + | ||
35 | +-(void)viewDidAppear; | ||
36 | + | ||
37 | +/** | ||
38 | + 登录SDK | ||
39 | + */ | ||
40 | +- (void)loginSDK; | ||
41 | + | ||
42 | +/** | ||
43 | + 进行支付 | ||
44 | + */ | ||
45 | +- (void)payWithPaymentInfo:(PoolCreateOrderInfo *)payInfo; | ||
46 | + | ||
47 | +/** | ||
48 | + 用户中心 | ||
49 | + */ | ||
50 | +- (void)gotoUserCenter; | ||
51 | + | ||
52 | +/** | ||
53 | + report | ||
54 | + */ | ||
55 | +- (void)reportSDK:(PoolReportInfo *)reportInfo; | ||
56 | + | ||
57 | +/** | ||
58 | + 注销 | ||
59 | + */ | ||
60 | +- (void)logoutSDK; | ||
61 | + | ||
62 | +/** | ||
63 | + 退出 | ||
64 | + */ | ||
65 | +- (void)exitSDK; | ||
66 | + | ||
67 | + | ||
68 | + | ||
69 | +/** | ||
70 | + 显示/隐藏浮标 | ||
71 | + */ | ||
72 | +//- (void)showFloatIcon:(BOOL)bFlag; | ||
73 | + | ||
74 | + | ||
75 | +/** | ||
76 | + // called in - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url | ||
77 | + */ | ||
78 | +- (void)handleOpenurl:(NSURL *)url; | ||
79 | + | ||
80 | +- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window; | ||
81 | +/** | ||
82 | + 应用 appid | ||
83 | + */ | ||
84 | + | ||
85 | +/** | ||
86 | + 应用支持的方向 默认为 EDreamSDKOrientationLandscape | ||
87 | + */ | ||
88 | +@property(nonatomic, assign)ESDKOrientation sdkOrientation; | ||
89 | + | ||
90 | +/** | ||
91 | + 浮标是否已经显示,默认为NO | ||
92 | + */ | ||
93 | +@property(nonatomic, assign)BOOL bShowedFloat; | ||
94 | + | ||
95 | + | ||
96 | +/** | ||
97 | + serverId | ||
98 | + */ | ||
99 | +@property(nonatomic, assign)int serverId; | ||
100 | + | ||
101 | +/** | ||
102 | + 获取gamechannelid | ||
103 | + */ | ||
104 | +-(NSString *) getGameChannelId; | ||
105 | + | ||
106 | +/** | ||
107 | + 获取Custom | ||
108 | + */ | ||
109 | +- (NSString *) getCustomValue; | ||
110 | + | ||
111 | +/** | ||
112 | + 获取ChannelParameter1 | ||
113 | + */ | ||
114 | +- (NSString *) getChannelParameter1; | ||
115 | + | ||
116 | +/** | ||
117 | + 获取ChannelParameter2 | ||
118 | + */ | ||
119 | +- (NSString *) getChannelParameter2; | ||
120 | + | ||
121 | + | ||
122 | +@end |
1 | +// | ||
2 | +// PoolSdk.m | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 11/23/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import "PoolSdk.h" | ||
10 | +#import "SDKInterface.h" | ||
11 | + | ||
12 | +static PoolSdk *s_PoolSdkCerterInstance = nil; | ||
13 | +static id<UnionInterface> _interface = nil; | ||
14 | +@implementation PoolSdk : NSObject | ||
15 | + | ||
16 | +- (id)init | ||
17 | +{ | ||
18 | + if(self = [super init]) | ||
19 | + { | ||
20 | + _sdkVersion = [NSString stringWithFormat:@"%@ - %@",[[PoolConfig getInstance] gameSimpleName], [[PoolConfig getInstance] sdkSimpleName]]; | ||
21 | + _interface = [[SDKInterface alloc] init]; | ||
22 | + self.urlSchemes = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]; | ||
23 | + } | ||
24 | + return self; | ||
25 | +} | ||
26 | + | ||
27 | +- (void)initSDK :(UIViewController *) control | ||
28 | +{ | ||
29 | + if (![[NSUserDefaults standardUserDefaults] boolForKey:@"pool_everLaunched"]) { | ||
30 | + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"pool_everLaunched"]; | ||
31 | + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"pool_firstLaunch"]; | ||
32 | + } | ||
33 | + else{ | ||
34 | + [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"pool_firstLaunch"]; | ||
35 | + } | ||
36 | + | ||
37 | + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"firstLaunch"]) { | ||
38 | + | ||
39 | + } | ||
40 | + [_interface SDKinit:control]; | ||
41 | + | ||
42 | + [[PoolChecker getInstance] reportSDKOpen]; | ||
43 | + | ||
44 | + NSString* channelId = [[PoolConfig getInstance] getValueByKey:@"gamechannelid"]; | ||
45 | + [TrackingIO initWithappKey:[[PoolConfig getInstance] getValueByKey:@"renyunAppKey"] withChannelId:channelId]; | ||
46 | +} | ||
47 | + | ||
48 | +/** | ||
49 | + 获取SDK实例对象 | ||
50 | + */ | ||
51 | ++ (PoolSdk *)shareSDK | ||
52 | +{ | ||
53 | + static dispatch_once_t dgonceToken; | ||
54 | + dispatch_once(&dgonceToken, ^{ | ||
55 | + s_PoolSdkCerterInstance = [[PoolSdk alloc] init]; | ||
56 | + s_PoolSdkCerterInstance.sdkOrientation = ESDKOrientationLandscape; | ||
57 | + s_PoolSdkCerterInstance.bShowedFloat = NO; | ||
58 | + }); | ||
59 | + | ||
60 | + return s_PoolSdkCerterInstance; | ||
61 | +} | ||
62 | + | ||
63 | +-(void)viewDidAppear{ | ||
64 | + [_interface viewDidAppear]; | ||
65 | +} | ||
66 | + | ||
67 | +- (void)loginSDK | ||
68 | +{ | ||
69 | + [[PoolChecker getInstance] reportOpen]; | ||
70 | + [_interface SDKloginSDK]; | ||
71 | +} | ||
72 | + | ||
73 | +- (void)payWithPaymentInfo:(PoolCreateOrderInfo *)payInfo | ||
74 | +{ | ||
75 | + [_interface SDKpayWithPaymentInfo:payInfo]; | ||
76 | +} | ||
77 | + | ||
78 | +- (void)reportSDK:(PoolReportInfo *)reportInfo | ||
79 | +{ | ||
80 | + NSString *reportT = [reportInfo reportType]; | ||
81 | + reportInfo.openId = [[PoolChecker getInstance] userId]; | ||
82 | + if ([reportT isEqualToString:REPORT_ENTER]) { | ||
83 | + [[PoolChecker getInstance] reportEnter:reportInfo]; | ||
84 | + NSLog(@"reportSDK enter"); | ||
85 | + [TrackingIO setLoginWithAccountID:[reportInfo playerId]]; | ||
86 | + }else if ([reportT isEqualToString:REPORT_ROLEUPGRADE]){ | ||
87 | + | ||
88 | + }else if ([reportT isEqualToString:REPORT_CREATEROLE]){ | ||
89 | + NSLog(@"reportSDK createRole"); | ||
90 | + [TrackingIO setRegisterWithAccountID:[reportInfo playerId]]; | ||
91 | + } | ||
92 | +// [[PoolChecker getInstance] reportOpen]; | ||
93 | + [_interface SDKreport:reportInfo]; | ||
94 | + | ||
95 | +} | ||
96 | + | ||
97 | +- (void)gotoUserCenter | ||
98 | +{ | ||
99 | + [_interface SDKgotoUserCenter]; | ||
100 | +} | ||
101 | + | ||
102 | +- (void)logoutSDK | ||
103 | +{ | ||
104 | + [_interface SDKlogoutSDK]; | ||
105 | +} | ||
106 | + | ||
107 | +- (void)exitSDK | ||
108 | +{ | ||
109 | + [_interface SDKexitSDK]; | ||
110 | +} | ||
111 | + | ||
112 | +- (void)handleOpenurl:(NSURL *)url | ||
113 | +{ | ||
114 | + NSLog(@"handleOpenurl%@",url); | ||
115 | + if([[url host] isEqualToString:@"c_code"]){ | ||
116 | + NSString* path = url.path; | ||
117 | + NSString* codeValue = [path substringFromIndex:1]; | ||
118 | + [[PoolChecker getInstance] handleFirstOpenApp:codeValue]; | ||
119 | + } | ||
120 | + [_interface handleOpenurl:url]; | ||
121 | +} | ||
122 | + | ||
123 | +- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window | ||
124 | +{ | ||
125 | + return [_interface application:application supportedInterfaceOrientationsForWindow:window]; | ||
126 | +} | ||
127 | + | ||
128 | +- (NSString *)getGameChannelId{ | ||
129 | + return [[PoolConfig getInstance]getValueByKey:@"gamechannelid"]; | ||
130 | +} | ||
131 | + | ||
132 | +- (NSString *)getCustomValue{ | ||
133 | + return [[PoolConfig getInstance]getValueByKey:@"custom"]; | ||
134 | +} | ||
135 | + | ||
136 | +- (NSString *)getChannelParameter1{ | ||
137 | + return [[PoolConfig getInstance]getValueByKey:@"c1"]; | ||
138 | +} | ||
139 | + | ||
140 | +- (NSString *)getChannelParameter2{ | ||
141 | + return [[PoolConfig getInstance]getValueByKey:@"c2"]; | ||
142 | +} | ||
143 | + | ||
144 | +@end |
1 | +// | ||
2 | +// UnionInterface.m | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 11/23/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | +#include "SDKInterface.h" | ||
9 | +#import <UIKit/UIKit.h> | ||
10 | + | ||
11 | +#import "YouaiSDK/YouaiSDKMgr.h" | ||
12 | +#import "YouaiSDK/YouaiNotifications.h" | ||
13 | +#import "YouaiSDK/YouaiLoginInfo.h" | ||
14 | + | ||
15 | + | ||
16 | +//SDK | ||
17 | + | ||
18 | + | ||
19 | +@implementation SDKInterface : Interface | ||
20 | + | ||
21 | + | ||
22 | +int mExchange; | ||
23 | + | ||
24 | + | ||
25 | +/** | ||
26 | + 初始化SDK | ||
27 | +*/ | ||
28 | +- (void)SDKinit:(UIViewController *) control | ||
29 | +{ | ||
30 | + //必须继承 | ||
31 | + [super SDKinit:control]; | ||
32 | + | ||
33 | + [PoolConfig getInstance]; | ||
34 | + [[YouaiSDKMgr getInstance]initSDK]; | ||
35 | + [[YouaiSDKMgr getInstance]setStyleName:@"sdk"]; | ||
36 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveLoginMessage:) name:youaiLoginNotification object:nil]; | ||
37 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applePayCallBack:) name:@"applePayCallBack" object:nil]; | ||
38 | + | ||
39 | + [[PoolChecker getInstance] sendNotice:PoolSDKNotificationInitSDK notiName:@"InitSuccess" statusCode:POOLSDK_NO_ERROR description:@"initSuccess" extendData:nil]; | ||
40 | +} | ||
41 | + | ||
42 | +/** | ||
43 | + 登录SDK | ||
44 | + */ | ||
45 | +- (void)SDKloginSDK | ||
46 | +{ | ||
47 | + NSLog(@"调用了LoginSDK"); | ||
48 | + NSString *appId = [[PoolConfig getInstance] getValueByKey:@"APP_ID"]; | ||
49 | + NSString *appKey =[[PoolConfig getInstance] getValueByKey:@"APP_KEY"]; | ||
50 | + [[YouaiSDKMgr getInstance]openLogin:appId :appKey :self.controller]; | ||
51 | + | ||
52 | +} | ||
53 | + | ||
54 | +/** | ||
55 | + loginCheck | ||
56 | + */ | ||
57 | +- (void)receiveLoginMessage:(NSNotification *)notification | ||
58 | +{ | ||
59 | + NSLog(@"loginchek"); | ||
60 | + PoolLoginInfo *loginInfo = [PoolLoginInfo alloc]; | ||
61 | + loginInfo.openId = [[YouaiLoginInfo getInstance]openId]; | ||
62 | + loginInfo.sign = [[YouaiLoginInfo getInstance] token]; | ||
63 | + loginInfo.timestamp = [YouaiLoginInfo getInstance].timestamp; | ||
64 | + | ||
65 | + dispatch_async(dispatch_get_global_queue(0, 0), ^{ | ||
66 | + [[PoolChecker getInstance] startCheck:loginInfo]; | ||
67 | + }); | ||
68 | + | ||
69 | +} | ||
70 | + | ||
71 | + | ||
72 | +-(NSString*)DataTojsonString:(id)object | ||
73 | +{ | ||
74 | + NSString *jsonString = nil; | ||
75 | + NSError *error; | ||
76 | + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:object | ||
77 | + options:NSJSONWritingPrettyPrinted // Pass 0 if you don't care about the readability of the generated string | ||
78 | + error:&error]; | ||
79 | + jsonString = [jsonData base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength]; | ||
80 | + return jsonString; | ||
81 | +} | ||
82 | + | ||
83 | +/** | ||
84 | + 苹果支付结果回调 | ||
85 | + */ | ||
86 | + | ||
87 | +- (void)applePayCallBack:(NSNotification *)notification | ||
88 | +{ | ||
89 | + NSDictionary* payResultDic = notification.object; | ||
90 | + | ||
91 | + NSString* receiptStr = [payResultDic objectForKey:@"payResult"]; | ||
92 | + NSString* queryId = [payResultDic objectForKey:@"query_id"]; | ||
93 | + | ||
94 | + NSDictionary* receiptDic = [NSDictionary dictionaryWithObjectsAndKeys:receiptStr,@"receipt",queryId,@"query_id", nil]; | ||
95 | + NSString* result = [[NetCenter getInstance] httpPostSyn:[PoolUtils createPayUrl] :receiptDic]; | ||
96 | + | ||
97 | + | ||
98 | + if([@"success" isEqualToString:result]){//确认订单成功 | ||
99 | + }else{//失败 | ||
100 | + NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults]; | ||
101 | + NSMutableArray* queryIdArray = [userDefaults objectForKey:@"queryIds"]; | ||
102 | + | ||
103 | + NSMutableArray* tempQueryIdArray = [[NSMutableArray alloc] initWithCapacity:10]; | ||
104 | + | ||
105 | + if (queryIdArray) { | ||
106 | + }else{ | ||
107 | + queryIdArray = [[NSMutableArray alloc]initWithCapacity:10]; | ||
108 | + } | ||
109 | + | ||
110 | + for (NSString* arrayQueryId in queryIdArray) { | ||
111 | + [tempQueryIdArray addObject:arrayQueryId]; | ||
112 | + } | ||
113 | + | ||
114 | + [tempQueryIdArray addObject:queryId]; | ||
115 | + [userDefaults setObject:tempQueryIdArray forKey:@"queryIds"]; | ||
116 | + [userDefaults setObject:receiptStr forKey:queryId]; | ||
117 | + [userDefaults synchronize]; | ||
118 | + } | ||
119 | +} | ||
120 | + | ||
121 | +/** | ||
122 | + 支付 创建订单 | ||
123 | + */ | ||
124 | +- (void)SDKpayWithPaymentInfo:(PoolCreateOrderInfo *)payInfo | ||
125 | +{ | ||
126 | + mExchange = [payInfo exchange].intValue; | ||
127 | + [super SDKpayWithPaymentInfo:payInfo]; | ||
128 | +} | ||
129 | + | ||
130 | +/** | ||
131 | + SDK | ||
132 | + */ | ||
133 | +- (void)SDKgotoUserCenter | ||
134 | +{ | ||
135 | +} | ||
136 | + | ||
137 | +- (void)SDKreport:(PoolReportInfo *)reportInfo | ||
138 | +{ | ||
139 | + NSLog(@"reportInfo"); | ||
140 | + NSString* reportType = [reportInfo reportType]; | ||
141 | + if (reportInfo) { | ||
142 | + if ([reportType isEqualToString:REPORT_ENTER]) { | ||
143 | + dispatch_async(dispatch_get_global_queue(0, 0), ^{ | ||
144 | + [self handlerLeakOrder]; | ||
145 | + }); | ||
146 | + } | ||
147 | + } | ||
148 | +} | ||
149 | + | ||
150 | +/** | ||
151 | + SDK | ||
152 | + */ | ||
153 | +- (void)SDKexitSDK | ||
154 | +{ | ||
155 | + | ||
156 | +} | ||
157 | + | ||
158 | +- (void)SDKlogoutSDK | ||
159 | +{ | ||
160 | + NSLog(@"切换账号"); | ||
161 | +} | ||
162 | + | ||
163 | +- (void)handleOpenurl:(NSURL *)url | ||
164 | +{ | ||
165 | +} | ||
166 | + | ||
167 | +- (void)receivePayMessage : (NSNotification *)notification; | ||
168 | +{ | ||
169 | + NSString *order_id = [notification object]; | ||
170 | + NSLog(@"订单ID:%@", order_id); | ||
171 | +} | ||
172 | + | ||
173 | +//补单处理 | ||
174 | +- (void) handlerLeakOrder{ | ||
175 | + NSUserDefaults* userDefaults2 = [NSUserDefaults standardUserDefaults]; | ||
176 | + NSMutableArray* queryIdArray = [userDefaults2 objectForKey:@"queryIds"]; | ||
177 | + | ||
178 | + NSLog(@"orderDic%@",queryIdArray); | ||
179 | + NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults]; | ||
180 | + NSMutableArray* failQueryIdArray = [[NSMutableArray alloc]initWithCapacity:10];//补单失败的queryid集合 | ||
181 | + | ||
182 | + if(queryIdArray){ | ||
183 | + for (NSString* queryId in queryIdArray) { | ||
184 | + NSString* receiptStr = [userDefaults valueForKey:queryId]; | ||
185 | + NSDictionary* receiptDic = [NSDictionary dictionaryWithObjectsAndKeys:receiptStr,@"receipt",queryId,@"query_id", nil]; | ||
186 | + NSString* result = [[NetCenter getInstance] httpPostSyn:[PoolUtils createPayUrl] :receiptDic]; | ||
187 | + if([@"success" isEqualToString:result]){//成功 | ||
188 | + [userDefaults removeObjectForKey:queryId]; | ||
189 | + }else{//补单失败 | ||
190 | + [failQueryIdArray addObject:queryId]; | ||
191 | + } | ||
192 | + } | ||
193 | + | ||
194 | + NSLog(@"order count:%lu",(unsigned long)[failQueryIdArray count]); | ||
195 | + if([failQueryIdArray count] > 0){//含有补单失败项 | ||
196 | + [userDefaults setObject:failQueryIdArray forKey:@"queryIds"]; | ||
197 | + }else{//全部补单成功 | ||
198 | + [userDefaults removeObjectForKey:@"queryIds"]; | ||
199 | + } | ||
200 | + [userDefaults synchronize]; | ||
201 | + } | ||
202 | +} | ||
203 | + | ||
204 | + | ||
205 | +- (void)receiveCreateOrder:(NSNotification *)notification | ||
206 | +{ | ||
207 | + NSLog(@"创建订单成功"); | ||
208 | + PoolPayInfo *payInfo = [notification object]; | ||
209 | + | ||
210 | + NSNumber *amount = @([[payInfo postAmount] integerValue] * mExchange); | ||
211 | + NSString *serverId = [payInfo serverId]; | ||
212 | + NSString *roleName = [payInfo playerName]; | ||
213 | + NSString *queryId = [payInfo queryId]; | ||
214 | + | ||
215 | + dispatch_async(dispatch_get_global_queue(0, 0), ^{ | ||
216 | + [self handlerLeakOrder]; | ||
217 | + }); | ||
218 | + | ||
219 | + NSString *isOpenThirdPay = [payInfo isOpenThirdPay]; | ||
220 | + NSLog(@"custom%@",[payInfo custom]); | ||
221 | + if([isOpenThirdPay isEqualToString:@"false"]){ | ||
222 | + NSString* products = [payInfo products]; | ||
223 | + //NSLog(@"products:%@",products); | ||
224 | + [[YouaiSDKMgr getInstance] openApplePay:self.controller products:products amount:[payInfo postAmount] queryId:queryId]; | ||
225 | + }else{ | ||
226 | + [[YouaiSDKMgr getInstance] openPay:serverId :roleName :amount :[payInfo queryId] :self.controller]; | ||
227 | + } | ||
228 | + | ||
229 | + int64_t delayInSeconds = 5.0; // 延迟的时间 | ||
230 | + dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); | ||
231 | + dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ | ||
232 | + NSLog(@"chage state"); | ||
233 | + [[PoolChecker getInstance] setOnlyOneTimePay:false]; | ||
234 | + }); | ||
235 | +} | ||
236 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// IapController.h | ||
3 | +// mangosanguo | ||
4 | +// | ||
5 | +// Created by Gino on 12-11-6. | ||
6 | +// Copyright (c) 2012年 private. All rights reserved. | ||
7 | +// | ||
8 | +#if applepay | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | +#import "StoreKit/StoreKit.h" | ||
11 | + | ||
12 | +@interface IapController : NSObject<SKProductsRequestDelegate,SKPaymentTransactionObserver> | ||
13 | +{ | ||
14 | + bool isRequestedBuy; | ||
15 | + SKPaymentTransaction *PayTransaction; | ||
16 | + | ||
17 | + NSMutableArray *payArray; | ||
18 | + SKPaymentTransaction *curTransaction; | ||
19 | +} | ||
20 | + | ||
21 | ++ (IapController *)sharedController; | ||
22 | +- (id)init; | ||
23 | +- (void)removeIt; | ||
24 | +- (void)requestProductData; | ||
25 | +- (void)requestBuyProduct:(NSString *)identifier; | ||
26 | + | ||
27 | +- (void)requestProductInfoById:(NSString *)str; | ||
28 | +- (void)comfireTransactions:(bool)isSuessPosted; | ||
29 | +- (void)checkReceiptIsFail; | ||
30 | + | ||
31 | +- (void)addItemToPayArray:(SKPaymentTransaction *)transaction; | ||
32 | +- (bool)checkPayArrayIsEmpty; | ||
33 | +- (void)checkReceiptForArray; | ||
34 | + | ||
35 | +- (void)setAppleCallBack: (NSString*)url; | ||
36 | +@end | ||
37 | +#endif | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// YouaiLoginInfo.h | ||
3 | +// YouaiSDK | ||
4 | +// | ||
5 | +// Created by 莫 东荣 on 13-4-10. | ||
6 | +// Copyright (c) 2013年 莫 东荣. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | + | ||
11 | +@interface YouaiLoginInfo : NSObject //用户uid | ||
12 | +{ | ||
13 | +// | ||
14 | +NSString *openId; | ||
15 | +//token | ||
16 | +NSString *token; | ||
17 | +//时间戳 | ||
18 | +NSString *timestamp; | ||
19 | + | ||
20 | +} | ||
21 | + | ||
22 | +@property(retain,nonatomic) NSString *openId; | ||
23 | +@property(retain,nonatomic) NSString *token; | ||
24 | +@property(retain,nonatomic) NSString *timestamp; | ||
25 | ++ (YouaiLoginInfo *)getInstance; | ||
26 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// YouaiNotifications.h | ||
3 | +// YouaiSDK | ||
4 | +// | ||
5 | +// Created by 莫 东荣 on 13-4-10. | ||
6 | +// Copyright (c) 2013年 莫 东荣. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | + | ||
11 | +extern NSString * const youaiExitNotification; /**< 退出 */ | ||
12 | +extern NSString * const youaiLoginNotification; /**< 登录完成的通知*/ | ||
13 | +extern NSString * const youaiPaytNotification; /**< 支付通知 */ | ||
14 | +extern NSString * const youaiShareNotification; /**< 分享通知 */ | ||
15 | +extern NSString * const youaiCenterNotification; /**< 用户中心通知 */ | ||
16 | +extern NSString * const youaiErrorNotification; /**< 出错 */ | ||
17 | + | ||
18 | + | ||
19 | +@interface YouaiNotifications : NSObject | ||
20 | + | ||
21 | +@end |
1 | +// | ||
2 | +// YouaiSDKMgr.h | ||
3 | +// YouaiSDK | ||
4 | +// | ||
5 | +// Created by 莫 东荣 on 13-4-9. | ||
6 | +// Copyright (c) 2013年 莫 东荣. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <UIKit/UIKit.h> | ||
10 | +#import "StoreKit/StoreKit.h" | ||
11 | + | ||
12 | +@interface YouaiSDKMgr : NSObject | ||
13 | +{ | ||
14 | + NSString* appId_; | ||
15 | + NSString* appKey_; | ||
16 | + | ||
17 | + NSString* inviterCode_; | ||
18 | + | ||
19 | +// NSString* openId; | ||
20 | +// NSString* loginKey; | ||
21 | +} | ||
22 | + | ||
23 | ++ (YouaiSDKMgr *)getInstance; | ||
24 | +- (void)initSDK; | ||
25 | +- (void)initSDK:(NSString *)weixinId; | ||
26 | + | ||
27 | +- (void)openLogin:(NSString *)appId : (NSString *)appKey : (UIViewController *)controller; | ||
28 | +- (void)openLogin:(NSString *)appId : (NSString *)appKey : (UIViewController *)controller : (NSString *) inviterCode; | ||
29 | +- (void)openLogin:(NSString *)appId : (NSString *)appKey : (UIViewController *)controller : (NSString *) inviterCode : (NSString *)userName : (NSString *)passWord; | ||
30 | +- (void)setStyleName:(NSString*)styleName; | ||
31 | +- (void)openLogin:(NSString *)appId : (NSString *)appKey : (UIViewController *)controller : (NSString *)userName : (NSString *)passWord; | ||
32 | + | ||
33 | +- (void)openCenter: (UIViewController *)controller; | ||
34 | +- (void)openPay: (NSString *)serverId : (NSString *)nickName : (NSString *)callBack : (UIViewController *)controller; | ||
35 | +- (void)openPay: (NSString *)serverId : (NSString *)nickName : (NSNumber *)payAmount : (NSString *)callBack : (UIViewController *)controller; | ||
36 | +- (void)openShare: (UIViewController *)controller; | ||
37 | +- (void)log: (NSString*)log_key : (NSInteger)log_data: (NSString*)log_remark; | ||
38 | + | ||
39 | +- (void)openApplePay:(UIViewController*)controll products:(NSString*)products amount:(NSString*)amount queryId:(NSString*) queryId; | ||
40 | + | ||
41 | + | ||
42 | +- (void)checkAilpay: (NSURL *)url : (UIViewController *)controller; | ||
43 | + | ||
44 | +- (void)applePayCallBack:(NSString *)url :(SKPaymentTransaction *)transaction :(NSString *)resultStr; | ||
45 | + | ||
46 | + | ||
47 | + | ||
48 | +@end |
1 | +// | ||
2 | +// YouaiViewController.h | ||
3 | +// newYouaiSDK | ||
4 | +// | ||
5 | +// Created by Mog90 on 14-9-28. | ||
6 | +// Copyright (c) 2014年 东荣 莫. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <UIKit/UIKit.h> | ||
10 | +#import "YouaiLoginInfo.h" | ||
11 | + | ||
12 | +@interface YouaiViewController : UIViewController<UIWebViewDelegate,UIAlertViewDelegate> | ||
13 | +{ | ||
14 | + UIWebView *webView_; | ||
15 | + UIActivityIndicatorView *activityIndicator; | ||
16 | +} | ||
17 | + | ||
18 | + | ||
19 | +//@property(assign) int webViewWidth; | ||
20 | +//@property(assign) int webViewHeight; | ||
21 | +//@property(assign) int screenwidth; | ||
22 | +//@property(assign) int screenHeight; | ||
23 | + | ||
24 | +@property(assign) BOOL hasCorner; | ||
25 | + | ||
26 | +-(void)setView:(int)webViewWidth :(int) webViewHeight :(int) screenwidth :(int) screenHeight; | ||
27 | +- (void)initWebView; | ||
28 | +- (void)loadWebPageWithString:(NSString *)url; | ||
29 | +- (void)loadWebPageWithJs:(NSString *)content; | ||
30 | +- (void)postNotification:(NSString *)name : (NSString *)code; | ||
31 | +- (void)receiveIap:(NSNotification *)notification; | ||
32 | + | ||
33 | +@end |
1 | +{ | ||
2 | +"APP_ID": "58fd78a9834e7246b8dc0eac", | ||
3 | +"APP_KEY":"b06b86b79c25774ec758657a7203bae6", | ||
4 | +"renyunAppKey":"7ca554a6f94f5477c6592f4e484bb49d", | ||
5 | + | ||
6 | +"appScheme": "com.qyj.ios.xw", | ||
7 | + | ||
8 | +"gameSimpleName": "fytx_test", | ||
9 | +"sdkSimpleName": "apple_youyu", | ||
10 | +"sdkVersionCode":"V1_0", | ||
11 | + | ||
12 | +"gamechannelid": "123456", | ||
13 | +"custom": "", | ||
14 | +"c2": "", | ||
15 | +"c1": "", | ||
16 | +"loginCheckUrl": "https://public.sdk.gzyouai.com/logincheck/check/", | ||
17 | +"payorderurl": "https://public.sdk.gzyouai.com/paycheck/create", | ||
18 | +"paycheckurl": "https://public.sdk.gzyouai.com/paycheck/confirm" | ||
19 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +import shutil | ||
2 | +import os | ||
3 | +import plistlib | ||
4 | + | ||
5 | +import config | ||
6 | +import json | ||
7 | +import packageProj | ||
8 | + | ||
9 | +from mod_pbxproj import XcodeProject | ||
10 | + | ||
11 | + | ||
12 | +gameProjName = config.gameProjName | ||
13 | +#copy dir xcodeproj | ||
14 | +copyNewDirName = gameProjName + '_youdian.xcodeproj' | ||
15 | +currentPath = os.path.abspath('.') | ||
16 | +currentPath += '/' + copyNewDirName | ||
17 | + | ||
18 | + | ||
19 | +if os.path.exists(currentPath): | ||
20 | + shutil.rmtree(currentPath) | ||
21 | + | ||
22 | +shutil.copytree(gameProjName + '.xcodeproj',currentPath) | ||
23 | + | ||
24 | +project = XcodeProject.Load(copyNewDirName + '/project.pbxproj') | ||
25 | + | ||
26 | +project.add_other_ldflags('-ObjC') | ||
27 | +#frameworks = project.add_folder('poolsdk_file/poolsdk_itools') | ||
28 | +#print(frameworks); | ||
29 | +#add search path | ||
30 | + | ||
31 | +channelRootPath = config.channelRootPath#'poolsdk_file' | ||
32 | + | ||
33 | +frameworksPath = '$(PROJECT_DIR)/' + channelRootPath + '/poolsdk_youdian/SDK' | ||
34 | +print(frameworksPath); | ||
35 | +#add header search path | ||
36 | +project.add_header_search_paths(frameworksPath, recursive=False) | ||
37 | +#add framework search path | ||
38 | +project.add_framework_search_paths(frameworksPath, recursive=False) | ||
39 | +#add library search path | ||
40 | +project.add_library_search_paths(frameworksPath, recursive=False) | ||
41 | + | ||
42 | +#add poolsdk_xy dir all file into project | ||
43 | +project.remove_group_by_name('poolsdk') | ||
44 | +frameworkRelativePath = project.add_folder(channelRootPath + '/poolsdk_youdian/SDK') | ||
45 | + | ||
46 | +#ignore_unknown_type | ||
47 | +project.add_file_if_doesnt_exist('pool_setting',parent=frameworkRelativePath, weak=True,ignore_unknown_type=True) | ||
48 | + | ||
49 | + | ||
50 | +systemFrameworks = project.get_or_create_group('Frameworks') | ||
51 | +#add system framework | ||
52 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/MobileCoreServices.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
53 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/WebKit.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
54 | + | ||
55 | +#add system dylib | ||
56 | +systemLibs = project.get_or_create_group('Libraries') | ||
57 | +project.add_file_if_doesnt_exist('/usr/lib/libz.1.dylib',parent=systemLibs, weak=True, tree='<absolute>') | ||
58 | + | ||
59 | +#modify info.plist reference path | ||
60 | +project.add_single_valued_flag('INFOPLIST_FILE',channelRootPath + '/poolsdk_youdian/Info.plist') | ||
61 | + | ||
62 | +project.add_single_valued_flag('ENABLE_BITCODE', 'NO') | ||
63 | + | ||
64 | +readInfoPlistFilePath = channelRootPath + '/poolsdk/Info.plist' | ||
65 | +writeInfoFilePath = channelRootPath + '/poolsdk_youdian/Info.plist' | ||
66 | +infoContent = plistlib.readPlist(readInfoPlistFilePath) | ||
67 | + | ||
68 | +xyInfoPath = channelRootPath + '/poolsdk_youdian/Info_youdian.plist' | ||
69 | +xyInfoContent = plistlib.readPlist(xyInfoPath) | ||
70 | + | ||
71 | +#read pool_setting file | ||
72 | +settingFile = open(channelRootPath + '/poolsdk_youdian/SDK/pool_setting','rw') | ||
73 | +try: | ||
74 | + settingFileContent = settingFile.read( ) | ||
75 | +finally: | ||
76 | + settingFile.close( ) | ||
77 | +#json op | ||
78 | +jsonStr = json.loads(settingFileContent) | ||
79 | + | ||
80 | +#modify bundle id | ||
81 | +project.add_single_valued_flag('PRODUCT_BUNDLE_IDENTIFIER',jsonStr["appScheme"]) | ||
82 | + | ||
83 | +#update and add info.plist content | ||
84 | +infoContent.update(xyInfoContent) | ||
85 | +#write | ||
86 | +plistlib.writePlist(infoContent,writeInfoFilePath) | ||
87 | + | ||
88 | +project.save() | ||
89 | + | ||
90 | + | ||
91 | +packageProj.buildProjName = gameProjName + '_youdian' | ||
92 | +packageProj.targetName = gameProjName | ||
93 | +packageProj.buildProj() |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
3 | +<plist version="1.0"> | ||
4 | +<dict> | ||
5 | + <key>NSAppTransportSecurity</key> | ||
6 | + <dict> | ||
7 | + <key>NSAllowsArbitraryLoads</key> | ||
8 | + <true/> | ||
9 | + </dict> | ||
10 | +</dict> | ||
11 | +</plist> |

4.93 KB

1.81 KB

3.63 KB

3.82 KB

1.61 KB

3.09 KB

2.57 KB

6.25 KB

6.3 KB

2.59 KB

2.76 KB

1.28 KB

1.52 KB

1.45 KB

2.55 KB

4.94 KB

4.38 KB

6.16 KB

1.65 KB

1.56 KB

2.76 KB

2.42 KB

1.21 KB

8.92 KB

8.31 KB
1 | +// | ||
2 | +// LYDataJson.h | ||
3 | +// LYPlatform | ||
4 | +// | ||
5 | +// Created by wanghui on 14/11/29. | ||
6 | +// Copyright 2014 linnyou Inc.. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | + | ||
11 | +#import "LYResult.h" | ||
12 | + | ||
13 | +@interface LYDataJson : NSObject | ||
14 | + | ||
15 | +@property (nonatomic, retain) LYResult* result; | ||
16 | +@property (nonatomic, retain) NSMutableDictionary* infoDict; | ||
17 | ++(LYDataJson*) withDictionary:(NSDictionary*)dict checkInfo:(BOOL)checkInfo; | ||
18 | + | ||
19 | +-(BOOL) isOK; | ||
20 | +-(NSString*)originalAsString; | ||
21 | + | ||
22 | + | ||
23 | +@end |
1 | +// | ||
2 | +// LYGameConfig.h | ||
3 | +// LYDemoSDK | ||
4 | +// | ||
5 | +// Created by LG on 16/8/23. | ||
6 | +// Copyright (c) 2016年 LG. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | +#import <UIKit/UIApplication.h> | ||
11 | + | ||
12 | +#import "LYGameDefines.h" | ||
13 | + | ||
14 | + | ||
15 | +@interface LYGameConfig : NSObject | ||
16 | + | ||
17 | + | ||
18 | ++(LYGameConfig*) instance; | ||
19 | + | ||
20 | +@property(nonatomic,readwrite,assign) NSString* location; //发布区域(测试test,正式cn) | ||
21 | +@property(nonatomic,readwrite,retain) NSString* productId; //产品id | ||
22 | +@property(nonatomic,readwrite,retain) NSDictionary* channelParameter; | ||
23 | +@property(nonatomic,readwrite,assign) BOOL debugState; //是否开启调试状态 | ||
24 | +@property(nonatomic,readwrite,retain) NSString* linnyouKey; //麟游互动signkey | ||
25 | +@property(nonatomic,readwrite,retain) NSString *dataMsg; //获取uid的data信息 | ||
26 | + | ||
27 | +@property(nonatomic,readwrite,assign) BOOL deviceOrientationPortrait;//设备当前的位置朝向而改变 | ||
28 | +@property(nonatomic,readwrite,assign) BOOL deviceOrientationPortraitUpsideDown; | ||
29 | +@property(nonatomic,readwrite,assign) BOOL deviceOrientationLandscapeLeft; | ||
30 | +@property(nonatomic,readwrite,assign) BOOL deviceOrientationLandscapeRight; | ||
31 | + | ||
32 | +@end |
1 | +// | ||
2 | +// LYGameDefines.h | ||
3 | +// LYDemoSDK | ||
4 | +// | ||
5 | +// Created by LG on 16/8/23. | ||
6 | +// Copyright (c) 2016年 LG. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +// 区域 | ||
10 | +typedef enum _LY_Location_Type_{ | ||
11 | + LYLocationInTest, //内网测试 | ||
12 | + LYLocationTest, //外网测试 | ||
13 | + LYLocationCn, //国内 | ||
14 | + LYLocationTw, //繁体区 | ||
15 | +}LYLocation; | ||
16 | + | ||
17 | +// 离开平台的类型 | ||
18 | +typedef enum _LY_LeavedPlatform_Type_{ | ||
19 | + LYPlatformLeavedUnknown = 0, | ||
20 | + LYPlatformLeavedFromLoginRegist, // 离开登录注册页面 | ||
21 | + LYPlatformLeavedFromUserCenter, // 包括个人中心页面 | ||
22 | + LYPlatformLeavedFromCharge, // 离开充值页面 | ||
23 | + LYPlatformLeavedFromPay, // 离开支付页面 | ||
24 | + LYPlatformLeavedFromChargeAnaPay, // 离开充值并支付页面 | ||
25 | + LYPlatformLeavedFromPause, // 离开暂停页面 | ||
26 | +}LYPlatformLeavedType; | ||
27 | + | ||
28 | + | ||
29 | + | ||
30 | + | ||
31 | +extern NSString * const kLYAppId; | ||
32 | +extern NSString * const kLYAppKey; | ||
33 | +extern NSString * const kLYAppScheme; | ||
34 | +extern NSString * const kLYAppPayKey; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// LYGameDelegate.h | ||
3 | +// LYGameSDK | ||
4 | +// | ||
5 | +// Created by LG on 16/9/21. | ||
6 | +// Copyright (c) 2016年 LG. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | +#import "LYResult.h" | ||
11 | +#import "LYGameDefines.h" | ||
12 | +@protocol LYGameDelegate <NSObject> | ||
13 | + | ||
14 | + | ||
15 | +//平台初始化成功 | ||
16 | +-(void) onGameInitFinished:(LYResult*)result; | ||
17 | + | ||
18 | +//登录结果回调 | ||
19 | +-(void) onGameLogin :(LYResult*)result; | ||
20 | + | ||
21 | +//登出结果回调 | ||
22 | +-(void) onGameLogout:(LYResult*)result; | ||
23 | + | ||
24 | +//服务器初始化回调 | ||
25 | +-(void) onGameServerInit:(LYResult*)result; | ||
26 | + | ||
27 | +//用户状态失效回调 | ||
28 | +-(void) onUserStateInvalid; | ||
29 | + | ||
30 | +//用户支付回调 | ||
31 | +-(void) onGamePay:(LYResult*)result; | ||
32 | + | ||
33 | +@end | ||
34 | + |
1 | +// | ||
2 | +// LYGameProxy.h | ||
3 | +// LYDemoSDK | ||
4 | +// | ||
5 | +// Created by LG on 16/8/23. | ||
6 | +// Copyright (c) 2016年 LG. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | +#import <UIKit/UIKit.h> | ||
11 | +#import "LYGameDelegate.h" | ||
12 | + | ||
13 | +@class LYUser; | ||
14 | +@class LYGameConfig; | ||
15 | + | ||
16 | + | ||
17 | +@interface LYGameProxy : NSObject | ||
18 | +@property (nonatomic, retain) id<LYGameDelegate> platformDelegate; | ||
19 | + | ||
20 | ++ (LYGameProxy*) instance; | ||
21 | + | ||
22 | +/** | ||
23 | + * 平台初始化方法(初始化为异步操作,请在收到初始化通知后继续后续操作) | ||
24 | + * @param config 游戏参数配置项 | ||
25 | + */ | ||
26 | +-(void) initWithConfig:(LYGameConfig*)config; | ||
27 | + | ||
28 | + | ||
29 | +/** | ||
30 | + @brief 登录平台,进入登录或者注册界面入口 | ||
31 | + @param para 预留参数,默认为nil | ||
32 | + @note 异步接口,需实现LYGameDelegate的onLogin接口处理用户登录结果 | ||
33 | + */ | ||
34 | +-(void) login:(NSDictionary*)para; | ||
35 | + | ||
36 | + | ||
37 | +/** | ||
38 | + @brief 注销 | ||
39 | + @param para 预留参数,默认为nil | ||
40 | + */ | ||
41 | +- (void)logout:(NSDictionary*)para; | ||
42 | + | ||
43 | +/** | ||
44 | + @brief 进入用户中心 | ||
45 | + */ | ||
46 | +-(void) enterUserCenter; | ||
47 | + | ||
48 | +/** | ||
49 | + @brief 显示悬浮窗 | ||
50 | + */ | ||
51 | +-(void) showTouch; | ||
52 | + | ||
53 | +/** | ||
54 | + @brief 隐藏悬浮窗 | ||
55 | + */ | ||
56 | +-(void) hideTouch; | ||
57 | + | ||
58 | +/** | ||
59 | + * 初始化服务器 | ||
60 | + * @param serverId 游戏参数配置项 | ||
61 | + * @param uid 平台返回的UID | ||
62 | + * @note 异步接口,需实现LYGameDelegate的onServerInit接口处理服务器初始化结果 | ||
63 | + */ | ||
64 | +-(void) initServer:(NSString*) serverId UID:(NSString *)uid; | ||
65 | + | ||
66 | +/** | ||
67 | + * 定额消费接口,进行购买虚拟货币或者指定物品(需登录并成功初始化服务器才可进行消费操作) | ||
68 | + * | ||
69 | + * @param itemName 购买物品名称 | ||
70 | + * @param itemId 购买物品Id | ||
71 | + * @param amount 购买物品总金额,单位:分 | ||
72 | + * @param callBackInfo 透传信息 | ||
73 | + * @param callBackUrl 回调地址 | ||
74 | + * @param detail 商品详情信息 | ||
75 | + * @note 异步接口,需实现LYGameDelegate接口处理消费结果 | ||
76 | + */ | ||
77 | +-(void)payPlatform:(NSString*)itemName itemId:(NSString*)itemId amount:(int)amount callBackInfo:(NSString*)callBackInfo orderDetail:(NSString *)detail; | ||
78 | + | ||
79 | +- (void) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; | ||
80 | +- (void) applicationDidEnterBackground:(UIApplication *)application; | ||
81 | +- (void) applicationWillEnterForeground:(UIApplication *)application; | ||
82 | +- (void) applicationWillTerminate:(UIApplication *)application; | ||
83 | +- (void) applicationDidReceiveMemoryWarning:(UIApplication *)application; | ||
84 | +- (BOOL) application:(UIApplication *)application handleOpenURL:(NSURL *)url; | ||
85 | +- (BOOL) application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation; | ||
86 | +- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options; | ||
87 | +- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window; | ||
88 | +- (LYUser*) getUserInfo; | ||
89 | +//设置rootView | ||
90 | +-(void)setRootView:(UIView *)view; | ||
91 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// SDK.h | ||
3 | +// SDK | ||
4 | +// | ||
5 | +// Created by LG on 16/8/24. | ||
6 | +// Copyright © 2016年 LG. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <UIKit/UIKit.h> | ||
10 | +#import "LYGameProxy.h" | ||
11 | +#import "LYGameConfig.h" | ||
12 | +#import "LYSDK.h" | ||
13 | +#import "LYHelperFunc.h" | ||
14 | +#import "LYGameDelegate.h" | ||
15 | +#import "LYResult.h" | ||
16 | +#import "LYDataJson.h" | ||
17 | +#import "LYResponseJson.h" | ||
18 | +#import "LYGameDefines.h" | ||
19 | +#import "LYResponse.h" | ||
20 | +#import "LYHud.h" | ||
21 | + | ||
22 | +//! Project version number for SDK. | ||
23 | +FOUNDATION_EXPORT double SDKVersionNumber; | ||
24 | + | ||
25 | +//! Project version string for SDK. | ||
26 | +FOUNDATION_EXPORT const unsigned char SDKVersionString[]; | ||
27 | + | ||
28 | +// In this header, you should import all the public headers of your framework using statements like #import <SDK/PublicHeader.h> | ||
29 | + | ||
30 | + |
1 | +// | ||
2 | +// LYHelperFunc.h | ||
3 | +// LYDemoSDK | ||
4 | +// | ||
5 | +// Created by LG on 16/8/19. | ||
6 | +// Copyright (c) 2016年 LG. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#define DEPRECATED(_version) __attribute__((deprecated)) | ||
10 | + | ||
11 | +#define MainScreenScale [[UIScreen mainScreen]scale] //屏幕分辨率 | ||
12 | + | ||
13 | +#define Application_Frame [[UIScreen mainScreen] applicationFrame] //除去状态栏的屏幕的frame | ||
14 | +#define APP_Frame_Height [[UIScreen mainScreen] applicationFrame].size.height //应用程序的屏幕高度 | ||
15 | +#define App_Frame_Width [[UIScreen mainScreen] applicationFrame].size.width //应用程序的屏幕宽度 | ||
16 | +/*** MainScreen Height Width */ | ||
17 | +#define Main_Screen_Height [[UIScreen mainScreen] bounds].size.height //主屏幕的高度 | ||
18 | +#define Main_Screen_Width [[UIScreen mainScreen] bounds].size.width //主屏幕的宽度 | ||
19 | + | ||
20 | +// View 坐标(x,y)和宽高(width,height) | ||
21 | +#define X(v) (v).frame.origin.x | ||
22 | +#define Y(v) (v).frame.origin.y | ||
23 | +#define WIDTH(v) (v).frame.size.width | ||
24 | +#define HEIGHT(v) (v).frame.size.height | ||
25 | + | ||
26 | +#define MinX(v) CGRectGetMinX((v).frame) // 获得控件屏幕的x坐标 | ||
27 | +#define MinY(v) CGRectGetMinY((v).frame) // 获得控件屏幕的Y坐标 | ||
28 | + | ||
29 | +#define MidX(v) CGRectGetMidX((v).frame) //横坐标加上到控件中点坐标 | ||
30 | +#define MidY(v) CGRectGetMidY((v).frame) //纵坐标加上到控件中点坐标 | ||
31 | + | ||
32 | +#define MaxX(v) CGRectGetMaxX((v).frame) //横坐标加上控件的宽度 | ||
33 | +#define MaxY(v) CGRectGetMaxY((v).frame) //纵坐标加上控件的高度 | ||
34 | + | ||
35 | +#define CONTRLOS_FRAME(x,y,width,height) CGRectMake(x,y,width,height) | ||
36 | + | ||
37 | + | ||
38 | +//颜色(RGB) | ||
39 | +#define RGB(r,g,b) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:1] | ||
40 | +#define RGBA(r,g,b,a) [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:(a)] | ||
41 | + | ||
42 | +//字体大小(常规/粗体) | ||
43 | +#define BOLD_SYSTEMFONT(FONTSIZE) [UIFont boldSystemFontOfSize:FONTSIZE] | ||
44 | +#define SYSTEMFONT(FONTSIZE) [UIFont systemFontOfSize:FONTSIZE] | ||
45 | +#define FONT(NAME,FONTSIZE) [UIFont fontWithName:(NAME) size:(FONTSIZE)] | ||
46 | + | ||
47 | +//当前版本 | ||
48 | +#define FSystenVersion ([[[UIDevice currentDevice] systemVersion] floatValue]) | ||
49 | +#define DSystenVersion ([[[UIDevice currentDevice] systemVersion] doubleValue]) | ||
50 | +#define SSystemVersion ([[UIDevice currentDevice] systemVersion]) | ||
51 | + | ||
52 | +//是否Retina屏 | ||
53 | +#define isRetina ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) :NO) | ||
54 | +//是否iPhone5 | ||
55 | +#define ISIPHONE [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone | ||
56 | +#define ISIPHONE5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO) | ||
57 | +//是否是iPad | ||
58 | +#define isPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) | ||
59 | + | ||
60 | + | ||
61 | +//PNG JPG 图片路径 | ||
62 | +#define PNGPATH(NAME) [[NSBundle mainBundle] pathForResource:[NSString stringWithUTF8String:NAME] ofType:@"png"] | ||
63 | +#define JPGPATH(NAME) [[NSBundle mainBundle] pathForResource:[NSString stringWithUTF8String:NAME] ofType:@"jpg"] | ||
64 | +#define PATH(NAME,EXT) [[NSBundle mainBundle] pathForResource:(NAME) ofType:(EXT)] | ||
65 | + | ||
66 | +//加载图片 | ||
67 | +#define PNGIMAGE(NAME) [LYUtils imagesNamedFromCustomBundle:NAME] | ||
68 | +#define JPGIMAGE(NAME) [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:(NAME) ofType:@"jpg"]] | ||
69 | +#define IMAGE(NAME,EXT) [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:(NAME) ofType:(EXT)]] | ||
70 | +#define IMAGENAMED(NAME) [UIImage imageNamed:NAME] | ||
71 | + | ||
72 | +//RGB颜色转换(16进制->10进制) | ||
73 | +#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0] | ||
74 | + | ||
75 | +//utf8字符串到c字符串转换 | ||
76 | +#ifndef utf8cstr | ||
77 | +#define utf8cstr(nsstr) (nsstr ? [nsstr cStringUsingEncoding:NSUTF8StringEncoding] : "") | ||
78 | +#endif | ||
79 | + | ||
80 | +//utf8字符串到NSString转换 | ||
81 | +#ifndef utf8nstr | ||
82 | +#define utf8nstr(utf8) (utf8 ? [NSString stringWithUTF8String:utf8] : [[NSString alloc] init]) | ||
83 | +#endif | ||
84 | + | ||
85 | +//NSData到NSString转换 | ||
86 | +#ifndef datanstr | ||
87 | +#define datanstr(data) (data ? [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]: nil) | ||
88 | +#endif | ||
89 | + | ||
90 | +// 单体模式实现 | ||
91 | +#define DELC_SINGLETON(classname) \ | ||
92 | ++(classname*)instance; | ||
93 | + | ||
94 | +#define IMPL_SINGLETON(classname) \ | ||
95 | +\ | ||
96 | +static classname *s_shared##classname = nil; \ | ||
97 | +\ | ||
98 | ++ (classname *) instance \ | ||
99 | +{ \ | ||
100 | +@synchronized(self) \ | ||
101 | +{ \ | ||
102 | +if (s_shared##classname == nil) \ | ||
103 | +{ \ | ||
104 | +s_shared##classname = [[self alloc] init]; \ | ||
105 | +} \ | ||
106 | +} \ | ||
107 | +\ | ||
108 | +return s_shared##classname; \ | ||
109 | +} \ | ||
110 | +\ | ||
111 | ++ (id)allocWithZone:(NSZone *)zone \ | ||
112 | +{ \ | ||
113 | +@synchronized(self) \ | ||
114 | +{ \ | ||
115 | +if (s_shared##classname == nil) \ | ||
116 | +{ \ | ||
117 | +s_shared##classname = [super allocWithZone:zone]; \ | ||
118 | +return s_shared##classname; \ | ||
119 | +} \ | ||
120 | +} \ | ||
121 | +\ | ||
122 | +return nil; \ | ||
123 | +} \ | ||
124 | +\ | ||
125 | +- (id)copyWithZone:(NSZone *)zone \ | ||
126 | +{ \ | ||
127 | +return self; \ | ||
128 | +} \ | ||
129 | + | ||
130 | +//防止framework Category扩展失效 | ||
131 | +#define MAKE_CATEGORIES_LOADABLE(UNIQUE_NAME) @interface FORCELOAD_##UNIQUE_NAME:NSObject @end @implementation FORCELOAD_##UNIQUE_NAME @end |
1 | +// | ||
2 | +// LYHud.h | ||
3 | +// LYDemoSDK | ||
4 | +// | ||
5 | +// Created by LG on 16/8/23. | ||
6 | +// Copyright (c) 2016年 LG. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | +#import <UIKit/UIKit.h> | ||
11 | + | ||
12 | +#define DEPRECATED(_version) __attribute__((deprecated)) | ||
13 | + | ||
14 | +@interface LYHud : NSObject | ||
15 | + | ||
16 | ++ (void) hide DEPRECATED(1.0.8); | ||
17 | ++ (void) hideHud DEPRECATED(1.0.8); | ||
18 | ++ (void) showHud DEPRECATED(1.0.8); | ||
19 | ++ (void) showHud:(NSString*)caption DEPRECATED(1.0.8); | ||
20 | + | ||
21 | ++ (void) hideToast DEPRECATED(1.0.8); | ||
22 | ++ (void) showToast:(NSString*)info DEPRECATED(1.0.8); | ||
23 | ++ (void) showToast:(NSString*)info time:(int)time DEPRECATED(1.0.8); | ||
24 | ++ (void) showToast:(NSString*)info time:(int)time touchHide:(BOOL)touchHide DEPRECATED(1.0.8); | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | ++ (void) hideWithView:(UIView*)view; | ||
29 | ++ (void) hideHudWithView:(UIView*)view; | ||
30 | ++ (void) showHudWithView:(UIView*)view; | ||
31 | ++ (void) showHudWithView:(UIView*)view info:(NSString*)info; | ||
32 | + | ||
33 | ++ (void) hideToastWithView:(UIView*)view; | ||
34 | ++ (void) showToastWithView:(UIView*)view info:(NSString*)info; | ||
35 | ++ (void) showToastWithView:(UIView*)view info:(NSString*)info time:(int)time; | ||
36 | ++ (void) showToastWithView:(UIView*)view info:(NSString*)info time:(int)time touchHide:(BOOL)touchHide; | ||
37 | +@end |
1 | +// | ||
2 | +// LYResponse.h | ||
3 | +// LYPlatform | ||
4 | +// | ||
5 | +// Created by wanghui on 14/11/29. | ||
6 | +// Copyright 2014 linnyou Inc.. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | + | ||
11 | +@interface LYResponse : NSObject | ||
12 | + | ||
13 | ++(LYResponse*) emptyResponse; | ||
14 | + | ||
15 | +@property (nonatomic, assign) int code; | ||
16 | +@property (nonatomic,readwrite,retain) id bodyData; | ||
17 | +-(NSString*) asString; | ||
18 | + | ||
19 | +@end |
1 | +// | ||
2 | +// LYResponseJson.h | ||
3 | +// LYPlatform | ||
4 | +// | ||
5 | +// Created by wanghui on 14/11/29. | ||
6 | +// Copyright 2014 linnyou Inc.. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | +#import "LYResponse.h" | ||
11 | + | ||
12 | +@interface LYResponseJson : LYResponse | ||
13 | + | ||
14 | + | ||
15 | ++(LYResponseJson*)withResponse:(LYResponse*)response; | ||
16 | + | ||
17 | +@end |
1 | +// | ||
2 | +// LYResult.h | ||
3 | +// LYDemoSDK | ||
4 | +// | ||
5 | +// Created by LG on 16/8/19. | ||
6 | +// Copyright (c) 2016年 LG. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <UIKit/UIKit.h> | ||
10 | + | ||
11 | +@interface LYResult : NSObject | ||
12 | + | ||
13 | +@property (nonatomic, assign) int code; | ||
14 | +@property (nonatomic, copy) NSString* msg; | ||
15 | +@property (nonatomic, copy) NSString* msgLocal; | ||
16 | +- (BOOL) isOK; | ||
17 | + | ||
18 | + | ||
19 | ++ (LYResult*) withEmpty; | ||
20 | ++ (LYResult*) withSucc; | ||
21 | ++ (LYResult*) withCode:(int)code; | ||
22 | ++ (LYResult*) withCodeMsg:(int)code msg:(NSString*)msg; | ||
23 | ++ (LYResult*) withCodeLang:(int)code lang:(NSString*)lang; | ||
24 | ++ (LYResult*) withMsgLang:(int)code msg:(NSString*)msg lang:(NSString*)lang; | ||
25 | +- (void) setWithCode:(int)code; | ||
26 | +- (void) setWithCodeMsg:(int)code msg:(NSString*)msg; | ||
27 | +- (void) setWithCodeLang:(int)code lang:(NSString*)lang; | ||
28 | +- (void) setWithCodeMsgLang:(int)code msg:(NSString*)msg lang:(NSString*)lang; | ||
29 | +- (NSString *) getDataMsg; | ||
30 | + | ||
31 | +@end |
1 | +// | ||
2 | +// LYSDK.h | ||
3 | +// LYDemoSDK | ||
4 | +// | ||
5 | +// Created by LG on 16/8/24. | ||
6 | +// Copyright (c) 2016年 LG. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | + | ||
11 | +#import "LYResult.h" | ||
12 | +#import "LYHelperFunc.h" | ||
13 | +#import "LYResponseJson.h" | ||
14 | +#import "LYDataJson.h" | ||
15 | + | ||
16 | +@interface LYSDK : NSObject | ||
17 | + | ||
18 | +DELC_SINGLETON(LYSDK); | ||
19 | + | ||
20 | + | ||
21 | +/// <summary> | ||
22 | +/// 更新In-APP Purchase商品信息,请在初始化平台信息后购买商品前调用该方法,更新商品信息以便内购可以顺利进行,该方法只需调用一次. | ||
23 | +/// </summary> | ||
24 | +/// <param name="productsId">商品信息列表</param> | ||
25 | +/// <returns>无返回</returns> | ||
26 | +-(void) updateProducts:(NSSet*)products_id_set; | ||
27 | + | ||
28 | +/// <summary> | ||
29 | +/// 初始化SDK信息配置。 | ||
30 | +/// <param name="location">区域</param> | ||
31 | +/// <param name="product_id">游戏产品 ID</param> | ||
32 | +/// <param name="debug">是否开启debug模式,发布产品时请设置为NO.</param> | ||
33 | +/// <returns>无返回</returns> | ||
34 | +- (BOOL)init:(NSString*)location | ||
35 | + product_id:(NSString*)producted_id | ||
36 | + debug:(BOOL)debug; | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + | ||
41 | +/// <summary> | ||
42 | +/// 异步模式注册 | ||
43 | +/// </summary> | ||
44 | +/// <param name="username">用户名</param> | ||
45 | +/// <param name="password">密码</param> | ||
46 | +/// <param name="handler">注册回调</param> | ||
47 | +/// <returns>无返回</returns> | ||
48 | +- (void) regist:(NSString*)username | ||
49 | + password:(NSString*)password | ||
50 | + complete:(void (^)(LYResult* result))handler; | ||
51 | + | ||
52 | + | ||
53 | + | ||
54 | +/// <summary> | ||
55 | +/// 异步模式初始化服务器 | ||
56 | +/// </summary> | ||
57 | +/// <param name="server_id">服务器id</param> | ||
58 | +/// <param name="handler">初始化服务器回调</param> | ||
59 | +/// <returns>无返回</returns> | ||
60 | +-(void)initServer:(void (^)(LYResult*))handler; | ||
61 | + | ||
62 | +//登录返回信息 | ||
63 | +-(void)getThirdPartyLoginMsg:(NSDictionary *)channelParameters complete:(void (^)(LYResult*))handler; | ||
64 | + | ||
65 | +//获得订单号 | ||
66 | +- (void) getOrderId:(NSString*)channelId | ||
67 | + channelParam:(NSString*)channelParam | ||
68 | + goodsId:(NSString*)goodsId | ||
69 | + amount:(NSString*)amount | ||
70 | + payExt:(NSString*)payExt | ||
71 | + complete:(void (^)(LYResult*,id))handler; | ||
72 | + | ||
73 | +- (void) changerPay:(void (^)(LYResult*,id))handler; | ||
74 | + | ||
75 | + | ||
76 | +- (void) getROrderId:(NSString*)orderId payChannel:(NSString *)payChannel selectPay:(NSString *)selectPay | ||
77 | + goodsName:(NSString *)goodsName | ||
78 | + amount:(NSString*)amount | ||
79 | + payExt:(NSString*)payExt; | ||
80 | +-(void)getWXorder:(void (^)(LYResult*,id,id))handler; | ||
81 | +-(void)getWXorderResult:(NSString *)orderId payChannel:(NSString *)payChannel completion:(void (^)(LYResult*,id))handler; | ||
82 | + | ||
83 | +-(void) sendAuthCode:(NSString*)mobile type:(int)type complete:(void (^)(LYResult*))handler; | ||
84 | +-(void) bindPhoneGuest:(NSString*)mobile authCode:(NSString*)authCode uName:(NSString*)uname pwd:(NSString*)pwd vtoken:(NSString*)vtoken complete:(void (^)(LYDataJson*))handler; | ||
85 | +-(void) bindPhone:(NSString*)mobile authCode:(NSString*)authCode complete:(void (^)(LYDataJson*))handler; | ||
86 | +- (void)unBindPhone:(NSString*)mobile authCode:(NSString *)authCode uName:(NSString *)uname pwd:(NSString *)pwd vtoken:(NSString *)vtoken complete:(void (^)(LYDataJson *))handler; | ||
87 | + | ||
88 | +-(void) forgetResetPwd:(NSString*)mobile authCode:(NSString*)authCode newPwd:(NSString*)newPwd complete:(void (^)(LYResult*))handler; | ||
89 | +-(void) verVerCode:(NSString*)mobile authCode:(NSString*)authCode type:(int)type complete:(void (^)(LYResponseJson*))handler; | ||
90 | +-(void) reSetPwd:(NSString*)oldPwd newPwd:(NSString*)newPwd complete:(void (^)(LYResult*))handler; | ||
91 | + | ||
92 | +//手机解绑判断 | ||
93 | +- (void) removeMobilePhone; | ||
94 | + | ||
95 | +//发送激活日志 | ||
96 | +-(void) loginActive; | ||
97 | +//新接口token获取用户信息 | ||
98 | +- (void) getAccountEncrypted:(NSString*)token complete:(void (^)(LYResult*))handler; | ||
99 | + | ||
100 | +//新接口登录(麟游接口) | ||
101 | +- (void) linnyouLogin:(NSString*)username password:(NSString*)password complete:(void (^)(LYResult*))handler; | ||
102 | +//日志打印 | ||
103 | +-(void) logPrint:(NSString *)logType; | ||
104 | +//游客登录 | ||
105 | +-(void)linnyouVisitorGame:(void (^)(LYResult*))handler; | ||
106 | +//登出 | ||
107 | +-(void)logOut; | ||
108 | +//登录注册限制接口 | ||
109 | +-(void)getUserLimit:(void (^)(LYResult*))handler; | ||
110 | + | ||
111 | +-(void)setSign:(NSMutableDictionary *)parameters; | ||
112 | + | ||
113 | +//删除帐号到本地缓存 | ||
114 | +-(void) removeUserToKeyChain:(NSString *)userName; | ||
115 | + | ||
116 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
3 | +<plist version="1.0"> | ||
4 | +<dict> | ||
5 | + <key>files</key> | ||
6 | + <dict> | ||
7 | + <key>Headers/LYDataJson.h</key> | ||
8 | + <data> | ||
9 | + vQqGUn553kH38OCrsXZSBgfD2Co= | ||
10 | + </data> | ||
11 | + <key>Headers/LYGameConfig.h</key> | ||
12 | + <data> | ||
13 | + nrGkuEzWzw+NlKPKA1nxZ4XI8z4= | ||
14 | + </data> | ||
15 | + <key>Headers/LYGameDefines.h</key> | ||
16 | + <data> | ||
17 | + vRALYI4WjsH+N2o/20pO0pV3JXs= | ||
18 | + </data> | ||
19 | + <key>Headers/LYGameDelegate.h</key> | ||
20 | + <data> | ||
21 | + Gwz7QhJkd4fUWVSCcYMegN3uFRc= | ||
22 | + </data> | ||
23 | + <key>Headers/LYGameProxy.h</key> | ||
24 | + <data> | ||
25 | + FMrX6eQ02DoLgU2epS10Mb7ZEgo= | ||
26 | + </data> | ||
27 | + <key>Headers/LYGameSDK.h</key> | ||
28 | + <data> | ||
29 | + Xhf7MTzBW/O+dfpBpeM598R/v2s= | ||
30 | + </data> | ||
31 | + <key>Headers/LYHelperFunc.h</key> | ||
32 | + <data> | ||
33 | + aG3Z36QU/+jPRL0168b1CvgC0TY= | ||
34 | + </data> | ||
35 | + <key>Headers/LYHud.h</key> | ||
36 | + <data> | ||
37 | + 2vPnMqTqWHP2gWmEiDJI94G7Wtw= | ||
38 | + </data> | ||
39 | + <key>Headers/LYResponse.h</key> | ||
40 | + <data> | ||
41 | + xddkDIIeZG7oI0r/pk2RtXbX/vo= | ||
42 | + </data> | ||
43 | + <key>Headers/LYResponseJson.h</key> | ||
44 | + <data> | ||
45 | + 30ieTFZtFGRE0mZ0S2ik5+8VIOA= | ||
46 | + </data> | ||
47 | + <key>Headers/LYResult.h</key> | ||
48 | + <data> | ||
49 | + a4XY7RjCDjmQZMQQ8RKtokOP7r4= | ||
50 | + </data> | ||
51 | + <key>Headers/LYSDK.h</key> | ||
52 | + <data> | ||
53 | + yqhtc2Z+wtC53qSUXx68WjMCIas= | ||
54 | + </data> | ||
55 | + <key>Info.plist</key> | ||
56 | + <data> | ||
57 | + mjmV1AXD1g4bSaWLw2sZICfDbxs= | ||
58 | + </data> | ||
59 | + <key>Modules/module.modulemap</key> | ||
60 | + <data> | ||
61 | + orz5egU4e+hn03vI73dEWjzSz/Q= | ||
62 | + </data> | ||
63 | + </dict> | ||
64 | + <key>files2</key> | ||
65 | + <dict> | ||
66 | + <key>Headers/LYDataJson.h</key> | ||
67 | + <data> | ||
68 | + vQqGUn553kH38OCrsXZSBgfD2Co= | ||
69 | + </data> | ||
70 | + <key>Headers/LYGameConfig.h</key> | ||
71 | + <data> | ||
72 | + nrGkuEzWzw+NlKPKA1nxZ4XI8z4= | ||
73 | + </data> | ||
74 | + <key>Headers/LYGameDefines.h</key> | ||
75 | + <data> | ||
76 | + vRALYI4WjsH+N2o/20pO0pV3JXs= | ||
77 | + </data> | ||
78 | + <key>Headers/LYGameDelegate.h</key> | ||
79 | + <data> | ||
80 | + Gwz7QhJkd4fUWVSCcYMegN3uFRc= | ||
81 | + </data> | ||
82 | + <key>Headers/LYGameProxy.h</key> | ||
83 | + <data> | ||
84 | + FMrX6eQ02DoLgU2epS10Mb7ZEgo= | ||
85 | + </data> | ||
86 | + <key>Headers/LYGameSDK.h</key> | ||
87 | + <data> | ||
88 | + Xhf7MTzBW/O+dfpBpeM598R/v2s= | ||
89 | + </data> | ||
90 | + <key>Headers/LYHelperFunc.h</key> | ||
91 | + <data> | ||
92 | + aG3Z36QU/+jPRL0168b1CvgC0TY= | ||
93 | + </data> | ||
94 | + <key>Headers/LYHud.h</key> | ||
95 | + <data> | ||
96 | + 2vPnMqTqWHP2gWmEiDJI94G7Wtw= | ||
97 | + </data> | ||
98 | + <key>Headers/LYResponse.h</key> | ||
99 | + <data> | ||
100 | + xddkDIIeZG7oI0r/pk2RtXbX/vo= | ||
101 | + </data> | ||
102 | + <key>Headers/LYResponseJson.h</key> | ||
103 | + <data> | ||
104 | + 30ieTFZtFGRE0mZ0S2ik5+8VIOA= | ||
105 | + </data> | ||
106 | + <key>Headers/LYResult.h</key> | ||
107 | + <data> | ||
108 | + a4XY7RjCDjmQZMQQ8RKtokOP7r4= | ||
109 | + </data> | ||
110 | + <key>Headers/LYSDK.h</key> | ||
111 | + <data> | ||
112 | + yqhtc2Z+wtC53qSUXx68WjMCIas= | ||
113 | + </data> | ||
114 | + <key>Modules/module.modulemap</key> | ||
115 | + <data> | ||
116 | + orz5egU4e+hn03vI73dEWjzSz/Q= | ||
117 | + </data> | ||
118 | + </dict> | ||
119 | + <key>rules</key> | ||
120 | + <dict> | ||
121 | + <key>^</key> | ||
122 | + <true/> | ||
123 | + <key>^.*\.lproj/</key> | ||
124 | + <dict> | ||
125 | + <key>optional</key> | ||
126 | + <true/> | ||
127 | + <key>weight</key> | ||
128 | + <real>1000</real> | ||
129 | + </dict> | ||
130 | + <key>^.*\.lproj/locversion.plist$</key> | ||
131 | + <dict> | ||
132 | + <key>omit</key> | ||
133 | + <true/> | ||
134 | + <key>weight</key> | ||
135 | + <real>1100</real> | ||
136 | + </dict> | ||
137 | + <key>^version.plist$</key> | ||
138 | + <true/> | ||
139 | + </dict> | ||
140 | + <key>rules2</key> | ||
141 | + <dict> | ||
142 | + <key>.*\.dSYM($|/)</key> | ||
143 | + <dict> | ||
144 | + <key>weight</key> | ||
145 | + <real>11</real> | ||
146 | + </dict> | ||
147 | + <key>^</key> | ||
148 | + <dict> | ||
149 | + <key>weight</key> | ||
150 | + <real>20</real> | ||
151 | + </dict> | ||
152 | + <key>^(.*/)?\.DS_Store$</key> | ||
153 | + <dict> | ||
154 | + <key>omit</key> | ||
155 | + <true/> | ||
156 | + <key>weight</key> | ||
157 | + <real>2000</real> | ||
158 | + </dict> | ||
159 | + <key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key> | ||
160 | + <dict> | ||
161 | + <key>nested</key> | ||
162 | + <true/> | ||
163 | + <key>weight</key> | ||
164 | + <real>10</real> | ||
165 | + </dict> | ||
166 | + <key>^.*</key> | ||
167 | + <true/> | ||
168 | + <key>^.*\.lproj/</key> | ||
169 | + <dict> | ||
170 | + <key>optional</key> | ||
171 | + <true/> | ||
172 | + <key>weight</key> | ||
173 | + <real>1000</real> | ||
174 | + </dict> | ||
175 | + <key>^.*\.lproj/locversion.plist$</key> | ||
176 | + <dict> | ||
177 | + <key>omit</key> | ||
178 | + <true/> | ||
179 | + <key>weight</key> | ||
180 | + <real>1100</real> | ||
181 | + </dict> | ||
182 | + <key>^Info\.plist$</key> | ||
183 | + <dict> | ||
184 | + <key>omit</key> | ||
185 | + <true/> | ||
186 | + <key>weight</key> | ||
187 | + <real>20</real> | ||
188 | + </dict> | ||
189 | + <key>^PkgInfo$</key> | ||
190 | + <dict> | ||
191 | + <key>omit</key> | ||
192 | + <true/> | ||
193 | + <key>weight</key> | ||
194 | + <real>20</real> | ||
195 | + </dict> | ||
196 | + <key>^[^/]+$</key> | ||
197 | + <dict> | ||
198 | + <key>nested</key> | ||
199 | + <true/> | ||
200 | + <key>weight</key> | ||
201 | + <real>10</real> | ||
202 | + </dict> | ||
203 | + <key>^embedded\.provisionprofile$</key> | ||
204 | + <dict> | ||
205 | + <key>weight</key> | ||
206 | + <real>20</real> | ||
207 | + </dict> | ||
208 | + <key>^version\.plist$</key> | ||
209 | + <dict> | ||
210 | + <key>weight</key> | ||
211 | + <real>20</real> | ||
212 | + </dict> | ||
213 | + </dict> | ||
214 | +</dict> | ||
215 | +</plist> |
1 | +// | ||
2 | +// PoolSdk.h | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 11/23/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | +#import <PoolSdk/PoolSdk2.h> | ||
11 | +#import <UIKit/UIKit.h> | ||
12 | + | ||
13 | +@interface PoolSdk : NSObject | ||
14 | +/** | ||
15 | + * 当前SDK的版本 | ||
16 | + */ | ||
17 | +@property(nonatomic, strong, readonly)NSString *sdkVersion; | ||
18 | + | ||
19 | +/** | ||
20 | + * 用于设置url types schemes 默认为工程名 | ||
21 | + */ | ||
22 | +@property(nonatomic, strong)NSString *urlSchemes; | ||
23 | + | ||
24 | +/** | ||
25 | + 获取SDK实例对象 | ||
26 | + */ | ||
27 | ++ (PoolSdk *)shareSDK; | ||
28 | + | ||
29 | +/** | ||
30 | + 初始化SDK | ||
31 | + */ | ||
32 | +- (void)initSDK:(UIViewController *) control; | ||
33 | + | ||
34 | + | ||
35 | +-(void)viewDidAppear; | ||
36 | + | ||
37 | +/** | ||
38 | + 登录SDK | ||
39 | + */ | ||
40 | +- (void)loginSDK; | ||
41 | + | ||
42 | +/** | ||
43 | + 进行支付 | ||
44 | + */ | ||
45 | +- (void)payWithPaymentInfo:(PoolCreateOrderInfo *)payInfo; | ||
46 | + | ||
47 | +/** | ||
48 | + 用户中心 | ||
49 | + */ | ||
50 | +- (void)gotoUserCenter; | ||
51 | + | ||
52 | +/** | ||
53 | + report | ||
54 | + */ | ||
55 | +- (void)reportSDK:(PoolReportInfo *)reportInfo; | ||
56 | + | ||
57 | +/** | ||
58 | + 注销 | ||
59 | + */ | ||
60 | +- (void)logoutSDK; | ||
61 | + | ||
62 | +/** | ||
63 | + 退出 | ||
64 | + */ | ||
65 | +- (void)exitSDK; | ||
66 | + | ||
67 | + | ||
68 | + | ||
69 | +/** | ||
70 | + 显示/隐藏浮标 | ||
71 | + */ | ||
72 | +//- (void)showFloatIcon:(BOOL)bFlag; | ||
73 | + | ||
74 | + | ||
75 | +/** | ||
76 | + // called in - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url | ||
77 | + */ | ||
78 | +- (void)handleOpenurl:(NSURL *)url; | ||
79 | + | ||
80 | +- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window; | ||
81 | +/** | ||
82 | + 应用 appid | ||
83 | + */ | ||
84 | + | ||
85 | +/** | ||
86 | + 应用支持的方向 默认为 EDreamSDKOrientationLandscape | ||
87 | + */ | ||
88 | +@property(nonatomic, assign)ESDKOrientation sdkOrientation; | ||
89 | + | ||
90 | +/** | ||
91 | + 浮标是否已经显示,默认为NO | ||
92 | + */ | ||
93 | +@property(nonatomic, assign)BOOL bShowedFloat; | ||
94 | + | ||
95 | + | ||
96 | +/** | ||
97 | + serverId | ||
98 | + */ | ||
99 | +@property(nonatomic, assign)int serverId; | ||
100 | + | ||
101 | +/** | ||
102 | + 获取gamechannelid | ||
103 | + */ | ||
104 | +-(NSString *) getGameChannelId; | ||
105 | + | ||
106 | +/** | ||
107 | + 获取Custom | ||
108 | + */ | ||
109 | +- (NSString *) getCustomValue; | ||
110 | + | ||
111 | +/** | ||
112 | + 获取ChannelParameter1 | ||
113 | + */ | ||
114 | +- (NSString *) getChannelParameter1; | ||
115 | + | ||
116 | +/** | ||
117 | + 获取ChannelParameter2 | ||
118 | + */ | ||
119 | +- (NSString *) getChannelParameter2; | ||
120 | + | ||
121 | + | ||
122 | +@end |
1 | +// | ||
2 | +// PoolSdk.m | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 11/23/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import "PoolSdk.h" | ||
10 | +#import "SDKInterface.h" | ||
11 | + | ||
12 | +static PoolSdk *s_PoolSdkCerterInstance = nil; | ||
13 | +static id<UnionInterface> _interface = nil; | ||
14 | +@implementation PoolSdk : NSObject | ||
15 | + | ||
16 | +- (id)init | ||
17 | +{ | ||
18 | + if(self = [super init]) | ||
19 | + { | ||
20 | + _sdkVersion = [NSString stringWithFormat:@"%@ - %@",[[PoolConfig getInstance] gameSimpleName], [[PoolConfig getInstance] sdkSimpleName]]; | ||
21 | + _interface = [[SDKInterface alloc] init]; | ||
22 | + self.urlSchemes = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]; | ||
23 | + } | ||
24 | + return self; | ||
25 | +} | ||
26 | + | ||
27 | +- (void)initSDK :(UIViewController *) control | ||
28 | +{ | ||
29 | + if (![[NSUserDefaults standardUserDefaults] boolForKey:@"pool_everLaunched"]) { | ||
30 | + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"pool_everLaunched"]; | ||
31 | + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"pool_firstLaunch"]; | ||
32 | + } | ||
33 | + else{ | ||
34 | + [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"pool_firstLaunch"]; | ||
35 | + } | ||
36 | + | ||
37 | + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"firstLaunch"]) { | ||
38 | + | ||
39 | + } | ||
40 | + [_interface SDKinit:control]; | ||
41 | + | ||
42 | + [[PoolChecker getInstance] reportSDKOpen]; | ||
43 | + | ||
44 | + NSString* channelId = [[PoolConfig getInstance] getValueByKey:@"gamechannelid"]; | ||
45 | + [TrackingIO initWithappKey:[[PoolConfig getInstance] getValueByKey:@"renyunAppKey"] withChannelId:channelId]; | ||
46 | +} | ||
47 | + | ||
48 | +/** | ||
49 | + 获取SDK实例对象 | ||
50 | + */ | ||
51 | ++ (PoolSdk *)shareSDK | ||
52 | +{ | ||
53 | + static dispatch_once_t dgonceToken; | ||
54 | + dispatch_once(&dgonceToken, ^{ | ||
55 | + s_PoolSdkCerterInstance = [[PoolSdk alloc] init]; | ||
56 | + s_PoolSdkCerterInstance.sdkOrientation = ESDKOrientationLandscape; | ||
57 | + s_PoolSdkCerterInstance.bShowedFloat = NO; | ||
58 | + }); | ||
59 | + | ||
60 | + return s_PoolSdkCerterInstance; | ||
61 | +} | ||
62 | + | ||
63 | +-(void)viewDidAppear{ | ||
64 | + [_interface viewDidAppear]; | ||
65 | +} | ||
66 | + | ||
67 | +- (void)loginSDK | ||
68 | +{ | ||
69 | + [[PoolChecker getInstance] reportOpen]; | ||
70 | + [_interface SDKloginSDK]; | ||
71 | +} | ||
72 | + | ||
73 | +- (void)payWithPaymentInfo:(PoolCreateOrderInfo *)payInfo | ||
74 | +{ | ||
75 | + [_interface SDKpayWithPaymentInfo:payInfo]; | ||
76 | +} | ||
77 | + | ||
78 | +- (void)reportSDK:(PoolReportInfo *)reportInfo | ||
79 | +{ | ||
80 | + NSString *reportT = [reportInfo reportType]; | ||
81 | + reportInfo.openId = [[PoolChecker getInstance] userId]; | ||
82 | + if ([reportT isEqualToString:REPORT_ENTER]) { | ||
83 | + [[PoolChecker getInstance] reportEnter:reportInfo]; | ||
84 | + NSLog(@"reportSDK enter"); | ||
85 | + [TrackingIO setLoginWithAccountID:[reportInfo playerId]]; | ||
86 | + }else if ([reportT isEqualToString:REPORT_ROLEUPGRADE]){ | ||
87 | + | ||
88 | + }else if ([reportT isEqualToString:REPORT_CREATEROLE]){ | ||
89 | + NSLog(@"reportSDK createRole"); | ||
90 | + [TrackingIO setRegisterWithAccountID:[reportInfo playerId]]; | ||
91 | + } | ||
92 | +// [[PoolChecker getInstance] reportOpen]; | ||
93 | + [_interface SDKreport:reportInfo]; | ||
94 | + | ||
95 | +} | ||
96 | + | ||
97 | +- (void)gotoUserCenter | ||
98 | +{ | ||
99 | + [_interface SDKgotoUserCenter]; | ||
100 | +} | ||
101 | + | ||
102 | +- (void)logoutSDK | ||
103 | +{ | ||
104 | + [_interface SDKlogoutSDK]; | ||
105 | +} | ||
106 | + | ||
107 | +- (void)exitSDK | ||
108 | +{ | ||
109 | + [_interface SDKexitSDK]; | ||
110 | +} | ||
111 | + | ||
112 | +- (void)handleOpenurl:(NSURL *)url | ||
113 | +{ | ||
114 | + NSLog(@"handleOpenurl%@",url); | ||
115 | + if([[url host] isEqualToString:@"c_code"]){ | ||
116 | + NSString* path = url.path; | ||
117 | + NSString* codeValue = [path substringFromIndex:1]; | ||
118 | + [[PoolChecker getInstance] handleFirstOpenApp:codeValue]; | ||
119 | + } | ||
120 | + [_interface handleOpenurl:url]; | ||
121 | +} | ||
122 | + | ||
123 | +- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window | ||
124 | +{ | ||
125 | + return [_interface application:application supportedInterfaceOrientationsForWindow:window]; | ||
126 | +} | ||
127 | + | ||
128 | +- (NSString *)getGameChannelId{ | ||
129 | + return [[PoolConfig getInstance]getValueByKey:@"gamechannelid"]; | ||
130 | +} | ||
131 | + | ||
132 | +- (NSString *)getCustomValue{ | ||
133 | + return [[PoolConfig getInstance]getValueByKey:@"custom"]; | ||
134 | +} | ||
135 | + | ||
136 | +- (NSString *)getChannelParameter1{ | ||
137 | + return [[PoolConfig getInstance]getValueByKey:@"c1"]; | ||
138 | +} | ||
139 | + | ||
140 | +- (NSString *)getChannelParameter2{ | ||
141 | + return [[PoolConfig getInstance]getValueByKey:@"c2"]; | ||
142 | +} | ||
143 | + | ||
144 | +@end |
1 | + | ||
2 | +// | ||
3 | +// PPInterface.h | ||
4 | +// PoolSdk | ||
5 | +// | ||
6 | +// Created by winFan on 11/23/15. | ||
7 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
8 | +// | ||
9 | + | ||
10 | +#import <PoolSdk/PoolSdk2.h> | ||
11 | +#import <LYGameSDK/LYGameSDK.h> | ||
12 | + | ||
13 | +@interface SDKInterface : Interface<LYGameDelegate,PoolSdkDelegate> | ||
14 | + | ||
15 | + | ||
16 | +@end |
1 | +// | ||
2 | +// UnionInterface.m | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 11/23/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | +#include "SDKInterface.h" | ||
9 | +#import <UIKit/UIKit.h> | ||
10 | + | ||
11 | +@interface SDKInterface() | ||
12 | +{ | ||
13 | + LYGameConfig *_config; | ||
14 | + NSString *uid; | ||
15 | +} | ||
16 | +@end | ||
17 | + | ||
18 | + | ||
19 | +@implementation SDKInterface : Interface | ||
20 | + | ||
21 | + | ||
22 | +int mExchange; | ||
23 | + | ||
24 | +/** | ||
25 | + 初始化SDK | ||
26 | +*/ | ||
27 | +- (void)SDKinit:(UIViewController *) control | ||
28 | +{ | ||
29 | + //必须继承 | ||
30 | + [super SDKinit:control]; | ||
31 | + | ||
32 | + [PoolConfig getInstance]; | ||
33 | + NSLog(@"sdk chushihua"); | ||
34 | + | ||
35 | + [LYGameProxy instance].platformDelegate = self; | ||
36 | + _config = [[LYGameConfig alloc]init];; | ||
37 | + | ||
38 | + NSString* productId = [[PoolConfig getInstance]getValueByKey:@"productId"]; | ||
39 | + NSString* signKey = [[PoolConfig getInstance] getValueByKey:@"signKey"]; | ||
40 | + | ||
41 | + [_config setProductId:productId]; | ||
42 | + [_config setLinnyouKey:signKey]; | ||
43 | + [_config setDebugState:TRUE]; | ||
44 | + [[LYGameProxy instance] initWithConfig:_config]; | ||
45 | + | ||
46 | + NSString* appleProductIdsStr = [[PoolConfig getInstance]getValueByKey:@"apple_productids"]; | ||
47 | + | ||
48 | + NSSet* appleProductSet = [[NSSet alloc]initWithArray:[appleProductIdsStr componentsSeparatedByString:@","]]; | ||
49 | + | ||
50 | + [[LYSDK instance]updateProducts:appleProductSet]; | ||
51 | +} | ||
52 | + | ||
53 | +/** | ||
54 | + 登录SDK | ||
55 | + */ | ||
56 | +- (void)SDKloginSDK | ||
57 | +{ | ||
58 | + NSLog(@"调用了LoginSDK"); | ||
59 | + [[PoolChecker getInstance]setPoolSdkDelegate:self]; | ||
60 | + [[LYGameProxy instance]login:nil]; | ||
61 | +} | ||
62 | + | ||
63 | +/** | ||
64 | + 支付 创建订单 | ||
65 | + */ | ||
66 | +- (void)SDKpayWithPaymentInfo:(PoolCreateOrderInfo *)payInfo | ||
67 | +{ | ||
68 | + mExchange = [payInfo exchange].intValue; | ||
69 | + [super SDKpayWithPaymentInfo:payInfo]; | ||
70 | +} | ||
71 | + | ||
72 | +/** | ||
73 | + SDK | ||
74 | + */ | ||
75 | +- (void)SDKgotoUserCenter | ||
76 | +{ | ||
77 | + [[LYGameProxy instance] enterUserCenter]; | ||
78 | +} | ||
79 | + | ||
80 | +- (void)SDKreport:(PoolReportInfo *)reportInfo | ||
81 | +{ | ||
82 | + NSLog(@"reportInfo"); | ||
83 | + if ([REPORT_CREATEROLE isEqualToString:[reportInfo reportType]]) { | ||
84 | + | ||
85 | + }else if ([[reportInfo reportType] isEqualToString:REPORT_ENTER]) { | ||
86 | + [[LYGameProxy instance] initServer:reportInfo.serverId UID:uid]; | ||
87 | + } | ||
88 | +} | ||
89 | + | ||
90 | + | ||
91 | +/** | ||
92 | + SDK | ||
93 | + */ | ||
94 | +- (void)SDKexitSDK | ||
95 | +{ | ||
96 | + [[LYGameProxy instance]hideTouch]; | ||
97 | +} | ||
98 | + | ||
99 | +- (void)SDKlogoutSDK | ||
100 | +{ | ||
101 | + NSLog(@"切换账号"); | ||
102 | + [[LYGameProxy instance]logout:nil]; | ||
103 | +} | ||
104 | + | ||
105 | +- (void)handleOpenurl:(NSURL *)url | ||
106 | +{ | ||
107 | +} | ||
108 | + | ||
109 | +- (void)receivePayMessage : (NSNotification *)notification; | ||
110 | +{ | ||
111 | + NSString *order_id = [notification object]; | ||
112 | + NSLog(@"订单ID:%@", order_id); | ||
113 | +} | ||
114 | + | ||
115 | + | ||
116 | + | ||
117 | +/** | ||
118 | + @return 商品ID | ||
119 | + */ | ||
120 | +- (NSSet*)getProductIdSet:(NSString*)products | ||
121 | +{ | ||
122 | + NSData* jsonData = [NSJSONSerialization dataWithJSONObject:products options:NSJSONWritingPrettyPrinted error:nil]; | ||
123 | + if(jsonData){ | ||
124 | + NSDictionary* productList = [NSJSONSerialization JSONObjectWithData:jsonData options:kNilOptions error:nil]; | ||
125 | + if(productList){ | ||
126 | + NSEnumerator* keysList = [productList keyEnumerator]; | ||
127 | + return [[NSSet alloc]initWithArray:[keysList allObjects]]; | ||
128 | + } | ||
129 | + } | ||
130 | + return nil; | ||
131 | +} | ||
132 | + | ||
133 | +/** | ||
134 | + @return 商品ID | ||
135 | + */ | ||
136 | +- (NSString*)getProductIdByAmount:(NSString*)products amount:(NSString*)amount | ||
137 | +{ | ||
138 | + NSData* jsonData = [NSJSONSerialization dataWithJSONObject:products options:NSJSONWritingPrettyPrinted error:nil]; | ||
139 | + if(jsonData){ | ||
140 | + NSDictionary* productList = [NSJSONSerialization JSONObjectWithData:jsonData options:kNilOptions error:nil]; | ||
141 | + if(productList){ | ||
142 | + NSEnumerator* keysList = [productList keyEnumerator]; | ||
143 | + id keyValue; | ||
144 | + while (keyValue = [keysList nextObject]) | ||
145 | + { | ||
146 | + NSLog(@"i found %@",keyValue); | ||
147 | + NSString* appleAmount = [[productList objectForKey:keyValue] objectForKey:@"amount"]; | ||
148 | + NSLog(@"appleAmount:%@ amount:%@",appleAmount,amount); | ||
149 | + if(appleAmount.intValue == amount.intValue){ | ||
150 | + return keyValue; | ||
151 | + } | ||
152 | + } | ||
153 | + } | ||
154 | + } | ||
155 | + return @"unknow"; | ||
156 | +} | ||
157 | + | ||
158 | +/** | ||
159 | + @return 商品名称 | ||
160 | + */ | ||
161 | +- (NSString*)getProductNameByAmount:(NSString*)products amount:(NSString*)amount | ||
162 | +{ | ||
163 | + NSData* jsonData = [NSJSONSerialization dataWithJSONObject:products options:NSJSONWritingPrettyPrinted error:nil]; | ||
164 | + if(jsonData){ | ||
165 | + NSDictionary* productList = [NSJSONSerialization JSONObjectWithData:jsonData options:kNilOptions error:nil]; | ||
166 | + if(productList){ | ||
167 | + NSEnumerator* keysList = [productList keyEnumerator]; | ||
168 | + id keyValue; | ||
169 | + while (keyValue = [keysList nextObject]) | ||
170 | + { | ||
171 | + NSString* appleAmount = [[productList objectForKey:keyValue] objectForKey:@"amount"]; | ||
172 | + if(appleAmount.intValue == amount.intValue){ | ||
173 | + NSString* productName = [[productList objectForKey:keyValue] objectForKey:@"name"]; | ||
174 | + return productName; | ||
175 | + } | ||
176 | + } | ||
177 | + } | ||
178 | + } | ||
179 | + NSLog(@"get product name error amount:%@",amount); | ||
180 | + return @"元宝"; | ||
181 | +} | ||
182 | + | ||
183 | +- (void)receiveCreateOrder:(NSNotification *)notification | ||
184 | +{ | ||
185 | + NSLog(@"创建订单成功"); | ||
186 | + PoolPayInfo *payInfo = [notification object]; | ||
187 | + NSString* amount = [payInfo postAmount]; | ||
188 | + NSString* products = [payInfo products]; | ||
189 | + | ||
190 | + NSString* productName = [self getProductNameByAmount:products amount:amount]; | ||
191 | + NSString* productId = [self getProductIdByAmount:products amount:amount]; | ||
192 | + | ||
193 | + int amountInt = amount.intValue * 100; | ||
194 | + | ||
195 | + NSLog(@"productName:%@productId%@ amount:%d",productName,productId,amountInt); | ||
196 | + | ||
197 | + [[LYGameProxy instance]payPlatform:productName itemId:productId amount:amountInt callBackInfo:[payInfo queryId] orderDetail:[payInfo custom]]; | ||
198 | + | ||
199 | + int64_t delayInSeconds = 3.0;// 延迟的时间 | ||
200 | + dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); | ||
201 | + dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ | ||
202 | + NSLog(@"chage state"); | ||
203 | + [[PoolChecker getInstance] setOnlyOneTimePay:false]; | ||
204 | + }); | ||
205 | +} | ||
206 | + | ||
207 | + | ||
208 | +-(NSString*)getCurrentTimestamp{ | ||
209 | + // 时间戳转时间 | ||
210 | + NSTimeInterval interval = [[NSDate date] timeIntervalSince1970] * 1000; | ||
211 | + NSString* timeStr = [[NSString alloc]initWithFormat:@"%.f",interval]; | ||
212 | + return timeStr; | ||
213 | +} | ||
214 | + | ||
215 | + | ||
216 | + | ||
217 | +//平台初始化成功 | ||
218 | +-(void) onGameInitFinished:(LYResult*)result | ||
219 | +{ | ||
220 | + if(result.isOK){ | ||
221 | + [[PoolChecker getInstance] sendNotice:PoolSDKNotificationInitSDK notiName:@"InitSuccess" statusCode:POOLSDK_NO_ERROR description:@"initSuccess" extendData:nil]; | ||
222 | + }else{ | ||
223 | + [[PoolChecker getInstance] sendNotice:PoolSDKNotificationInitSDK notiName:@"InitFail" statusCode:POOLSDK_ERROR_INIT_FAILED description:result.msgLocal extendData:nil]; | ||
224 | + } | ||
225 | +} | ||
226 | + | ||
227 | +- (NSString*)encodeStr:(NSString *)string | ||
228 | +{ | ||
229 | +// NSCharacterSet *allowedCharacters = [[NSCharacterSet characterSetWithCharactersInString:string] invertedSet]; | ||
230 | +// NSString *encodedStr = [string stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacters]; | ||
231 | +// | ||
232 | + NSString* encodedStr = [string stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; | ||
233 | + return encodedStr; | ||
234 | +} | ||
235 | + | ||
236 | +//登录结果回调 | ||
237 | +-(void) onGameLogin :(LYResult*)result | ||
238 | +{ | ||
239 | + if(result.isOK){ | ||
240 | + PoolLoginInfo *loginInfo = [PoolLoginInfo alloc]; | ||
241 | + | ||
242 | + NSString* sdkData = [[result msg] stringByReplacingOccurrencesOfString:@"\\" withString:@"\\\\"]; | ||
243 | + sdkData = [sdkData stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""]; | ||
244 | + | ||
245 | + loginInfo.other = sdkData; | ||
246 | + loginInfo.timestamp = [self getCurrentTimestamp]; | ||
247 | + dispatch_async(dispatch_get_global_queue(0, 0), ^{ | ||
248 | + [[PoolChecker getInstance] startCheckDelegate:loginInfo]; | ||
249 | + }); | ||
250 | + [[LYGameProxy instance]showTouch]; | ||
251 | + | ||
252 | + }else{ | ||
253 | + [[PoolChecker getInstance] sendNotice:PoolSDKNotificationLogin notiName:@"loginFail" statusCode:POOLSDK_ERROR_LOGIN_FAILED description:result.msgLocal extendData:nil]; | ||
254 | + } | ||
255 | +} | ||
256 | + | ||
257 | +//登出结果回调 | ||
258 | +-(void) onGameLogout:(LYResult*)result | ||
259 | +{ | ||
260 | + if (result.isOK) { | ||
261 | + [[PoolChecker getInstance] sendNotice:PoolSDKNotificationLogout notiName:@"LogoutSuccess" statusCode:POOLSDK_NO_ERROR description:@"LogoutSuccess" extendData:nil]; | ||
262 | + } | ||
263 | + [[LYGameProxy instance]hideTouch]; | ||
264 | +} | ||
265 | + | ||
266 | +//服务器初始化回调 | ||
267 | +-(void) onGameServerInit:(LYResult*)result | ||
268 | +{ | ||
269 | +} | ||
270 | + | ||
271 | +//用户状态失效回调 | ||
272 | +-(void) onUserStateInvalid | ||
273 | +{ | ||
274 | +} | ||
275 | + | ||
276 | +//用户支付回调 | ||
277 | +-(void) onGamePay:(LYResult*)result | ||
278 | +{ | ||
279 | +} | ||
280 | + | ||
281 | +-(void)PoolSdkLoginSuccess:(PoolLoginInfo *)loginInfo | ||
282 | +{ | ||
283 | + NSLog(@"login success %@",loginInfo); | ||
284 | + uid = loginInfo.openId; | ||
285 | + [[PoolChecker getInstance] sendNotice:PoolSDKNotificationLogin notiName:@"LoginSuccess" statusCode:POOLSDK_NO_ERROR description:@"LoginSucecess" extendData:loginInfo]; | ||
286 | +} | ||
287 | + | ||
288 | +- (void)PoolSdkLoginFail:(NSString *)msg | ||
289 | +{ | ||
290 | + NSLog(@"login fail %@",msg); | ||
291 | + [[PoolChecker getInstance] sendNotice:PoolSDKNotificationLogin notiName:@"loginFail" statusCode:POOLSDK_ERROR_LOGIN_FAILED description:msg extendData:nil]; | ||
292 | +} | ||
293 | + | ||
294 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +{"payorderurl": "https://public.sdk.gzyouai.com/paycheck/create", "usertype": 169, "sdkSimpleName": "linyou_ios", "gamechannelid": "710009", "custom": "{}", "sdkVersionCode": "V1_5_3", "signKey": "f303da3a2c3abb83", "loginCheckUrl": "https://public.sdk.gzyouai.com/logincheck/check", "appScheme": "com.jian.wuji", "c2": "", "c1": "ly1", "productId": "jwjios", "apple_productids": "com.qyj.ios.xw.6,com.qyj.ios.18,com.qyj.ios.xw.30,com.qyj.ios.xw.68,com.qyj.ios.xw.128,com.qyj.ios.xw.198,com.qyj.ios.xw.328,com.qyj.ios.xw.648", "paycheckurl": "https://public.sdk.gzyouai.com/paycheck/confirm", "gameSimpleName": "qyjios2"} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
3 | +<plist version="1.0"> | ||
4 | +<dict> | ||
5 | + <key>LSApplicationQueriesSchemes</key> | ||
6 | + <array> | ||
7 | + <string>weixin</string> | ||
8 | + <string>alipay</string> | ||
9 | + </array> | ||
10 | + <key>NSAppTransportSecurity</key> | ||
11 | + <dict> | ||
12 | + <key>NSAllowsArbitraryLoads</key> | ||
13 | + <true/> | ||
14 | + </dict> | ||
15 | + | ||
16 | + <key>CFBundleURLTypes</key> | ||
17 | + <array> | ||
18 | + <dict> | ||
19 | + <key>CFBundleTypeRole</key> | ||
20 | + <string>Viewer</string> | ||
21 | + <key>CFBundleURLName</key> | ||
22 | + <string>com.reyun.track</string> | ||
23 | + <key>CFBundleURLSchemes</key> | ||
24 | + <array> | ||
25 | + <string>devTrack</string> | ||
26 | + </array> | ||
27 | + </dict> | ||
28 | + </array> | ||
29 | +</dict> | ||
30 | +</plist> |
1 | +// | ||
2 | +// KCManager.h | ||
3 | +// KCFramework | ||
4 | +// | ||
5 | +// Created by huangsite on 16/9/7. | ||
6 | +// Copyright © 2016年 kc. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | + | ||
11 | +@interface KCManager : NSObject | ||
12 | + | ||
13 | ++ (KCManager *)sharedInstance; | ||
14 | + | ||
15 | +- (void)KCInit; | ||
16 | + | ||
17 | +- (void)kCLogin; | ||
18 | + | ||
19 | +- (void)KCLoginout; | ||
20 | + | ||
21 | +/* | ||
22 | + 此接口请在 创角 进入游戏 升级 三种情况下调用 | ||
23 | + serverid 区服ID | ||
24 | + servername 区服名称 | ||
25 | + roleid 角色ID | ||
26 | + rolename 角色名 | ||
27 | + rolelevel 角色等级 | ||
28 | + */ | ||
29 | +- (void)KCRolemeberWithServerid:(NSString *)serverid | ||
30 | + andServername:(NSString *)servername | ||
31 | + andRoleid:(NSString *)roleid | ||
32 | + andRolename:(NSString *)rolename | ||
33 | + andRolelevel:(NSString *)rolelevel; | ||
34 | + | ||
35 | +/* | ||
36 | + bill 订单号 | ||
37 | + amount 订单金额(单位:元) | ||
38 | + flag 商品标识 | ||
39 | + serverid 服务器标识 | ||
40 | + rolename 角色名 | ||
41 | + rolelevel 角色等级 | ||
42 | + roleid 角色id | ||
43 | + subject 商品描述 | ||
44 | + extrainfo 额外信息 | ||
45 | +*/ | ||
46 | +- (void)KCPayWithBill:(NSString *)bill | ||
47 | + andProductid:(NSString *)flag | ||
48 | + andAmount:(NSString *)amount | ||
49 | + andServerid:(NSString *)serverid | ||
50 | + andRolename:(NSString *)rolename | ||
51 | + andRolelevel:(NSString *)rolelevel | ||
52 | + andRoleid:(NSString *)roleid | ||
53 | + andSubject:(NSString *)subject | ||
54 | + andExt:(NSString *)extrainfo; | ||
55 | + | ||
56 | +@end |

6.25 KB

19 KB

19.8 KB

17.4 KB

2.46 KB

2.61 KB

2.49 KB

2.46 KB

1.14 KB

1.16 KB

1.26 KB

1.46 KB

1.52 KB

1.56 KB

1.49 KB

1.59 KB

1.61 KB

1.63 KB

1.74 KB

1.59 KB

8.4 KB
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
3 | +<plist version="1.0"> | ||
4 | +<dict> | ||
5 | + <key>ver</key> | ||
6 | + <string>appstore100039</string> | ||
7 | + <key>appkey</key> | ||
8 | + <string>2f5d0ad8a8c48db20e86511fa5c7050c</string> | ||
9 | + <key>appid</key> | ||
10 | + <string>100039</string> | ||
11 | +</dict> | ||
12 | +</plist> |

4.65 KB

1.58 KB

938 Bytes

1.62 KB

7.68 KB

23.1 KB

9.42 KB

8.45 KB

2.13 KB

2.18 KB

2.83 KB

3.79 KB

3.76 KB

2.94 KB

2.01 KB

1.85 KB

2.73 KB

2.89 KB

5.28 KB

3.15 KB

5.3 KB

5.21 KB

5.31 KB

1.57 KB

3.94 KB

4.25 KB

8.89 KB

5.58 KB

3.04 KB

3.42 KB

3.63 KB

7.03 KB

22.5 KB

7.06 KB

1.52 KB

1.56 KB

1.48 KB

1.1 KB

3.1 KB

3.73 KB

4.08 KB

2.51 KB

8.17 KB

3.61 KB

9.62 KB

9.8 KB

4.46 KB

8.65 KB

8.81 KB

3.76 KB

3.93 KB

1.6 KB

1.72 KB

1.87 KB

3.36 KB

3.42 KB

2.47 KB

4.23 KB

2.22 KB

3.36 KB

8.01 KB
1 | +// | ||
2 | +// PoolSdk.h | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 11/23/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | +#import <PoolSdk/PoolSdk2.h> | ||
11 | +#import <UIKit/UIKit.h> | ||
12 | + | ||
13 | +@interface PoolSdk : NSObject | ||
14 | +/** | ||
15 | + * 当前SDK的版本 | ||
16 | + */ | ||
17 | +@property(nonatomic, strong, readonly)NSString *sdkVersion; | ||
18 | + | ||
19 | +/** | ||
20 | + * 用于设置url types schemes 默认为工程名 | ||
21 | + */ | ||
22 | +@property(nonatomic, strong)NSString *urlSchemes; | ||
23 | + | ||
24 | +/** | ||
25 | + 获取SDK实例对象 | ||
26 | + */ | ||
27 | ++ (PoolSdk *)shareSDK; | ||
28 | + | ||
29 | +/** | ||
30 | + 初始化SDK | ||
31 | + */ | ||
32 | +- (void)initSDK:(UIViewController *) control; | ||
33 | + | ||
34 | + | ||
35 | +-(void)viewDidAppear; | ||
36 | + | ||
37 | +/** | ||
38 | + 登录SDK | ||
39 | + */ | ||
40 | +- (void)loginSDK; | ||
41 | + | ||
42 | +/** | ||
43 | + 进行支付 | ||
44 | + */ | ||
45 | +- (void)payWithPaymentInfo:(PoolCreateOrderInfo *)payInfo; | ||
46 | + | ||
47 | +/** | ||
48 | + 用户中心 | ||
49 | + */ | ||
50 | +- (void)gotoUserCenter; | ||
51 | + | ||
52 | +/** | ||
53 | + report | ||
54 | + */ | ||
55 | +- (void)reportSDK:(PoolReportInfo *)reportInfo; | ||
56 | + | ||
57 | +/** | ||
58 | + 注销 | ||
59 | + */ | ||
60 | +- (void)logoutSDK; | ||
61 | + | ||
62 | +/** | ||
63 | + 退出 | ||
64 | + */ | ||
65 | +- (void)exitSDK; | ||
66 | + | ||
67 | + | ||
68 | + | ||
69 | +/** | ||
70 | + 显示/隐藏浮标 | ||
71 | + */ | ||
72 | +//- (void)showFloatIcon:(BOOL)bFlag; | ||
73 | + | ||
74 | + | ||
75 | +/** | ||
76 | + // called in - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url | ||
77 | + */ | ||
78 | +- (void)handleOpenurl:(NSURL *)url; | ||
79 | + | ||
80 | +- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window; | ||
81 | +/** | ||
82 | + 应用 appid | ||
83 | + */ | ||
84 | + | ||
85 | +/** | ||
86 | + 应用支持的方向 默认为 EDreamSDKOrientationLandscape | ||
87 | + */ | ||
88 | +@property(nonatomic, assign)ESDKOrientation sdkOrientation; | ||
89 | + | ||
90 | +/** | ||
91 | + 浮标是否已经显示,默认为NO | ||
92 | + */ | ||
93 | +@property(nonatomic, assign)BOOL bShowedFloat; | ||
94 | + | ||
95 | + | ||
96 | +/** | ||
97 | + serverId | ||
98 | + */ | ||
99 | +@property(nonatomic, assign)int serverId; | ||
100 | + | ||
101 | +/** | ||
102 | + 获取gamechannelid | ||
103 | + */ | ||
104 | +-(NSString *) getGameChannelId; | ||
105 | + | ||
106 | +/** | ||
107 | + 获取Custom | ||
108 | + */ | ||
109 | +- (NSString *) getCustomValue; | ||
110 | + | ||
111 | +/** | ||
112 | + 获取ChannelParameter1 | ||
113 | + */ | ||
114 | +- (NSString *) getChannelParameter1; | ||
115 | + | ||
116 | +/** | ||
117 | + 获取ChannelParameter2 | ||
118 | + */ | ||
119 | +- (NSString *) getChannelParameter2; | ||
120 | + | ||
121 | + | ||
122 | +@end |
1 | +// | ||
2 | +// PoolSdk.m | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 11/23/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import "PoolSdk.h" | ||
10 | +#import "SDKInterface.h" | ||
11 | + | ||
12 | +static PoolSdk *s_PoolSdkCerterInstance = nil; | ||
13 | +static id<UnionInterface> _interface = nil; | ||
14 | +@implementation PoolSdk : NSObject | ||
15 | + | ||
16 | +- (id)init | ||
17 | +{ | ||
18 | + if(self = [super init]) | ||
19 | + { | ||
20 | + _sdkVersion = [NSString stringWithFormat:@"%@ - %@",[[PoolConfig getInstance] gameSimpleName], [[PoolConfig getInstance] sdkSimpleName]]; | ||
21 | + _interface = [[SDKInterface alloc] init]; | ||
22 | + self.urlSchemes = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]; | ||
23 | + } | ||
24 | + return self; | ||
25 | +} | ||
26 | + | ||
27 | +- (void)initSDK :(UIViewController *) control | ||
28 | +{ | ||
29 | + if (![[NSUserDefaults standardUserDefaults] boolForKey:@"pool_everLaunched"]) { | ||
30 | + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"pool_everLaunched"]; | ||
31 | + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"pool_firstLaunch"]; | ||
32 | + } | ||
33 | + else{ | ||
34 | + [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"pool_firstLaunch"]; | ||
35 | + } | ||
36 | + | ||
37 | + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"firstLaunch"]) { | ||
38 | + | ||
39 | + } | ||
40 | + [_interface SDKinit:control]; | ||
41 | + | ||
42 | + [[PoolChecker getInstance] reportSDKOpen]; | ||
43 | + | ||
44 | + NSString* channelId = [[PoolConfig getInstance] getValueByKey:@"gamechannelid"]; | ||
45 | + [TrackingIO initWithappKey:[[PoolConfig getInstance] getValueByKey:@"renyunAppKey"] withChannelId:channelId]; | ||
46 | +} | ||
47 | + | ||
48 | +/** | ||
49 | + 获取SDK实例对象 | ||
50 | + */ | ||
51 | ++ (PoolSdk *)shareSDK | ||
52 | +{ | ||
53 | + static dispatch_once_t dgonceToken; | ||
54 | + dispatch_once(&dgonceToken, ^{ | ||
55 | + s_PoolSdkCerterInstance = [[PoolSdk alloc] init]; | ||
56 | + s_PoolSdkCerterInstance.sdkOrientation = ESDKOrientationLandscape; | ||
57 | + s_PoolSdkCerterInstance.bShowedFloat = NO; | ||
58 | + }); | ||
59 | + | ||
60 | + return s_PoolSdkCerterInstance; | ||
61 | +} | ||
62 | + | ||
63 | +-(void)viewDidAppear{ | ||
64 | + [_interface viewDidAppear]; | ||
65 | +} | ||
66 | + | ||
67 | +- (void)loginSDK | ||
68 | +{ | ||
69 | + [[PoolChecker getInstance] reportOpen]; | ||
70 | + [_interface SDKloginSDK]; | ||
71 | +} | ||
72 | + | ||
73 | +- (void)payWithPaymentInfo:(PoolCreateOrderInfo *)payInfo | ||
74 | +{ | ||
75 | + [_interface SDKpayWithPaymentInfo:payInfo]; | ||
76 | +} | ||
77 | + | ||
78 | +- (void)reportSDK:(PoolReportInfo *)reportInfo | ||
79 | +{ | ||
80 | + NSString *reportT = [reportInfo reportType]; | ||
81 | + reportInfo.openId = [[PoolChecker getInstance] userId]; | ||
82 | + if ([reportT isEqualToString:REPORT_ENTER]) { | ||
83 | + [[PoolChecker getInstance] reportEnter:reportInfo]; | ||
84 | + NSLog(@"reportSDK enter"); | ||
85 | + [TrackingIO setLoginWithAccountID:[reportInfo playerId]]; | ||
86 | + }else if ([reportT isEqualToString:REPORT_ROLEUPGRADE]){ | ||
87 | + | ||
88 | + }else if ([reportT isEqualToString:REPORT_CREATEROLE]){ | ||
89 | + NSLog(@"reportSDK createRole"); | ||
90 | + [TrackingIO setRegisterWithAccountID:[reportInfo playerId]]; | ||
91 | + } | ||
92 | +// [[PoolChecker getInstance] reportOpen]; | ||
93 | + [_interface SDKreport:reportInfo]; | ||
94 | + | ||
95 | +} | ||
96 | + | ||
97 | +- (void)gotoUserCenter | ||
98 | +{ | ||
99 | + [_interface SDKgotoUserCenter]; | ||
100 | +} | ||
101 | + | ||
102 | +- (void)logoutSDK | ||
103 | +{ | ||
104 | + [_interface SDKlogoutSDK]; | ||
105 | +} | ||
106 | + | ||
107 | +- (void)exitSDK | ||
108 | +{ | ||
109 | + [_interface SDKexitSDK]; | ||
110 | +} | ||
111 | + | ||
112 | +- (void)handleOpenurl:(NSURL *)url | ||
113 | +{ | ||
114 | + NSLog(@"handleOpenurl%@",url); | ||
115 | + if([[url host] isEqualToString:@"c_code"]){ | ||
116 | + NSString* path = url.path; | ||
117 | + NSString* codeValue = [path substringFromIndex:1]; | ||
118 | + [[PoolChecker getInstance] handleFirstOpenApp:codeValue]; | ||
119 | + } | ||
120 | + [_interface handleOpenurl:url]; | ||
121 | +} | ||
122 | + | ||
123 | +- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window | ||
124 | +{ | ||
125 | + return [_interface application:application supportedInterfaceOrientationsForWindow:window]; | ||
126 | +} | ||
127 | + | ||
128 | +- (NSString *)getGameChannelId{ | ||
129 | + return [[PoolConfig getInstance]getValueByKey:@"gamechannelid"]; | ||
130 | +} | ||
131 | + | ||
132 | +- (NSString *)getCustomValue{ | ||
133 | + return [[PoolConfig getInstance]getValueByKey:@"custom"]; | ||
134 | +} | ||
135 | + | ||
136 | +- (NSString *)getChannelParameter1{ | ||
137 | + return [[PoolConfig getInstance]getValueByKey:@"c1"]; | ||
138 | +} | ||
139 | + | ||
140 | +- (NSString *)getChannelParameter2{ | ||
141 | + return [[PoolConfig getInstance]getValueByKey:@"c2"]; | ||
142 | +} | ||
143 | + | ||
144 | +@end |
1 | +// | ||
2 | +// UnionInterface.m | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 11/23/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | +#include "SDKInterface.h" | ||
9 | +#import <UIKit/UIKit.h> | ||
10 | +#import <KCFramework/KCManager.h> | ||
11 | + | ||
12 | +@implementation SDKInterface : Interface | ||
13 | + | ||
14 | + | ||
15 | +int mExchange; | ||
16 | + | ||
17 | + | ||
18 | +/** | ||
19 | + 初始化SDK | ||
20 | +*/ | ||
21 | +- (void)SDKinit:(UIViewController *) control | ||
22 | +{ | ||
23 | + //必须继承 | ||
24 | + [super SDKinit:control]; | ||
25 | + | ||
26 | + [PoolConfig getInstance]; | ||
27 | + NSLog(@"sdk chushihua"); | ||
28 | + | ||
29 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveLoginMessage:) name:@"KCLoginCallBack" object:nil]; | ||
30 | + | ||
31 | + [[PoolChecker getInstance] sendNotice:PoolSDKNotificationInitSDK notiName:@"InitSuccess" statusCode:POOLSDK_NO_ERROR description:@"initSuccess" extendData:nil]; | ||
32 | + | ||
33 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(clickLoginoutCallBack:) name:@"clickLoginoutCallBack" object:nil]; | ||
34 | + | ||
35 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(KCLoginoutCallBack:) name:@"KCLoginoutCallBack" object:nil]; | ||
36 | + | ||
37 | + KCManager *kc = [KCManager sharedInstance]; | ||
38 | + [kc KCInit]; | ||
39 | +} | ||
40 | + | ||
41 | +/** | ||
42 | + 登录SDK | ||
43 | + */ | ||
44 | +- (void)SDKloginSDK | ||
45 | +{ | ||
46 | + NSLog(@"调用了LoginSDK"); | ||
47 | + KCManager *kc = [KCManager sharedInstance]; | ||
48 | + [kc kCLogin]; | ||
49 | +} | ||
50 | + | ||
51 | + | ||
52 | +/** | ||
53 | + loginCheck | ||
54 | + gametoken = f380786eadd923dae20786f69cec037e; | ||
55 | + sessid = m81jhoh3lcrahurdikbllnq3i5; | ||
56 | + time = 1496837007; | ||
57 | + uid = qy257599; | ||
58 | + */ | ||
59 | +- (void)receiveLoginMessage:(NSNotification *)notification | ||
60 | +{ | ||
61 | + NSLog(@"loginchek"); | ||
62 | + NSDictionary* userInfoDic = notification.userInfo; | ||
63 | + PoolLoginInfo *loginInfo = [PoolLoginInfo alloc]; | ||
64 | + loginInfo.openId = [userInfoDic objectForKey:@"uid"]; | ||
65 | + loginInfo.sign = [userInfoDic objectForKey:@"gametoken"]; | ||
66 | + loginInfo.timestamp = [userInfoDic objectForKey:@"time"]; | ||
67 | + loginInfo.other = [userInfoDic objectForKey:@"sessid"]; | ||
68 | + | ||
69 | + dispatch_async(dispatch_get_global_queue(0, 0), ^{ | ||
70 | + [[PoolChecker getInstance] startCheck:loginInfo]; | ||
71 | + }); | ||
72 | +} | ||
73 | + | ||
74 | + | ||
75 | +- (void)KCLoginoutCallBack:(NSNotification *)notification | ||
76 | +{ | ||
77 | + NSLog(@"logout callback"); | ||
78 | + [[PoolChecker getInstance] sendNotice:PoolSDKNotificationLogout notiName:@"logoutSuccess" statusCode:POOLSDK_NO_ERROR description:@"logoutSuccess" extendData:nil]; | ||
79 | + | ||
80 | +} | ||
81 | + | ||
82 | +- (void)clickLoginoutCallBack:(NSNotification *)notification | ||
83 | +{ | ||
84 | + NSLog(@"click logout button"); | ||
85 | + [self SDKlogoutSDK]; | ||
86 | +} | ||
87 | + | ||
88 | +-(NSString*)DataTojsonString:(id)object | ||
89 | +{ | ||
90 | + NSString *jsonString = nil; | ||
91 | + NSError *error; | ||
92 | + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:object | ||
93 | + options:NSJSONWritingPrettyPrinted // Pass 0 if you don't care about the readability of the generated string | ||
94 | + error:&error]; | ||
95 | + jsonString = [jsonData base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength]; | ||
96 | + return jsonString; | ||
97 | +} | ||
98 | + | ||
99 | +/** | ||
100 | + 支付 创建订单 | ||
101 | + */ | ||
102 | +- (void)SDKpayWithPaymentInfo:(PoolCreateOrderInfo *)payInfo | ||
103 | +{ | ||
104 | + mExchange = [payInfo exchange].intValue; | ||
105 | + [super SDKpayWithPaymentInfo:payInfo]; | ||
106 | +} | ||
107 | + | ||
108 | +/** | ||
109 | + SDK | ||
110 | + */ | ||
111 | +- (void)SDKgotoUserCenter | ||
112 | +{ | ||
113 | +} | ||
114 | + | ||
115 | +- (void)SDKreport:(PoolReportInfo *)reportInfo | ||
116 | +{ | ||
117 | + NSLog(@"reportInfo"); | ||
118 | + if ([REPORT_ENTER isEqualToString:[reportInfo reportType]]) { | ||
119 | + KCManager *kc = [KCManager sharedInstance]; | ||
120 | + [kc KCRolemeberWithServerid:[reportInfo serverId] andServername:[reportInfo serverName] andRoleid:[reportInfo playerId] andRolename:[reportInfo playerName] | ||
121 | + andRolelevel:[reportInfo playerLevel]]; | ||
122 | + | ||
123 | + } | ||
124 | +} | ||
125 | + | ||
126 | +/** | ||
127 | + SDK | ||
128 | + */ | ||
129 | +- (void)SDKexitSDK | ||
130 | +{ | ||
131 | + | ||
132 | +} | ||
133 | + | ||
134 | +- (void)SDKlogoutSDK | ||
135 | +{ | ||
136 | + NSLog(@"切换账号"); | ||
137 | + [[KCManager sharedInstance] KCLoginout]; | ||
138 | +} | ||
139 | + | ||
140 | +- (void)handleOpenurl:(NSURL *)url | ||
141 | +{ | ||
142 | +} | ||
143 | + | ||
144 | +- (void)receivePayMessage : (NSNotification *)notification; | ||
145 | +{ | ||
146 | + NSString *order_id = [notification object]; | ||
147 | + NSLog(@"订单ID:%@", order_id); | ||
148 | +} | ||
149 | + | ||
150 | + | ||
151 | +/** | ||
152 | + @return 商品ID | ||
153 | + */ | ||
154 | +- (NSString*)getProductIdByAmount:(NSString*)products amount:(NSString*)amount | ||
155 | +{ | ||
156 | + NSData* jsonData = [NSJSONSerialization dataWithJSONObject:products options:NSJSONWritingPrettyPrinted error:nil]; | ||
157 | + if(jsonData){ | ||
158 | + NSDictionary* productList = [NSJSONSerialization JSONObjectWithData:jsonData options:kNilOptions error:nil]; | ||
159 | + if(productList){ | ||
160 | + NSEnumerator* keysList = [productList keyEnumerator]; | ||
161 | + id keyValue; | ||
162 | + while (keyValue = [keysList nextObject]) | ||
163 | + { | ||
164 | + NSLog(@"i found %@",keyValue); | ||
165 | + NSString* appleAmount = [[productList objectForKey:keyValue] objectForKey:@"amount"]; | ||
166 | + NSLog(@"appleAmount:%@ amount:%@",appleAmount,amount); | ||
167 | + if(appleAmount.intValue == amount.intValue){ | ||
168 | + return keyValue; | ||
169 | + } | ||
170 | + } | ||
171 | + } | ||
172 | + } | ||
173 | + return @"unknow"; | ||
174 | +} | ||
175 | + | ||
176 | +- (void)receiveCreateOrder:(NSNotification *)notification | ||
177 | +{ | ||
178 | + NSLog(@"创建订单成功"); | ||
179 | + PoolPayInfo *payInfo = [notification object]; | ||
180 | + | ||
181 | + NSString *myamount = [payInfo postAmount]; | ||
182 | + NSString *serverId = [payInfo serverId]; | ||
183 | + NSString *roleName = [payInfo playerName]; | ||
184 | + NSString *queryId = [payInfo queryId]; | ||
185 | + | ||
186 | + NSLog(@"myamount%d%@",[myamount intValue],@"111"); | ||
187 | + | ||
188 | + | ||
189 | + NSString* amount = [[NSString alloc]initWithFormat:@"%d",[myamount intValue]]; | ||
190 | + NSString* productId = [self getProductIdByAmount:[payInfo products] amount:amount]; | ||
191 | + | ||
192 | + KCManager *kc = [KCManager sharedInstance]; | ||
193 | + | ||
194 | + [kc KCPayWithBill:queryId andProductid:productId andAmount:amount andServerid:serverId andRolename:roleName andRolelevel:@"10" andRoleid:[payInfo playerId] andSubject:@"12" andExt:queryId]; | ||
195 | + | ||
196 | + int64_t delayInSeconds = 3.0;// 延迟的时间 | ||
197 | + dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); | ||
198 | + dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ | ||
199 | + NSLog(@"chage state"); | ||
200 | + [[PoolChecker getInstance] setOnlyOneTimePay:false]; | ||
201 | + }); | ||
202 | +} | ||
203 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
3 | +<plist version="1.0"> | ||
4 | +<dict> | ||
5 | + <key>ver</key> | ||
6 | + <string>appstore100039</string> | ||
7 | + <key>appkey</key> | ||
8 | + <string>2f5d0ad8a8c48db20e86511fa5c7050c</string> | ||
9 | + <key>appid</key> | ||
10 | + <string>100039</string> | ||
11 | +</dict> | ||
12 | +</plist> |
1 | +{ | ||
2 | +"APP_ID": "1731", | ||
3 | +"APP_KEY":"E5C44DEF7B3FA16D158332C8CB8C8388", | ||
4 | + | ||
5 | + | ||
6 | +"appScheme": "com.qiyutianxia.game", | ||
7 | + | ||
8 | +"gameSimpleName": "fytx_test", | ||
9 | +"sdkSimpleName": "qiyu_ios", | ||
10 | +"sdkVersionCode":"V1_1", | ||
11 | + | ||
12 | + | ||
13 | +"gamechannelid": "channelId", | ||
14 | +"custom": "custom", | ||
15 | +"c2": "c2", | ||
16 | +"c1": "c1", | ||
17 | +"loginCheckUrl": "http://183.57.76.181:9010/logincheck/check", | ||
18 | +"payorderurl": "http://183.57.76.181:9020/paycheck/create", | ||
19 | +"paycheckurl": "http://183.57.76.181:9020/paycheck/confirm" | ||
20 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
3 | +<plist version="1.0"> | ||
4 | +<dict> | ||
5 | + <key>NSAppTransportSecurity</key> | ||
6 | + <dict> | ||
7 | + <key>NSAllowsArbitraryLoads</key> | ||
8 | + <true/> | ||
9 | + </dict> | ||
10 | + | ||
11 | + <key>LSApplicationQueriesSchemes</key> | ||
12 | + <array> | ||
13 | + <string>mqqapi</string> | ||
14 | + <string>wechat</string> | ||
15 | + <string>mqq</string> | ||
16 | + <string>alipays</string> | ||
17 | + <string>alipayqr</string> | ||
18 | + <string>weixin</string> | ||
19 | + <string>alipay</string> | ||
20 | + </array> | ||
21 | + | ||
22 | + | ||
23 | +</dict> | ||
24 | +</plist> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// AppleIap.h | ||
3 | +// Demo_youdian | ||
4 | +// | ||
5 | +// Created by 许 on 17/6/20. | ||
6 | +// Copyright © 2017年 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | + | ||
11 | +@interface AppleIap : NSObject | ||
12 | + | ||
13 | + | ||
14 | +-(void)applePay:(NSString*)products amount:(NSString*)amount queryId:(NSString*)queryId; | ||
15 | + | ||
16 | +@end |
1 | +// | ||
2 | +// AppleIap.m | ||
3 | +// Demo_youdian | ||
4 | +// | ||
5 | +// Created by 许 on 17/6/20. | ||
6 | +// Copyright © 2017年 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import "AppleIap.h" | ||
10 | + | ||
11 | +#import "IAPShare.h" | ||
12 | +#import "PoolSdk.h" | ||
13 | + | ||
14 | +@implementation AppleIap | ||
15 | + | ||
16 | +/** | ||
17 | + @return 商品ID | ||
18 | + */ | ||
19 | +- (NSString*)getProductIdByAmount:(NSString*)products amount:(NSString*)amount | ||
20 | +{ | ||
21 | + NSData* jsonData = [NSJSONSerialization dataWithJSONObject:products options:NSJSONWritingPrettyPrinted error:nil]; | ||
22 | + if(jsonData){ | ||
23 | + NSDictionary* productList = [NSJSONSerialization JSONObjectWithData:jsonData options:kNilOptions error:nil]; | ||
24 | + if(productList){ | ||
25 | + NSEnumerator* keysList = [productList keyEnumerator]; | ||
26 | + id keyValue; | ||
27 | + while (keyValue = [keysList nextObject]) | ||
28 | + { | ||
29 | + NSString* appleAmount = [[productList objectForKey:keyValue] objectForKey:@"amount"]; | ||
30 | + if(appleAmount.intValue == amount.intValue){ | ||
31 | + NSLog(@"appleAmount:%@ amount:%@",appleAmount,amount); | ||
32 | + return keyValue; | ||
33 | + } | ||
34 | + } | ||
35 | + } | ||
36 | + } | ||
37 | + NSLog(@"amount get productId error amount:%@",amount); | ||
38 | + return nil; | ||
39 | +} | ||
40 | + | ||
41 | + | ||
42 | +-(void)applePay:(NSString *)products amount:(NSString *)amount queryId:(NSString *)queryId | ||
43 | +{ | ||
44 | + //内购ID | ||
45 | + NSString* productId = [self getProductIdByAmount:products amount:amount]; | ||
46 | + if(productId){ | ||
47 | + [self ipaPay:productId queryId:queryId]; | ||
48 | + }else{ | ||
49 | + NSLog(@"get apple product id error"); | ||
50 | + } | ||
51 | +} | ||
52 | + | ||
53 | +/** | ||
54 | + 苹果支付结果回调 | ||
55 | + */ | ||
56 | + | ||
57 | +- (void)applePayCallBack:(NSString*)receiptStr queryId:(NSString*)queryId | ||
58 | +{ | ||
59 | + //NSDictionary* payResultDic = notification.object; | ||
60 | + //NSString* receiptStr = [payResultDic objectForKey:@"payResult"]; | ||
61 | + //NSString* queryId = [payResultDic objectForKey:@"query_id"]; | ||
62 | + | ||
63 | + NSDictionary* receiptDic = [NSDictionary dictionaryWithObjectsAndKeys:receiptStr,@"receipt",queryId,@"query_id", nil]; | ||
64 | + NSString* result = [[NetCenter getInstance] httpPostSyn:[PoolUtils createPayUrl] :receiptDic]; | ||
65 | + | ||
66 | + if([@"success" isEqualToString:result]){//确认订单成功 | ||
67 | + }else{//失败 | ||
68 | + NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults]; | ||
69 | + NSMutableArray* queryIdArray = [userDefaults objectForKey:@"queryIds"]; | ||
70 | + | ||
71 | + NSMutableArray* tempQueryIdArray = [[NSMutableArray alloc] initWithCapacity:10]; | ||
72 | + | ||
73 | + if (queryIdArray) { | ||
74 | + }else{ | ||
75 | + queryIdArray = [[NSMutableArray alloc]initWithCapacity:10]; | ||
76 | + } | ||
77 | + | ||
78 | + for (NSString* arrayQueryId in queryIdArray) { | ||
79 | + [tempQueryIdArray addObject:arrayQueryId]; | ||
80 | + } | ||
81 | + | ||
82 | + [tempQueryIdArray addObject:queryId]; | ||
83 | + [userDefaults setObject:tempQueryIdArray forKey:@"queryIds"]; | ||
84 | + [userDefaults setObject:receiptStr forKey:queryId]; | ||
85 | + [userDefaults synchronize]; | ||
86 | + } | ||
87 | +} | ||
88 | + | ||
89 | + | ||
90 | + | ||
91 | +- (void)initIpa:(NSString*)productId{ | ||
92 | + if(![IAPShare sharedHelper].iap){ | ||
93 | + NSLog(@"iap init"); | ||
94 | + } | ||
95 | + NSSet* dataSet = [[NSSet alloc]initWithObjects:productId, nil]; | ||
96 | + [IAPShare sharedHelper].iap = [[IAPHelper alloc] initWithProductIdentifiers:dataSet]; | ||
97 | +} | ||
98 | + | ||
99 | + | ||
100 | +- (void)ipaPay:(NSString*) productId queryId:(NSString*)queryId{ | ||
101 | + @synchronized([PoolSdk shareSDK]) { | ||
102 | + if([PoolSdk shareSDK].isApplePaying) { | ||
103 | + NSLog(@"apple paying"); | ||
104 | + return; | ||
105 | + }; | ||
106 | + [PoolSdk shareSDK].isApplePaying = true; | ||
107 | + } | ||
108 | + NSLog(@"productId:%@",productId); | ||
109 | + [self initIpa:productId]; | ||
110 | + [[IAPShare sharedHelper].iap requestProductsWithCompletion:^(SKProductsRequest* request,SKProductsResponse* response) | ||
111 | + { | ||
112 | + NSLog(@"response"); | ||
113 | + if(response && response > 0 ) { | ||
114 | + NSLog(@"response %lu",(unsigned long)[[IAPShare sharedHelper].iap.products count]); | ||
115 | + if([[IAPShare sharedHelper].iap.products count] > 0){ | ||
116 | + NSLog(@"product count 1"); | ||
117 | + SKProduct* product =[[IAPShare sharedHelper].iap.products objectAtIndex:0]; | ||
118 | + | ||
119 | + [[IAPShare sharedHelper].iap buyProduct:product | ||
120 | + onCompletion:^(SKPaymentTransaction* trans){ | ||
121 | + [PoolSdk shareSDK].isApplePaying = false; | ||
122 | + if(trans.error) | ||
123 | + { | ||
124 | + NSLog(@"Fail %@",[trans.error localizedDescription]); | ||
125 | + } | ||
126 | + else if(trans.transactionState == SKPaymentTransactionStatePurchased) { | ||
127 | + | ||
128 | + NSData* receiptData = [NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]]; | ||
129 | + | ||
130 | + NSString* receiptStr = [receiptData base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength]; | ||
131 | + | ||
132 | + receiptStr = [receiptStr stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; | ||
133 | + | ||
134 | + [self applePayCallBack:receiptStr queryId:queryId]; | ||
135 | + } | ||
136 | + else if(trans.transactionState == SKPaymentTransactionStateFailed) { | ||
137 | + NSLog(@"Fail"); | ||
138 | + } | ||
139 | + }]; | ||
140 | + }else{ | ||
141 | + [PoolSdk shareSDK].isApplePaying = false; | ||
142 | + } | ||
143 | + }else{ | ||
144 | + [PoolSdk shareSDK].isApplePaying = false; | ||
145 | + } | ||
146 | + }]; | ||
147 | +} | ||
148 | + | ||
149 | +@end |
1 | +{ | ||
2 | + "images" : [ | ||
3 | + { | ||
4 | + "idiom" : "iphone", | ||
5 | + "size" : "29x29", | ||
6 | + "scale" : "2x" | ||
7 | + }, | ||
8 | + { | ||
9 | + "idiom" : "iphone", | ||
10 | + "size" : "29x29", | ||
11 | + "scale" : "3x" | ||
12 | + }, | ||
13 | + { | ||
14 | + "idiom" : "iphone", | ||
15 | + "size" : "40x40", | ||
16 | + "scale" : "2x" | ||
17 | + }, | ||
18 | + { | ||
19 | + "idiom" : "iphone", | ||
20 | + "size" : "40x40", | ||
21 | + "scale" : "3x" | ||
22 | + }, | ||
23 | + { | ||
24 | + "idiom" : "iphone", | ||
25 | + "size" : "60x60", | ||
26 | + "scale" : "2x" | ||
27 | + }, | ||
28 | + { | ||
29 | + "idiom" : "iphone", | ||
30 | + "size" : "60x60", | ||
31 | + "scale" : "3x" | ||
32 | + } | ||
33 | + ], | ||
34 | + "info" : { | ||
35 | + "version" : 1, | ||
36 | + "author" : "xcode" | ||
37 | + } | ||
38 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +{ | ||
2 | + "images" : [ | ||
3 | + { | ||
4 | + "orientation" : "portrait", | ||
5 | + "idiom" : "iphone", | ||
6 | + "minimum-system-version" : "7.0", | ||
7 | + "scale" : "2x" | ||
8 | + }, | ||
9 | + { | ||
10 | + "orientation" : "portrait", | ||
11 | + "idiom" : "iphone", | ||
12 | + "minimum-system-version" : "7.0", | ||
13 | + "subtype" : "retina4", | ||
14 | + "scale" : "2x" | ||
15 | + } | ||
16 | + ], | ||
17 | + "info" : { | ||
18 | + "version" : 1, | ||
19 | + "author" : "xcode" | ||
20 | + } | ||
21 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
3 | +<plist version="1.0"> | ||
4 | +<dict> | ||
5 | + <key>CFBundleExecutable</key> | ||
6 | + <string>$(EXECUTABLE_NAME)</string> | ||
7 | + <key>CFBundleIdentifier</key> | ||
8 | + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
9 | + <key>CFBundleInfoDictionaryVersion</key> | ||
10 | + <string>6.0</string> | ||
11 | + <key>CFBundleName</key> | ||
12 | + <string>$(PRODUCT_NAME)</string> | ||
13 | + <key>CFBundlePackageType</key> | ||
14 | + <string>APPL</string> | ||
15 | + <key>CFBundleShortVersionString</key> | ||
16 | + <string>1.0</string> | ||
17 | + <key>CFBundleSignature</key> | ||
18 | + <string>????</string> | ||
19 | + <key>CFBundleURLTypes</key> | ||
20 | + <array> | ||
21 | + <dict> | ||
22 | + <key>CFBundleTypeRole</key> | ||
23 | + <string>Editor</string> | ||
24 | + <key>CFBundleURLName</key> | ||
25 | + <string>weixin</string> | ||
26 | + </dict> | ||
27 | + </array> | ||
28 | + <key>CFBundleVersion</key> | ||
29 | + <string>1</string> | ||
30 | + <key>LSApplicationQueriesSchemes</key> | ||
31 | + <array> | ||
32 | + <string>mqqapi</string> | ||
33 | + <string>wechat</string> | ||
34 | + <string>mqq</string> | ||
35 | + <string>alipays</string> | ||
36 | + <string>alipayqr</string> | ||
37 | + <string>weixin</string> | ||
38 | + <string>alipay</string> | ||
39 | + </array> | ||
40 | + <key>LSRequiresIPhoneOS</key> | ||
41 | + <true/> | ||
42 | + <key>NSAppTransportSecurity</key> | ||
43 | + <dict> | ||
44 | + <key>NSAllowsArbitraryLoads</key> | ||
45 | + <true/> | ||
46 | + </dict> | ||
47 | + <key>UILaunchStoryboardName</key> | ||
48 | + <string>LaunchScreen</string> | ||
49 | + <key>UIMainStoryboardFile</key> | ||
50 | + <string>Main</string> | ||
51 | + <key>UIRequiredDeviceCapabilities</key> | ||
52 | + <array> | ||
53 | + <string>armv7</string> | ||
54 | + </array> | ||
55 | + <key>UISupportedInterfaceOrientations</key> | ||
56 | + <array> | ||
57 | + <string>UIInterfaceOrientationLandscapeLeft</string> | ||
58 | + <string>UIInterfaceOrientationLandscapeRight</string> | ||
59 | + </array> | ||
60 | +</dict> | ||
61 | +</plist> |
1 | +// | ||
2 | +// PoolSdk.h | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 11/23/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | +#import <PoolSdk/PoolSdk2.h> | ||
11 | +#import <UIKit/UIKit.h> | ||
12 | + | ||
13 | +@interface PoolSdk : NSObject | ||
14 | +/** | ||
15 | + * 当前SDK的版本 | ||
16 | + */ | ||
17 | +@property(nonatomic, strong, readonly)NSString *sdkVersion; | ||
18 | + | ||
19 | +/** | ||
20 | + *苹果支付标识 true正在进行苹果支付 | ||
21 | + **/ | ||
22 | +@property bool isApplePaying; | ||
23 | + | ||
24 | +/** | ||
25 | + * 用于设置url types schemes 默认为工程名 | ||
26 | + */ | ||
27 | +@property(nonatomic, strong)NSString *urlSchemes; | ||
28 | + | ||
29 | +/** | ||
30 | + 获取SDK实例对象 | ||
31 | + */ | ||
32 | ++ (PoolSdk *)shareSDK; | ||
33 | + | ||
34 | +/** | ||
35 | + 初始化SDK | ||
36 | + */ | ||
37 | +- (void)initSDK:(UIViewController *) control; | ||
38 | + | ||
39 | + | ||
40 | +-(void)viewDidAppear; | ||
41 | + | ||
42 | +/** | ||
43 | + 登录SDK | ||
44 | + */ | ||
45 | +- (void)loginSDK; | ||
46 | + | ||
47 | +/** | ||
48 | + 进行支付 | ||
49 | + */ | ||
50 | +- (void)payWithPaymentInfo:(PoolCreateOrderInfo *)payInfo; | ||
51 | + | ||
52 | +/** | ||
53 | + 用户中心 | ||
54 | + */ | ||
55 | +- (void)gotoUserCenter; | ||
56 | + | ||
57 | +/** | ||
58 | + report | ||
59 | + */ | ||
60 | +- (void)reportSDK:(PoolReportInfo *)reportInfo; | ||
61 | + | ||
62 | +/** | ||
63 | + 注销 | ||
64 | + */ | ||
65 | +- (void)logoutSDK; | ||
66 | + | ||
67 | +/** | ||
68 | + 退出 | ||
69 | + */ | ||
70 | +- (void)exitSDK; | ||
71 | + | ||
72 | + | ||
73 | + | ||
74 | +/** | ||
75 | + 显示/隐藏浮标 | ||
76 | + */ | ||
77 | +//- (void)showFloatIcon:(BOOL)bFlag; | ||
78 | + | ||
79 | + | ||
80 | +/** | ||
81 | + // called in - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url | ||
82 | + */ | ||
83 | +- (void)handleOpenurl:(NSURL *)url; | ||
84 | + | ||
85 | +- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window; | ||
86 | +/** | ||
87 | + 应用 appid | ||
88 | + */ | ||
89 | + | ||
90 | +/** | ||
91 | + 应用支持的方向 默认为 EDreamSDKOrientationLandscape | ||
92 | + */ | ||
93 | +@property(nonatomic, assign)ESDKOrientation sdkOrientation; | ||
94 | + | ||
95 | +/** | ||
96 | + 浮标是否已经显示,默认为NO | ||
97 | + */ | ||
98 | +@property(nonatomic, assign)BOOL bShowedFloat; | ||
99 | + | ||
100 | + | ||
101 | +/** | ||
102 | + serverId | ||
103 | + */ | ||
104 | +@property(nonatomic, assign)int serverId; | ||
105 | + | ||
106 | +/** | ||
107 | + 获取gamechannelid | ||
108 | + */ | ||
109 | +-(NSString *) getGameChannelId; | ||
110 | + | ||
111 | +/** | ||
112 | + 获取Custom | ||
113 | + */ | ||
114 | +- (NSString *) getCustomValue; | ||
115 | + | ||
116 | +/** | ||
117 | + 获取ChannelParameter1 | ||
118 | + */ | ||
119 | +- (NSString *) getChannelParameter1; | ||
120 | + | ||
121 | +/** | ||
122 | + 获取ChannelParameter2 | ||
123 | + */ | ||
124 | +- (NSString *) getChannelParameter2; | ||
125 | + | ||
126 | + | ||
127 | +@end |
1 | +// | ||
2 | +// PoolSdk.m | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 11/23/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import "PoolSdk.h" | ||
10 | +#import "SDKInterface.h" | ||
11 | + | ||
12 | +static PoolSdk *s_PoolSdkCerterInstance = nil; | ||
13 | +static id<UnionInterface> _interface = nil; | ||
14 | +@implementation PoolSdk : NSObject | ||
15 | + | ||
16 | +- (id)init | ||
17 | +{ | ||
18 | + if(self = [super init]) | ||
19 | + { | ||
20 | + _sdkVersion = [NSString stringWithFormat:@"%@ - %@",[[PoolConfig getInstance] gameSimpleName], [[PoolConfig getInstance] sdkSimpleName]]; | ||
21 | + _interface = [[SDKInterface alloc] init]; | ||
22 | + self.urlSchemes = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]; | ||
23 | + } | ||
24 | + return self; | ||
25 | +} | ||
26 | + | ||
27 | +- (void)initSDK :(UIViewController *) control | ||
28 | +{ | ||
29 | + if (![[NSUserDefaults standardUserDefaults] boolForKey:@"pool_everLaunched"]) { | ||
30 | + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"pool_everLaunched"]; | ||
31 | + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"pool_firstLaunch"]; | ||
32 | + } | ||
33 | + else{ | ||
34 | + [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"pool_firstLaunch"]; | ||
35 | + } | ||
36 | + | ||
37 | + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"firstLaunch"]) { | ||
38 | + | ||
39 | + } | ||
40 | + [_interface SDKinit:control]; | ||
41 | + | ||
42 | + [[PoolChecker getInstance] reportSDKOpen]; | ||
43 | + | ||
44 | + NSString* channelId = [[PoolConfig getInstance] getValueByKey:@"gamechannelid"]; | ||
45 | + [TrackingIO initWithappKey:[[PoolConfig getInstance] getValueByKey:@"renyunAppKey"] withChannelId:channelId]; | ||
46 | +} | ||
47 | + | ||
48 | +/** | ||
49 | + 获取SDK实例对象 | ||
50 | + */ | ||
51 | ++ (PoolSdk *)shareSDK | ||
52 | +{ | ||
53 | + static dispatch_once_t dgonceToken; | ||
54 | + dispatch_once(&dgonceToken, ^{ | ||
55 | + s_PoolSdkCerterInstance = [[PoolSdk alloc] init]; | ||
56 | + s_PoolSdkCerterInstance.sdkOrientation = ESDKOrientationLandscape; | ||
57 | + s_PoolSdkCerterInstance.bShowedFloat = NO; | ||
58 | + }); | ||
59 | + | ||
60 | + return s_PoolSdkCerterInstance; | ||
61 | +} | ||
62 | + | ||
63 | +-(void)viewDidAppear{ | ||
64 | + [_interface viewDidAppear]; | ||
65 | +} | ||
66 | + | ||
67 | +- (void)loginSDK | ||
68 | +{ | ||
69 | + //[[PoolChecker getInstance] reportOpen]; | ||
70 | + [_interface SDKloginSDK]; | ||
71 | +} | ||
72 | + | ||
73 | +- (void)payWithPaymentInfo:(PoolCreateOrderInfo *)payInfo | ||
74 | +{ | ||
75 | + [_interface SDKpayWithPaymentInfo:payInfo]; | ||
76 | +} | ||
77 | + | ||
78 | +- (void)reportSDK:(PoolReportInfo *)reportInfo | ||
79 | +{ | ||
80 | + NSString *reportT = [reportInfo reportType]; | ||
81 | + reportInfo.openId = [[PoolChecker getInstance] userId]; | ||
82 | + if ([reportT isEqualToString:REPORT_ENTER]) { | ||
83 | + [[PoolChecker getInstance] reportEnter:reportInfo]; | ||
84 | + NSLog(@"reportSDK enter"); | ||
85 | + [TrackingIO setLoginWithAccountID:[reportInfo playerId]]; | ||
86 | + }else if ([reportT isEqualToString:REPORT_ROLEUPGRADE]){ | ||
87 | + | ||
88 | + }else if ([reportT isEqualToString:REPORT_CREATEROLE]){ | ||
89 | + NSLog(@"reportSDK createRole"); | ||
90 | + [TrackingIO setRegisterWithAccountID:[reportInfo playerId]]; | ||
91 | + } | ||
92 | +// [[PoolChecker getInstance] reportOpen]; | ||
93 | + [_interface SDKreport:reportInfo]; | ||
94 | + | ||
95 | +} | ||
96 | + | ||
97 | +- (void)gotoUserCenter | ||
98 | +{ | ||
99 | + [_interface SDKgotoUserCenter]; | ||
100 | +} | ||
101 | + | ||
102 | +- (void)logoutSDK | ||
103 | +{ | ||
104 | + [_interface SDKlogoutSDK]; | ||
105 | +} | ||
106 | + | ||
107 | +- (void)exitSDK | ||
108 | +{ | ||
109 | + [_interface SDKexitSDK]; | ||
110 | +} | ||
111 | + | ||
112 | +- (void)handleOpenurl:(NSURL *)url | ||
113 | +{ | ||
114 | + NSLog(@"handleOpenurl%@",url); | ||
115 | + if([[url host] isEqualToString:@"c_code"]){ | ||
116 | + NSString* path = url.path; | ||
117 | + NSString* codeValue = [path substringFromIndex:1]; | ||
118 | + [[PoolChecker getInstance] handleFirstOpenApp:codeValue]; | ||
119 | + } | ||
120 | + [_interface handleOpenurl:url]; | ||
121 | +} | ||
122 | + | ||
123 | +- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window | ||
124 | +{ | ||
125 | + return [_interface application:application supportedInterfaceOrientationsForWindow:window]; | ||
126 | +} | ||
127 | + | ||
128 | +- (NSString *)getGameChannelId{ | ||
129 | + return [[PoolConfig getInstance]getValueByKey:@"gamechannelid"]; | ||
130 | +} | ||
131 | + | ||
132 | +- (NSString *)getCustomValue{ | ||
133 | + return [[PoolConfig getInstance]getValueByKey:@"custom"]; | ||
134 | +} | ||
135 | + | ||
136 | +- (NSString *)getChannelParameter1{ | ||
137 | + return [[PoolConfig getInstance]getValueByKey:@"c1"]; | ||
138 | +} | ||
139 | + | ||
140 | +- (NSString *)getChannelParameter2{ | ||
141 | + return [[PoolConfig getInstance]getValueByKey:@"c2"]; | ||
142 | +} | ||
143 | + | ||
144 | +@end |
1 | + | ||
2 | +// | ||
3 | +// PPInterface.h | ||
4 | +// PoolSdk | ||
5 | +// | ||
6 | +// Created by winFan on 11/23/15. | ||
7 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
8 | +// | ||
9 | + | ||
10 | +#import <PoolSdk/PoolSdk2.h> | ||
11 | +#import "YDAccount.h" | ||
12 | +#import "YDTool.h" | ||
13 | + | ||
14 | +@interface SDKInterface : Interface<YDAccountDelegate,YDToolDelegate> | ||
15 | + | ||
16 | + | ||
17 | +@end |
1 | +// | ||
2 | +// UnionInterface.m | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 11/23/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | +#include "SDKInterface.h" | ||
9 | +#import <UIKit/UIKit.h> | ||
10 | +#import "AppleIap.h" | ||
11 | + | ||
12 | +@implementation SDKInterface : Interface | ||
13 | + | ||
14 | + | ||
15 | +int mExchange; | ||
16 | + | ||
17 | + | ||
18 | +/** | ||
19 | + 初始化SDK | ||
20 | +*/ | ||
21 | +- (void)SDKinit:(UIViewController *) control | ||
22 | +{ | ||
23 | + //必须继承 | ||
24 | + [super SDKinit:control]; | ||
25 | + | ||
26 | + [PoolConfig getInstance]; | ||
27 | + NSLog(@"sdk chushihua"); | ||
28 | + | ||
29 | + | ||
30 | + [[PoolChecker getInstance] sendNotice:PoolSDKNotificationInitSDK notiName:@"InitSuccess" statusCode:POOLSDK_NO_ERROR description:@"initSuccess" extendData:nil]; | ||
31 | + | ||
32 | + NSString* appId = [[PoolConfig getInstance] getValueByKey:@"appId"]; | ||
33 | + NSString* openKey = [[PoolConfig getInstance] getValueByKey:@"openKey"]; | ||
34 | + NSString* channelId = [[PoolConfig getInstance] getValueByKey:@"channelId"]; | ||
35 | + | ||
36 | + NSLog(@"appId:%@ \n openKey:%@",appId,openKey); | ||
37 | + [YDAccount initWithAppId:appId openKey:openKey]; | ||
38 | + [YDTool initWithAppId:appId developKey:openKey]; | ||
39 | + | ||
40 | + [YDAccount setDelegate:self]; | ||
41 | + [YDTool setDelegate:self]; | ||
42 | + [YDTool setChannelId:channelId]; | ||
43 | +} | ||
44 | + | ||
45 | +/** | ||
46 | + 登录SDK | ||
47 | + */ | ||
48 | +- (void)SDKloginSDK | ||
49 | +{ | ||
50 | + NSLog(@"调用了LoginSDK"); | ||
51 | + [YDAccount autoRatate:YES]; | ||
52 | + [YDAccount showWindow]; | ||
53 | +} | ||
54 | + | ||
55 | +/** | ||
56 | + 支付 创建订单 | ||
57 | + */ | ||
58 | +- (void)SDKpayWithPaymentInfo:(PoolCreateOrderInfo *)payInfo | ||
59 | +{ | ||
60 | + mExchange = [payInfo exchange].intValue; | ||
61 | + [super SDKpayWithPaymentInfo:payInfo]; | ||
62 | +} | ||
63 | + | ||
64 | +/** | ||
65 | + SDK | ||
66 | + */ | ||
67 | +- (void)SDKgotoUserCenter | ||
68 | +{ | ||
69 | +} | ||
70 | + | ||
71 | +- (void)SDKreport:(PoolReportInfo *)reportInfo | ||
72 | +{ | ||
73 | + NSLog(@"reportInfo"); | ||
74 | + if ([REPORT_CREATEROLE isEqualToString:[reportInfo reportType]]) { | ||
75 | + [YDAccount bindGameUserId:[reportInfo playerId]]; | ||
76 | + }else if ([[reportInfo reportType] isEqualToString:REPORT_ENTER]) { | ||
77 | + dispatch_async(dispatch_get_global_queue(0, 0), ^{ | ||
78 | + [self handlerLeakOrder]; | ||
79 | + }); | ||
80 | + } | ||
81 | +} | ||
82 | + | ||
83 | + | ||
84 | +/** | ||
85 | + SDK | ||
86 | + */ | ||
87 | +- (void)SDKexitSDK | ||
88 | +{ | ||
89 | + | ||
90 | +} | ||
91 | + | ||
92 | +- (void)SDKlogoutSDK | ||
93 | +{ | ||
94 | + NSLog(@"切换账号"); | ||
95 | + [YDAccount logout]; | ||
96 | + [[PoolChecker getInstance] sendNotice:PoolSDKNotificationLogout notiName:@"logoutSuccess" statusCode:POOLSDK_NO_ERROR description:@"logoutSuccess" extendData:nil]; | ||
97 | +} | ||
98 | + | ||
99 | +- (void)handleOpenurl:(NSURL *)url | ||
100 | +{ | ||
101 | +} | ||
102 | + | ||
103 | +- (void)receivePayMessage : (NSNotification *)notification; | ||
104 | +{ | ||
105 | + NSString *order_id = [notification object]; | ||
106 | + NSLog(@"订单ID:%@", order_id); | ||
107 | +} | ||
108 | + | ||
109 | +//补单处理 | ||
110 | +- (void) handlerLeakOrder{ | ||
111 | + NSUserDefaults* userDefaults2 = [NSUserDefaults standardUserDefaults]; | ||
112 | + NSMutableArray* queryIdArray = [userDefaults2 objectForKey:@"queryIds"]; | ||
113 | + | ||
114 | + NSLog(@"orderDic%@",queryIdArray); | ||
115 | + NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults]; | ||
116 | + NSMutableArray* failQueryIdArray = [[NSMutableArray alloc]initWithCapacity:10];//补单失败的queryid集合 | ||
117 | + | ||
118 | + if(queryIdArray){ | ||
119 | + for (NSString* queryId in queryIdArray) { | ||
120 | + NSString* receiptStr = [userDefaults valueForKey:queryId]; | ||
121 | + NSDictionary* receiptDic = [NSDictionary dictionaryWithObjectsAndKeys:receiptStr,@"receipt",queryId,@"query_id", nil]; | ||
122 | + NSString* result = [[NetCenter getInstance] httpPostSyn:[PoolUtils createPayUrl] :receiptDic]; | ||
123 | + if([@"success" isEqualToString:result]){//成功 | ||
124 | + [userDefaults removeObjectForKey:queryId]; | ||
125 | + }else{//补单失败 | ||
126 | + [failQueryIdArray addObject:queryId]; | ||
127 | + } | ||
128 | + } | ||
129 | + | ||
130 | + NSLog(@"order count:%lu",(unsigned long)[failQueryIdArray count]); | ||
131 | + if([failQueryIdArray count] > 0){//含有补单失败项 | ||
132 | + [userDefaults setObject:failQueryIdArray forKey:@"queryIds"]; | ||
133 | + }else{//全部补单成功 | ||
134 | + [userDefaults removeObjectForKey:@"queryIds"]; | ||
135 | + } | ||
136 | + [userDefaults synchronize]; | ||
137 | + } | ||
138 | +} | ||
139 | + | ||
140 | + | ||
141 | +/** | ||
142 | + @return 商品名称 | ||
143 | + */ | ||
144 | +- (NSString*)getProductNameByAmount:(NSString*)products amount:(NSString*)amount | ||
145 | +{ | ||
146 | + NSData* jsonData = [NSJSONSerialization dataWithJSONObject:products options:NSJSONWritingPrettyPrinted error:nil]; | ||
147 | + if(jsonData){ | ||
148 | + NSDictionary* productList = [NSJSONSerialization JSONObjectWithData:jsonData options:kNilOptions error:nil]; | ||
149 | + if(productList){ | ||
150 | + NSEnumerator* keysList = [productList keyEnumerator]; | ||
151 | + id keyValue; | ||
152 | + while (keyValue = [keysList nextObject]) | ||
153 | + { | ||
154 | + NSString* appleAmount = [[productList objectForKey:keyValue] objectForKey:@"amount"]; | ||
155 | + if(appleAmount.intValue == amount.intValue){ | ||
156 | + NSString* productName = [[productList objectForKey:keyValue] objectForKey:@"name"]; | ||
157 | + return productName; | ||
158 | + } | ||
159 | + } | ||
160 | + } | ||
161 | + } | ||
162 | + NSLog(@"get product name error amount:%@",amount); | ||
163 | + return @"元宝"; | ||
164 | +} | ||
165 | + | ||
166 | + | ||
167 | +- (void)receiveCreateOrder:(NSNotification *)notification | ||
168 | +{ | ||
169 | + NSLog(@"创建订单成功"); | ||
170 | + PoolPayInfo *payInfo = [notification object]; | ||
171 | + | ||
172 | + NSString *myamount = [payInfo postAmount]; | ||
173 | + NSString *queryId = [payInfo queryId]; | ||
174 | + | ||
175 | + dispatch_async(dispatch_get_global_queue(0, 0), ^{ | ||
176 | + [self handlerLeakOrder]; | ||
177 | + }); | ||
178 | + | ||
179 | + NSString *isOpenThirdPay = [payInfo isOpenThirdPay]; | ||
180 | + NSLog(@"custom%@",[payInfo custom]); | ||
181 | + if([isOpenThirdPay isEqualToString:@"false"]){//apply | ||
182 | + NSString* products = [payInfo products]; | ||
183 | + [[[AppleIap alloc] init]applePay:products amount:myamount queryId:queryId]; | ||
184 | + }else{ | ||
185 | + NSLog(@"queryId:%@",queryId); | ||
186 | + NSString* productNo = [[PoolConfig getInstance]getValueByKey:@"productId"]; | ||
187 | + NSString* orderName = [self getProductNameByAmount:[payInfo products] amount:myamount]; | ||
188 | + int amountValue = [myamount intValue] * 100; | ||
189 | + | ||
190 | + [YDTool tool:queryId orderName:orderName userId:[payInfo playerId] productNo:productNo amount:amountValue param:queryId]; | ||
191 | + } | ||
192 | + | ||
193 | + | ||
194 | + int64_t delayInSeconds = 3.0;// 延迟的时间 | ||
195 | + dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); | ||
196 | + dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ | ||
197 | + NSLog(@"chage state"); | ||
198 | + [[PoolChecker getInstance] setOnlyOneTimePay:false]; | ||
199 | + }); | ||
200 | +} | ||
201 | + | ||
202 | + | ||
203 | +-(NSString*)getCurrentTimestamp{ | ||
204 | + // 时间戳转时间 | ||
205 | + NSTimeInterval interval = [[NSDate date] timeIntervalSince1970] * 1000; | ||
206 | + NSString* timeStr = [[NSString alloc]initWithFormat:@"%.f",interval]; | ||
207 | + return timeStr; | ||
208 | +} | ||
209 | + | ||
210 | + | ||
211 | +/** | ||
212 | + *优点SDK回调 | ||
213 | + **/ | ||
214 | +//玩家登陆成功后回调 | ||
215 | +-(void)accountLogin:(YDUserAccount*)model{ | ||
216 | + NSLog(@"login success"); | ||
217 | + PoolLoginInfo *loginInfo = [PoolLoginInfo alloc]; | ||
218 | + loginInfo.openId = [[NSString alloc]initWithFormat:@"%lld",[model accountId]]; | ||
219 | + loginInfo.timestamp = [self getCurrentTimestamp]; | ||
220 | + dispatch_async(dispatch_get_global_queue(0, 0), ^{ | ||
221 | + [[PoolChecker getInstance] startCheck:loginInfo]; | ||
222 | + }); | ||
223 | +} | ||
224 | +//玩家注册成功后回调 | ||
225 | +-(void)accountRegist:(YDUserAccount *)model{ | ||
226 | + NSLog(@"reg success"); | ||
227 | +} | ||
228 | + | ||
229 | +-(void)toolResult:(YDToolStatus)result data:(id)data | ||
230 | +{ | ||
231 | + NSLog(@"youdian pay callback"); | ||
232 | +} | ||
233 | + | ||
234 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// HuiDongLogin.h | ||
3 | +// HuiDongLogin | ||
4 | +// | ||
5 | +// Created by xqwang on 2016/11/7. | ||
6 | +// Copyright © 2016年 xqwang. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | + | ||
11 | +typedef NS_ENUM(NSInteger, WindowType) | ||
12 | +{ | ||
13 | + Dialog = 0, | ||
14 | + Activity | ||
15 | +}; | ||
16 | + | ||
17 | +@interface YDUserAccount : NSObject | ||
18 | + | ||
19 | +//账号ID,账号惟一标识 | ||
20 | +@property(nonatomic, assign)long long accountId; | ||
21 | +//用户名 | ||
22 | +@property(nonatomic, copy)NSString* accountName; | ||
23 | +//用户绑定手机号 | ||
24 | +@property(nonatomic, copy)NSString* phoneNumber; | ||
25 | + | ||
26 | +@end | ||
27 | + | ||
28 | +@protocol YDAccountDelegate <NSObject> | ||
29 | + | ||
30 | +@optional | ||
31 | +-(void)accountLogin:(YDUserAccount*)model; | ||
32 | +-(void)accountRegist:(YDUserAccount*)model; | ||
33 | + | ||
34 | +@end | ||
35 | + | ||
36 | +@interface YDAccount : NSObject | ||
37 | + | ||
38 | ++(void)initWithAppId:(NSString*)appId openKey:(NSString*)openKey; | ||
39 | + | ||
40 | +//该接口不建议调用 | ||
41 | ++(void)login:(NSString*)appId openKey:(NSString*)openKey; | ||
42 | + | ||
43 | ++(void)setWindowType:(WindowType)type; | ||
44 | + | ||
45 | ++(void)autoRatate:(BOOL)enable; | ||
46 | + | ||
47 | ++(void)setDelegate:(id<YDAccountDelegate>)delegate; | ||
48 | + | ||
49 | ++(void)setChannelId:(NSString*)channelId; | ||
50 | + | ||
51 | ++(void)showWindow; | ||
52 | + | ||
53 | +//+(void)login:(YDUserAccount*)account; | ||
54 | + | ||
55 | ++(void)bindGameUserId:(NSString*)userId; | ||
56 | + | ||
57 | ++(void)logout; | ||
58 | + | ||
59 | ++(YDUserAccount*)currentAccount; | ||
60 | + | ||
61 | +@end |

14.8 KB

1.14 KB

1.69 KB

1.59 KB

1.19 KB

1.32 KB

1.14 KB

497 Bytes

4.87 KB

4.87 KB

7.97 KB

1.31 KB

3.26 KB

1.33 KB

1.61 KB

1.36 KB

3.16 KB

1.65 KB

2.05 KB

9.18 KB

33.1 KB

396 Bytes

557 Bytes

588 Bytes

922 Bytes

1.45 KB

2.18 KB

513 Bytes

771 Bytes

524 Bytes

793 Bytes

6.88 KB

10.6 KB

1.72 KB
1 | +// | ||
2 | +// YDTool.h | ||
3 | +// YDTool | ||
4 | +// | ||
5 | +// Created by xqwang on 2016/12/16. | ||
6 | +// Copyright © 2016年 xqwang. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | +#import <UIKit/UIKit.h> | ||
11 | + | ||
12 | +typedef NS_ENUM(NSUInteger, YDToolStatus) | ||
13 | +{ | ||
14 | + YD_FAIL = 0, | ||
15 | + YD_SUCCESS, | ||
16 | + YD_CANCEL, | ||
17 | + YD_UNKNOW, | ||
18 | +}; | ||
19 | + | ||
20 | +@protocol YDToolDelegate <NSObject> | ||
21 | + | ||
22 | +-(void)toolResult:(YDToolStatus)result data:(id)data; | ||
23 | + | ||
24 | +@end | ||
25 | + | ||
26 | +@interface YDTool : NSObject | ||
27 | +/** | ||
28 | + * SDK的初始化接口 | ||
29 | + * @param appId 应用在优点后台申请的支付AppID | ||
30 | + * @param developKey 应用在优点后台申请AppID时生成的developId,用于SDK内部加密数据 | ||
31 | + * | ||
32 | + **/ | ||
33 | ++(void)initWithAppId:(NSString*)appId developKey:(NSString*)developKey; | ||
34 | + | ||
35 | +/** | ||
36 | + * 设置应用的跳转URL,用于支付完成后从支付App跳回应用 | ||
37 | + * @param scheme 应用对应的Url | ||
38 | + * | ||
39 | + **/ | ||
40 | ++(void)setAppScheme:(NSString*)scheme; | ||
41 | + | ||
42 | +/** | ||
43 | + * 设置渠道Id | ||
44 | + **/ | ||
45 | ++(void)setChannelId:(NSString*)channelId; | ||
46 | + | ||
47 | +/** | ||
48 | + * 不定金额的支付接口 | ||
49 | + * @param orderId 订单ID,请开发者确保该ID的惟一性,用于与优点核对数据 | ||
50 | + * @param orderName 订单名称 | ||
51 | + * @param userId 当前支付玩家的账号ID | ||
52 | + * @param producNo 支付的商品在优点后台对应的ID,请确保传入值的正确性 | ||
53 | + * @param amount 本次支付的总金额,单位为分 | ||
54 | + * @param param 支付成功后,优点后台透传给应用服务器的参数 | ||
55 | + **/ | ||
56 | ++(void)tool:(NSString*)orderId orderName:(NSString*)orderName userId:(NSString*)userId | ||
57 | + productNo:(NSString*)productNo amount:(NSUInteger)amount param:(NSString*)param; | ||
58 | + | ||
59 | +/** | ||
60 | + * 定额的支付接口 | ||
61 | + * @param orderId 订单ID,请开发者确保该ID的惟一性,用于与优点核对数据 | ||
62 | + * @param orderName 订单名称 | ||
63 | + * @param userId 当前支付玩家的账号ID | ||
64 | + * @param producNo 支付的商品在优点后台对应的ID,请确保传入值的正确性 | ||
65 | + * @param param 支付成功后,优点后台透传给应用服务器的参数 | ||
66 | + **/ | ||
67 | ++(void)tool:(NSString*)orderId orderName:(NSString*)orderName userId:(NSString*)userId | ||
68 | + productNo:(NSString*)productNo param:(NSString*)param; | ||
69 | + | ||
70 | +/** | ||
71 | + * 支付协议设置接口 | ||
72 | + * | ||
73 | + **/ | ||
74 | ++(void)setDelegate:(id<YDToolDelegate>)delegate; | ||
75 | + | ||
76 | +#if HAS_NATIVE_PAY | ||
77 | +/** | ||
78 | + * 支付完成后返回的生命周期接口,用于判断支付是否成功并回调支付协议,请开发者在AppDelegate的对应接口中调用 | ||
79 | + * | ||
80 | + **/ | ||
81 | ++(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options; | ||
82 | + | ||
83 | ++(void)applicationWillEnterForeground:(UIApplication*)app; | ||
84 | +#endif | ||
85 | + | ||
86 | +@end |
1 | +// | ||
2 | +// IAPHelper.h | ||
3 | +// | ||
4 | +// Original Created by Ray Wenderlich on 2/28/11. | ||
5 | +// Created by saturngod on 7/9/12. | ||
6 | +// Copyright 2011 Ray Wenderlich. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | +#import "StoreKit/StoreKit.h" | ||
11 | + | ||
12 | + | ||
13 | +typedef void (^IAPProductsResponseBlock)(SKProductsRequest* request , SKProductsResponse* response); | ||
14 | + | ||
15 | +typedef void (^IAPbuyProductCompleteResponseBlock)(SKPaymentTransaction* transcation); | ||
16 | + | ||
17 | +typedef void (^checkReceiptCompleteResponseBlock)(NSString* response,NSError* error); | ||
18 | + | ||
19 | +typedef void (^resoreProductsCompleteResponseBlock) (SKPaymentQueue* payment,NSError* error); | ||
20 | + | ||
21 | +@interface IAPHelper : NSObject <SKProductsRequestDelegate, SKPaymentTransactionObserver> | ||
22 | + | ||
23 | +@property (nonatomic,strong) NSSet *productIdentifiers; | ||
24 | +@property (nonatomic,strong) NSArray * products; | ||
25 | +@property (nonatomic,strong) NSMutableSet *purchasedProducts; | ||
26 | +@property (nonatomic,strong) SKProductsRequest *request; | ||
27 | +@property (nonatomic) BOOL production; | ||
28 | + | ||
29 | +//init With Product Identifiers | ||
30 | +- (id)initWithProductIdentifiers:(NSSet *)productIdentifiers; | ||
31 | + | ||
32 | +//get Products List | ||
33 | +- (void)requestProductsWithCompletion:(IAPProductsResponseBlock)completion; | ||
34 | + | ||
35 | + | ||
36 | +//Buy Product | ||
37 | +- (void)buyProduct:(SKProduct *)productIdentifier onCompletion:(IAPbuyProductCompleteResponseBlock)completion; | ||
38 | + | ||
39 | +//restore Products | ||
40 | +- (void)restoreProductsWithCompletion:(resoreProductsCompleteResponseBlock)completion; | ||
41 | + | ||
42 | +//check isPurchased or not | ||
43 | +- (BOOL)isPurchasedProductsIdentifier:(NSString*)productID; | ||
44 | + | ||
45 | +//check receipt but recommend to use in server side instead of using this function | ||
46 | +- (void)checkReceipt:(NSData*)receiptData onCompletion:(checkReceiptCompleteResponseBlock)completion; | ||
47 | + | ||
48 | +- (void)checkReceipt:(NSData*)receiptData AndSharedSecret:(NSString*)secretKey onCompletion:(checkReceiptCompleteResponseBlock)completion; | ||
49 | + | ||
50 | + | ||
51 | +//saved purchased product | ||
52 | +- (void)provideContentWithTransaction:(SKPaymentTransaction *)transaction; | ||
53 | + | ||
54 | +- (void)provideContent:(NSString *)productIdentifier __deprecated_msg("use provideContentWithTransaction: instead."); | ||
55 | + | ||
56 | +//clear the saved products | ||
57 | +- (void)clearSavedPurchasedProducts; | ||
58 | +- (void)clearSavedPurchasedProductByID:(NSString*)productIdentifier; | ||
59 | + | ||
60 | + | ||
61 | +//Get The Price with local currency | ||
62 | +- (NSString *)getLocalePrice:(SKProduct *)product; | ||
63 | + | ||
64 | +@end |
1 | +// | ||
2 | +// IAPHelper.m | ||
3 | +// | ||
4 | +// Original Created by Ray Wenderlich on 2/28/11. | ||
5 | +// Created by saturngod on 7/9/12. | ||
6 | +// Copyright 2011 Ray Wenderlich. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import "IAPHelper.h" | ||
10 | +#import "NSString+Base64.h" | ||
11 | +#import "SFHFKeychainUtils.h" | ||
12 | + | ||
13 | +#if ! __has_feature(objc_arc) | ||
14 | +#error You need to either convert your project to ARC or add the -fobjc-arc compiler flag to IAPHelper.m. | ||
15 | +#endif | ||
16 | + | ||
17 | + | ||
18 | +@interface IAPHelper() | ||
19 | +@property (nonatomic,copy) IAPProductsResponseBlock requestProductsBlock; | ||
20 | +@property (nonatomic,copy) IAPbuyProductCompleteResponseBlock buyProductCompleteBlock; | ||
21 | +@property (nonatomic,copy) resoreProductsCompleteResponseBlock restoreCompletedBlock; | ||
22 | +@property (nonatomic,copy) checkReceiptCompleteResponseBlock checkReceiptCompleteBlock; | ||
23 | + | ||
24 | +@property (nonatomic,strong) NSMutableData* receiptRequestData; | ||
25 | +@end | ||
26 | + | ||
27 | +@implementation IAPHelper | ||
28 | + | ||
29 | +- (id)initWithProductIdentifiers:(NSSet *)productIdentifiers { | ||
30 | + if ((self = [super init])) { | ||
31 | + | ||
32 | + // Store product identifiers | ||
33 | + _productIdentifiers = productIdentifiers; | ||
34 | + | ||
35 | + // Check for previously purchased products | ||
36 | + NSMutableSet * purchasedProducts = [NSMutableSet set]; | ||
37 | + for (NSString * productIdentifier in _productIdentifiers) { | ||
38 | + | ||
39 | + BOOL productPurchased = NO; | ||
40 | + | ||
41 | + NSString* password = [SFHFKeychainUtils getPasswordForUsername:productIdentifier andServiceName:@"IAPHelper" error:nil]; | ||
42 | + if([password isEqualToString:@"YES"]) | ||
43 | + { | ||
44 | + productPurchased = YES; | ||
45 | + } | ||
46 | + | ||
47 | + if (productPurchased) { | ||
48 | + [purchasedProducts addObject:productIdentifier]; | ||
49 | + } | ||
50 | + } | ||
51 | + if ([SKPaymentQueue defaultQueue]) { | ||
52 | + [[SKPaymentQueue defaultQueue] addTransactionObserver:self]; | ||
53 | + | ||
54 | + self.purchasedProducts = purchasedProducts; | ||
55 | + } | ||
56 | + | ||
57 | + } | ||
58 | + return self; | ||
59 | +} | ||
60 | + | ||
61 | +- (void)dealloc | ||
62 | +{ | ||
63 | + if ([SKPaymentQueue defaultQueue]) { | ||
64 | + [[SKPaymentQueue defaultQueue] removeTransactionObserver:self]; | ||
65 | + } | ||
66 | +} | ||
67 | + | ||
68 | +-(BOOL)isPurchasedProductsIdentifier:(NSString*)productID | ||
69 | +{ | ||
70 | + | ||
71 | + BOOL productPurchased = NO; | ||
72 | + | ||
73 | + NSString* password = [SFHFKeychainUtils getPasswordForUsername:productID andServiceName:@"IAPHelper" error:nil]; | ||
74 | + if([password isEqualToString:@"YES"]) | ||
75 | + { | ||
76 | + productPurchased = YES; | ||
77 | + } | ||
78 | + | ||
79 | + return productPurchased; | ||
80 | +} | ||
81 | + | ||
82 | +- (void)requestProductsWithCompletion:(IAPProductsResponseBlock)completion { | ||
83 | + | ||
84 | + self.request = [[SKProductsRequest alloc] initWithProductIdentifiers:_productIdentifiers]; | ||
85 | + _request.delegate = self; | ||
86 | + self.requestProductsBlock = completion; | ||
87 | + | ||
88 | + [_request start]; | ||
89 | + | ||
90 | +} | ||
91 | + | ||
92 | +- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response { | ||
93 | + | ||
94 | + self.products = response.products; | ||
95 | + self.request = nil; | ||
96 | + | ||
97 | + if(_requestProductsBlock) { | ||
98 | + _requestProductsBlock (request,response); | ||
99 | + } | ||
100 | +} | ||
101 | + | ||
102 | +- (void)recordTransaction:(SKPaymentTransaction *)transaction { | ||
103 | + // TODO: Record the transaction on the server side... | ||
104 | +} | ||
105 | + | ||
106 | + | ||
107 | +- (void)provideContentWithTransaction:(SKPaymentTransaction *)transaction { | ||
108 | + | ||
109 | + NSString* productIdentifier = @""; | ||
110 | + | ||
111 | + if (transaction.originalTransaction) { | ||
112 | + productIdentifier = transaction.originalTransaction.payment.productIdentifier; | ||
113 | + } | ||
114 | + else { | ||
115 | + productIdentifier = transaction.payment.productIdentifier; | ||
116 | + } | ||
117 | + | ||
118 | + //check productIdentifier exist or not | ||
119 | + //it can be possible nil | ||
120 | + if (productIdentifier) { | ||
121 | + [SFHFKeychainUtils storeUsername:productIdentifier andPassword:@"YES" forServiceName:@"IAPHelper" updateExisting:YES error:nil]; | ||
122 | + [_purchasedProducts addObject:productIdentifier]; | ||
123 | + } | ||
124 | +} | ||
125 | + | ||
126 | +- (void)provideContent:(NSString *)productIdentifier { | ||
127 | + | ||
128 | + [SFHFKeychainUtils storeUsername:productIdentifier andPassword:@"YES" forServiceName:@"IAPHelper" updateExisting:YES error:nil]; | ||
129 | + | ||
130 | + [_purchasedProducts addObject:productIdentifier]; | ||
131 | + | ||
132 | + | ||
133 | +} | ||
134 | + | ||
135 | +- (void)clearSavedPurchasedProducts { | ||
136 | + | ||
137 | + for (NSString * productIdentifier in _productIdentifiers) { | ||
138 | + [self clearSavedPurchasedProductByID:productIdentifier]; | ||
139 | + } | ||
140 | + | ||
141 | +} | ||
142 | +- (void)clearSavedPurchasedProductByID:(NSString*)productIdentifier { | ||
143 | + | ||
144 | + [SFHFKeychainUtils deleteItemForUsername:productIdentifier andServiceName:@"IAPHelper" error:nil]; | ||
145 | + [_purchasedProducts removeObject:productIdentifier]; | ||
146 | + | ||
147 | +} | ||
148 | + | ||
149 | + | ||
150 | +- (void)completeTransaction:(SKPaymentTransaction *)transaction { | ||
151 | + | ||
152 | + | ||
153 | + | ||
154 | + [self recordTransaction: transaction]; | ||
155 | + | ||
156 | + if ([SKPaymentQueue defaultQueue]) { | ||
157 | + [[SKPaymentQueue defaultQueue] finishTransaction: transaction]; | ||
158 | + } | ||
159 | + | ||
160 | + if(_buyProductCompleteBlock) | ||
161 | + { | ||
162 | + _buyProductCompleteBlock(transaction); | ||
163 | + } | ||
164 | + | ||
165 | +} | ||
166 | + | ||
167 | +- (void)restoreTransaction:(SKPaymentTransaction *)transaction { | ||
168 | + | ||
169 | + | ||
170 | + [self recordTransaction: transaction]; | ||
171 | + [self provideContentWithTransaction:transaction]; | ||
172 | + | ||
173 | + if ([SKPaymentQueue defaultQueue]) { | ||
174 | + [[SKPaymentQueue defaultQueue] finishTransaction: transaction]; | ||
175 | + | ||
176 | + | ||
177 | + if(_buyProductCompleteBlock!=nil) | ||
178 | + { | ||
179 | + _buyProductCompleteBlock(transaction); | ||
180 | + } | ||
181 | + } | ||
182 | + | ||
183 | +} | ||
184 | + | ||
185 | +- (void)failedTransaction:(SKPaymentTransaction *)transaction { | ||
186 | + | ||
187 | + if (transaction.error.code != SKErrorPaymentCancelled) | ||
188 | + { | ||
189 | + NSLog(@"Transaction error: %@ %ld", transaction.error.localizedDescription,(long)transaction.error.code); | ||
190 | + } | ||
191 | + | ||
192 | + if ([SKPaymentQueue defaultQueue]) { | ||
193 | + [[SKPaymentQueue defaultQueue] finishTransaction: transaction]; | ||
194 | + if(_buyProductCompleteBlock) { | ||
195 | + _buyProductCompleteBlock(transaction); | ||
196 | + } | ||
197 | + } | ||
198 | + | ||
199 | +} | ||
200 | + | ||
201 | +- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions | ||
202 | +{ | ||
203 | + | ||
204 | + | ||
205 | + for (SKPaymentTransaction *transaction in transactions) | ||
206 | + { | ||
207 | + switch (transaction.transactionState) | ||
208 | + { | ||
209 | + case SKPaymentTransactionStatePurchased: | ||
210 | + [self completeTransaction:transaction]; | ||
211 | + break; | ||
212 | + case SKPaymentTransactionStateFailed: | ||
213 | + [self failedTransaction:transaction]; | ||
214 | + break; | ||
215 | + case SKPaymentTransactionStateRestored: | ||
216 | + [self restoreTransaction:transaction]; | ||
217 | + default: | ||
218 | + break; | ||
219 | + } | ||
220 | + } | ||
221 | +} | ||
222 | + | ||
223 | +- (void)buyProduct:(SKProduct *)productIdentifier onCompletion:(IAPbuyProductCompleteResponseBlock)completion { | ||
224 | + | ||
225 | + self.buyProductCompleteBlock = completion; | ||
226 | + | ||
227 | + self.restoreCompletedBlock = nil; | ||
228 | + SKPayment *payment = [SKPayment paymentWithProduct:productIdentifier]; | ||
229 | + | ||
230 | + if ([SKPaymentQueue defaultQueue]) { | ||
231 | + [[SKPaymentQueue defaultQueue] addPayment:payment]; | ||
232 | + } | ||
233 | + | ||
234 | +} | ||
235 | + | ||
236 | +-(void)restoreProductsWithCompletion:(resoreProductsCompleteResponseBlock)completion { | ||
237 | + | ||
238 | + //clear it | ||
239 | + self.buyProductCompleteBlock = nil; | ||
240 | + | ||
241 | + self.restoreCompletedBlock = completion; | ||
242 | + if ([SKPaymentQueue defaultQueue]) { | ||
243 | + [[SKPaymentQueue defaultQueue] restoreCompletedTransactions]; | ||
244 | + } | ||
245 | + else { | ||
246 | + NSLog(@"Cannot get the default Queue"); | ||
247 | + } | ||
248 | + | ||
249 | + | ||
250 | +} | ||
251 | + | ||
252 | +- (void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error { | ||
253 | + | ||
254 | + NSLog(@"Transaction error: %@ %ld", error.localizedDescription,(long)error.code); | ||
255 | + if(_restoreCompletedBlock) { | ||
256 | + _restoreCompletedBlock(queue,error); | ||
257 | + } | ||
258 | +} | ||
259 | + | ||
260 | +- (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue { | ||
261 | + | ||
262 | + for (SKPaymentTransaction *transaction in queue.transactions) | ||
263 | + { | ||
264 | + switch (transaction.transactionState) | ||
265 | + { | ||
266 | + case SKPaymentTransactionStateRestored: | ||
267 | + { | ||
268 | + [self recordTransaction: transaction]; | ||
269 | + [self provideContentWithTransaction:transaction]; | ||
270 | + | ||
271 | + } | ||
272 | + default: | ||
273 | + break; | ||
274 | + } | ||
275 | + } | ||
276 | + | ||
277 | + if(_restoreCompletedBlock) { | ||
278 | + _restoreCompletedBlock(queue,nil); | ||
279 | + } | ||
280 | + | ||
281 | +} | ||
282 | + | ||
283 | +- (void)checkReceipt:(NSData*)receiptData onCompletion:(checkReceiptCompleteResponseBlock)completion | ||
284 | +{ | ||
285 | + [self checkReceipt:receiptData AndSharedSecret:nil onCompletion:completion]; | ||
286 | +} | ||
287 | +- (void)checkReceipt:(NSData*)receiptData AndSharedSecret:(NSString*)secretKey onCompletion:(checkReceiptCompleteResponseBlock)completion | ||
288 | +{ | ||
289 | + | ||
290 | + self.checkReceiptCompleteBlock = completion; | ||
291 | + | ||
292 | + NSError *jsonError = nil; | ||
293 | + NSString *receiptBase64 = [NSString base64StringFromData:receiptData length:[receiptData length]]; | ||
294 | + | ||
295 | + | ||
296 | + NSData *jsonData = nil; | ||
297 | + | ||
298 | + if(secretKey !=nil && ![secretKey isEqualToString:@""]) { | ||
299 | + | ||
300 | + jsonData = [NSJSONSerialization dataWithJSONObject:[NSDictionary dictionaryWithObjectsAndKeys:receiptBase64,@"receipt-data", | ||
301 | + secretKey,@"password", | ||
302 | + nil] | ||
303 | + options:NSJSONWritingPrettyPrinted | ||
304 | + error:&jsonError]; | ||
305 | + | ||
306 | + } | ||
307 | + else { | ||
308 | + jsonData = [NSJSONSerialization dataWithJSONObject:[NSDictionary dictionaryWithObjectsAndKeys: | ||
309 | + receiptBase64,@"receipt-data", | ||
310 | + nil] | ||
311 | + options:NSJSONWritingPrettyPrinted | ||
312 | + error:&jsonError | ||
313 | + ]; | ||
314 | + } | ||
315 | + | ||
316 | + | ||
317 | +// NSString* jsonStr = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; | ||
318 | + | ||
319 | + NSURL *requestURL = nil; | ||
320 | + if(_production) | ||
321 | + { | ||
322 | + requestURL = [NSURL URLWithString:@"https://buy.itunes.apple.com/verifyReceipt"]; | ||
323 | + } | ||
324 | + else { | ||
325 | + requestURL = [NSURL URLWithString:@"https://sandbox.itunes.apple.com/verifyReceipt"]; | ||
326 | + } | ||
327 | + | ||
328 | + NSMutableURLRequest *req = [[NSMutableURLRequest alloc] initWithURL:requestURL]; | ||
329 | + [req setHTTPMethod:@"POST"]; | ||
330 | + [req setHTTPBody:jsonData]; | ||
331 | + | ||
332 | + NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:req delegate:self]; | ||
333 | + if(conn) { | ||
334 | + self.receiptRequestData = [[NSMutableData alloc] init]; | ||
335 | + } else { | ||
336 | + NSError* error = nil; | ||
337 | + NSMutableDictionary* errorDetail = [[NSMutableDictionary alloc] init]; | ||
338 | + [errorDetail setValue:@"Can't create connection" forKey:NSLocalizedDescriptionKey]; | ||
339 | + error = [NSError errorWithDomain:@"IAPHelperError" code:100 userInfo:errorDetail]; | ||
340 | + if(_checkReceiptCompleteBlock) { | ||
341 | + _checkReceiptCompleteBlock(nil,error); | ||
342 | + } | ||
343 | + } | ||
344 | +} | ||
345 | + | ||
346 | +-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { | ||
347 | + NSLog(@"Cannot transmit receipt data. %@",[error localizedDescription]); | ||
348 | + | ||
349 | + if(_checkReceiptCompleteBlock) { | ||
350 | + _checkReceiptCompleteBlock(nil,error); | ||
351 | + } | ||
352 | + | ||
353 | +} | ||
354 | + | ||
355 | +-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { | ||
356 | + [self.receiptRequestData setLength:0]; | ||
357 | +} | ||
358 | + | ||
359 | +-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { | ||
360 | + [self.receiptRequestData appendData:data]; | ||
361 | +} | ||
362 | + | ||
363 | +-(void)connectionDidFinishLoading:(NSURLConnection *)connection { | ||
364 | + NSString *response = [[NSString alloc] initWithData:self.receiptRequestData encoding:NSUTF8StringEncoding]; | ||
365 | + | ||
366 | + if(_checkReceiptCompleteBlock) { | ||
367 | + _checkReceiptCompleteBlock(response,nil); | ||
368 | + } | ||
369 | +} | ||
370 | + | ||
371 | + | ||
372 | +- (NSString *)getLocalePrice:(SKProduct *)product { | ||
373 | + if (product) { | ||
374 | + NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; | ||
375 | + [formatter setFormatterBehavior:NSNumberFormatterBehavior10_4]; | ||
376 | + [formatter setNumberStyle:NSNumberFormatterCurrencyStyle]; | ||
377 | + [formatter setLocale:product.priceLocale]; | ||
378 | + | ||
379 | + return [formatter stringFromNumber:product.price]; | ||
380 | + } | ||
381 | + return @""; | ||
382 | + | ||
383 | + | ||
384 | +} | ||
385 | +@end |
1 | +// | ||
2 | +// IAPShare.h | ||
3 | +// ; | ||
4 | +// | ||
5 | +// Created by Htain Lin Shwe on 10/7/12. | ||
6 | +// Copyright (c) 2012 Edenpod. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | +#import "IAPHelper.h" | ||
11 | +@interface IAPShare : NSObject | ||
12 | +@property (nonatomic,strong) IAPHelper *iap; | ||
13 | + | ||
14 | ++ (IAPShare *) sharedHelper; | ||
15 | + | ||
16 | ++(id)toJSON:(NSString*)json; | ||
17 | +@end |
1 | +// | ||
2 | +// IAPShare.m | ||
3 | +// inappPurchasesTest | ||
4 | +// | ||
5 | +// Created by Htain Lin Shwe on 10/7/12. | ||
6 | +// Copyright (c) 2012 Edenpod. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import "IAPShare.h" | ||
10 | + | ||
11 | +#if ! __has_feature(objc_arc) | ||
12 | +#error You need to either convert your project to ARC or add the -fobjc-arc compiler flag to IAPShare.m. | ||
13 | +#endif | ||
14 | + | ||
15 | +@implementation IAPShare | ||
16 | +@synthesize iap= _iap; | ||
17 | + | ||
18 | ++ (IAPShare *) sharedHelper { | ||
19 | + static IAPShare * _sharedHelper = nil; | ||
20 | + static dispatch_once_t onceToken; | ||
21 | + dispatch_once(&onceToken, ^{ | ||
22 | + _sharedHelper = [[IAPShare alloc] init]; | ||
23 | + _sharedHelper.iap = nil; | ||
24 | + }); | ||
25 | + return _sharedHelper; | ||
26 | +} | ||
27 | + | ||
28 | ++(id)toJSON:(NSString *)json | ||
29 | +{ | ||
30 | + NSError* e = nil; | ||
31 | + id jsonObject = [NSJSONSerialization JSONObjectWithData: [json dataUsingEncoding:NSUTF8StringEncoding] | ||
32 | + options: NSJSONReadingMutableContainers | ||
33 | + error: &e]; | ||
34 | + | ||
35 | + if(e==nil) { | ||
36 | + return jsonObject; | ||
37 | + } | ||
38 | + else { | ||
39 | + NSLog(@"%@",[e localizedDescription]); | ||
40 | + return nil; | ||
41 | + } | ||
42 | + | ||
43 | +} | ||
44 | + | ||
45 | +@end |
1 | +// | ||
2 | +// NSString+Base64.h | ||
3 | +// Newsstand | ||
4 | +// | ||
5 | +// Created by Carlo Vigiani on 29/Oct/11. | ||
6 | +// Copyright (c) 2011 viggiosoft. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | + | ||
11 | +@interface NSString (Base64) | ||
12 | + | ||
13 | ++ (NSString *) base64StringFromData:(NSData *)data length:(long)length; | ||
14 | + | ||
15 | +@end |
1 | +// | ||
2 | +// NSString+Base64.m | ||
3 | +// Newsstand | ||
4 | +// | ||
5 | +// Created by Carlo Vigiani on 29/Oct/11. | ||
6 | +// Copyright (c) 2011 viggiosoft. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import "NSString+Base64.h" | ||
10 | + | ||
11 | +static char base64EncodingTable[64] = { | ||
12 | + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', | ||
13 | + 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', | ||
14 | + 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', | ||
15 | + 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' | ||
16 | +}; | ||
17 | + | ||
18 | +@implementation NSString (Base64) | ||
19 | + | ||
20 | + | ||
21 | ++ (NSString *) base64StringFromData:(NSData *)data length:(long)length { | ||
22 | + unsigned long ixtext, lentext; | ||
23 | + long ctremaining; | ||
24 | + unsigned char input[3], output[4]; | ||
25 | + short i, charsonline = 0, ctcopy; | ||
26 | + const unsigned char *raw; | ||
27 | + NSMutableString *result; | ||
28 | + | ||
29 | + lentext = [data length]; | ||
30 | + if (lentext < 1) | ||
31 | + return @""; | ||
32 | + result = [NSMutableString stringWithCapacity: lentext]; | ||
33 | + raw = [data bytes]; | ||
34 | + ixtext = 0; | ||
35 | + | ||
36 | + while (true) { | ||
37 | + ctremaining = lentext - ixtext; | ||
38 | + if (ctremaining <= 0) | ||
39 | + break; | ||
40 | + for (i = 0; i < 3; i++) { | ||
41 | + unsigned long ix = ixtext + i; | ||
42 | + if (ix < lentext) | ||
43 | + input[i] = raw[ix]; | ||
44 | + else | ||
45 | + input[i] = 0; | ||
46 | + } | ||
47 | + output[0] = (input[0] & 0xFC) >> 2; | ||
48 | + output[1] = ((input[0] & 0x03) << 4) | ((input[1] & 0xF0) >> 4); | ||
49 | + output[2] = ((input[1] & 0x0F) << 2) | ((input[2] & 0xC0) >> 6); | ||
50 | + output[3] = input[2] & 0x3F; | ||
51 | + ctcopy = 4; | ||
52 | + switch (ctremaining) { | ||
53 | + case 1: | ||
54 | + ctcopy = 2; | ||
55 | + break; | ||
56 | + case 2: | ||
57 | + ctcopy = 3; | ||
58 | + break; | ||
59 | + } | ||
60 | + | ||
61 | + for (i = 0; i < ctcopy; i++) | ||
62 | + [result appendString: [NSString stringWithFormat: @"%c", base64EncodingTable[output[i]]]]; | ||
63 | + | ||
64 | + for (i = ctcopy; i < 4; i++) | ||
65 | + [result appendString: @"="]; | ||
66 | + | ||
67 | + ixtext += 3; | ||
68 | + charsonline += 4; | ||
69 | + | ||
70 | + if ((length > 0) && (charsonline >= length)) | ||
71 | + charsonline = 0; | ||
72 | + } | ||
73 | + return result; | ||
74 | +} | ||
75 | + | ||
76 | + | ||
77 | +@end |
1 | +// | ||
2 | +// SFHFKeychainUtils.h | ||
3 | +// | ||
4 | +// Created by Buzz Andersen on 10/20/08. | ||
5 | +// Based partly on code by Jonathan Wight, Jon Crosby, and Mike Malone. | ||
6 | +// Copyright 2008 Sci-Fi Hi-Fi. All rights reserved. | ||
7 | +// | ||
8 | +// Permission is hereby granted, free of charge, to any person | ||
9 | +// obtaining a copy of this software and associated documentation | ||
10 | +// files (the "Software"), to deal in the Software without | ||
11 | +// restriction, including without limitation the rights to use, | ||
12 | +// copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
13 | +// copies of the Software, and to permit persons to whom the | ||
14 | +// Software is furnished to do so, subject to the following | ||
15 | +// conditions: | ||
16 | +// | ||
17 | +// The above copyright notice and this permission notice shall be | ||
18 | +// included in all copies or substantial portions of the Software. | ||
19 | +// | ||
20 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
21 | +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
22 | +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
23 | +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
24 | +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
25 | +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
26 | +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
27 | +// OTHER DEALINGS IN THE SOFTWARE. | ||
28 | +// | ||
29 | + | ||
30 | +#import <UIKit/UIKit.h> | ||
31 | + | ||
32 | + | ||
33 | +@interface SFHFKeychainUtils : NSObject { | ||
34 | + | ||
35 | +} | ||
36 | + | ||
37 | ++ (NSString *) getPasswordForUsername: (NSString *) username andServiceName: (NSString *) serviceName error: (NSError **) error; | ||
38 | ++ (BOOL) storeUsername: (NSString *) username andPassword: (NSString *) password forServiceName: (NSString *) serviceName updateExisting: (BOOL) updateExisting error: (NSError **) error; | ||
39 | ++ (BOOL) deleteItemForUsername: (NSString *) username andServiceName: (NSString *) serviceName error: (NSError **) error; | ||
40 | + | ||
41 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// SFHFKeychainUtils.m | ||
3 | +// | ||
4 | + | ||
5 | +// Created by Buzz Andersen on 10/20/08. | ||
6 | +// Based partly on code by Jonathan Wight, Jon Crosby, and Mike Malone. | ||
7 | +// Copyright 2008 Sci-Fi Hi-Fi. All rights reserved. | ||
8 | +// | ||
9 | + | ||
10 | +// Permission is hereby granted, free of charge, to any person | ||
11 | +// obtaining a copy of this software and associated documentation | ||
12 | +// files (the "Software"), to deal in the Software without | ||
13 | +// restriction, including without limitation the rights to use, | ||
14 | +// copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
15 | +// copies of the Software, and to permit persons to whom the | ||
16 | +// Software is furnished to do so, subject to the following | ||
17 | +// conditions: | ||
18 | +// | ||
19 | + | ||
20 | +// The above copyright notice and this permission notice shall be | ||
21 | +// included in all copies or substantial portions of the Software. | ||
22 | +// | ||
23 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
24 | +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
25 | +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
26 | +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
27 | +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
28 | +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
29 | +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
30 | +// OTHER DEALINGS IN THE SOFTWARE. | ||
31 | +// | ||
32 | + | ||
33 | +#import "SFHFKeychainUtils.h" | ||
34 | +#import <Security/Security.h> | ||
35 | + | ||
36 | + | ||
37 | +static NSString *SFHFKeychainUtilsErrorDomain = @"SFHFKeychainUtilsErrorDomain"; | ||
38 | + | ||
39 | +#if __IPHONE_OS_VERSION_MIN_REQUIRED < 30000 && TARGET_IPHONE_SIMULATOR | ||
40 | + | ||
41 | +@interface SFHFKeychainUtils (PrivateMethods) | ||
42 | +(SecKeychainItemRef) getKeychainItemReferenceForUsername: (NSString *) username andServiceName: (NSString *) serviceName error: (NSError **) error; | ||
43 | +@end | ||
44 | + | ||
45 | +#endif | ||
46 | + | ||
47 | +@implementation SFHFKeychainUtils | ||
48 | + | ||
49 | +#if __IPHONE_OS_VERSION_MIN_REQUIRED < 30000 && TARGET_IPHONE_SIMULATOR | ||
50 | + | ||
51 | ++(NSString *) getPasswordForUsername: (NSString *) username andServiceName: (NSString *) serviceName error: (NSError **) error { | ||
52 | + if (!username || !serviceName) { | ||
53 | + *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: -2000 userInfo: nil]; | ||
54 | + return nil; | ||
55 | + } | ||
56 | + | ||
57 | + SecKeychainItemRef item = [SFHFKeychainUtils getKeychainItemReferenceForUsername: username andServiceName: serviceName error: error]; | ||
58 | + if (*error || !item) { | ||
59 | + return nil; | ||
60 | + } | ||
61 | + | ||
62 | + // from Advanced Mac OS X Programming, ch. 16 | ||
63 | + UInt32 length; | ||
64 | + char *password; | ||
65 | + SecKeychainAttribute attributes[8]; | ||
66 | + SecKeychainAttributeList list; | ||
67 | + attributes[0].tag = kSecAccountItemAttr; | ||
68 | + attributes[1].tag = kSecDescriptionItemAttr; | ||
69 | + attributes[2].tag = kSecLabelItemAttr; | ||
70 | + attributes[3].tag = kSecModDateItemAttr; | ||
71 | + list.count = 4; | ||
72 | + list.attr = attributes; | ||
73 | + OSStatus status = SecKeychainItemCopyContent(item, NULL, &list, &length, (void **)&password); | ||
74 | + if (status != noErr) { | ||
75 | + *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: status userInfo: nil]; | ||
76 | + return nil; | ||
77 | + } | ||
78 | + NSString *passwordString = nil; | ||
79 | + if (password != NULL) { | ||
80 | + char passwordBuffer[1024]; | ||
81 | + if (length > 1023) { | ||
82 | + length = 1023; | ||
83 | + } | ||
84 | + strncpy(passwordBuffer, password, length); | ||
85 | + passwordBuffer[length] = '\0'; | ||
86 | + passwordString = [NSString stringWithCString:passwordBuffer]; | ||
87 | + } | ||
88 | + SecKeychainItemFreeContent(&list, password); | ||
89 | + CFRelease(item); | ||
90 | + return passwordString; | ||
91 | +} | ||
92 | + | ||
93 | ++ (void) storeUsername: (NSString *) username andPassword: (NSString *) password forServiceName: (NSString *) serviceName updateExisting: (BOOL) updateExisting error: (NSError **) error { | ||
94 | + | ||
95 | + if (!username || !password || !serviceName) { | ||
96 | + *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: -2000 userInfo: nil]; | ||
97 | + return; | ||
98 | + } | ||
99 | + OSStatus status = noErr; | ||
100 | + SecKeychainItemRef item = [SFHFKeychainUtils getKeychainItemReferenceForUsername: username andServiceName: serviceName error: error]; | ||
101 | + if (*error && [*error code] != noErr) { | ||
102 | + return; | ||
103 | + } | ||
104 | + *error = nil; | ||
105 | + | ||
106 | + if (item) { | ||
107 | + status = SecKeychainItemModifyAttributesAndData(item,NULL,strlen([password UTF8String]),[password UTF8String]); | ||
108 | + CFRelease(item); | ||
109 | + } | ||
110 | + else { | ||
111 | + status = SecKeychainAddGenericPassword(NULL,strlen([serviceName UTF8String]),[serviceName UTF8String],strlen([username UTF8String]),[username UTF8String],strlen([password UTF8String]),[password UTF8String],NULL); | ||
112 | + | ||
113 | + } | ||
114 | + if (status != noErr) { | ||
115 | + *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: status userInfo: nil]; | ||
116 | + } | ||
117 | +} | ||
118 | + | ||
119 | ++ (void) deleteItemForUsername: (NSString *) username andServiceName: (NSString *) serviceName error: (NSError **) error { | ||
120 | + if (!username || !serviceName) { | ||
121 | + *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: 2000 userInfo: nil]; | ||
122 | + return; | ||
123 | + } | ||
124 | + | ||
125 | + *error = nil; | ||
126 | + | ||
127 | + SecKeychainItemRef item = [SFHFKeychainUtils getKeychainItemReferenceForUsername: username andServiceName: serviceName error: error]; | ||
128 | + if (*error && [*error code] != noErr) { | ||
129 | + return; | ||
130 | + } | ||
131 | + | ||
132 | + OSStatus status; | ||
133 | + if (item) { | ||
134 | + status = SecKeychainItemDelete(item); | ||
135 | + CFRelease(item); | ||
136 | + } | ||
137 | + | ||
138 | + if (status != noErr) { | ||
139 | + *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: status userInfo: nil]; | ||
140 | + } | ||
141 | +} | ||
142 | + | ||
143 | ++ (SecKeychainItemRef) getKeychainItemReferenceForUsername: (NSString *) username andServiceName: (NSString *) serviceName error: (NSError **) error { | ||
144 | + if (!username || !serviceName) { | ||
145 | + *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: -2000 userInfo: nil]; | ||
146 | + return nil; | ||
147 | + } | ||
148 | + | ||
149 | + *error = nil; | ||
150 | + SecKeychainItemRef item; | ||
151 | + OSStatus status = SecKeychainFindGenericPassword(NULL,strlen([serviceName UTF8String]),[serviceName UTF8String],strlen([username UTF8String]),[username UTF8String], NULL,NULL,&item); | ||
152 | + | ||
153 | + if (status != noErr) { | ||
154 | + if (status != errSecItemNotFound) { | ||
155 | + *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: status userInfo: nil]; | ||
156 | + } | ||
157 | + return nil; | ||
158 | + } | ||
159 | + return item; | ||
160 | +} | ||
161 | + | ||
162 | +#else | ||
163 | + | ||
164 | ++ (NSString *) getPasswordForUsername: (NSString *) username andServiceName: (NSString *) serviceName error: (NSError **) error { | ||
165 | + | ||
166 | + if (!username || !serviceName) { | ||
167 | + if (error != nil) { | ||
168 | + *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: -2000 userInfo: nil]; | ||
169 | + } | ||
170 | + return nil; | ||
171 | + } | ||
172 | + | ||
173 | + if (error != nil) { | ||
174 | + *error = nil; | ||
175 | + } | ||
176 | + // Set up a query dictionary with the base query attributes: item type (generic), username, and service | ||
177 | + NSArray *keys = [[NSArray alloc] initWithObjects: (__bridge_transfer NSString *) kSecClass, kSecAttrAccount, kSecAttrService, nil]; | ||
178 | + NSArray *objects = [[NSArray alloc] initWithObjects: (__bridge_transfer NSString *) kSecClassGenericPassword, username, serviceName, nil]; | ||
179 | + NSMutableDictionary *query = [[NSMutableDictionary alloc] initWithObjects: objects forKeys: keys]; | ||
180 | + // First do a query for attributes, in case we already have a Keychain item with no password data set. | ||
181 | + // One likely way such an incorrect item could have come about is due to the previous (incorrect) | ||
182 | + // version of this code (which set the password as a generic attribute instead of password data). | ||
183 | + NSMutableDictionary *attributeQuery = [query mutableCopy]; | ||
184 | + [attributeQuery setObject: (id) kCFBooleanTrue forKey:(__bridge_transfer id) kSecReturnAttributes]; | ||
185 | + CFTypeRef attrResult = NULL; | ||
186 | + OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef) attributeQuery, &attrResult); | ||
187 | + //NSDictionary *attributeResult = (__bridge_transfer NSDictionary *)attrResult; | ||
188 | + if (status != noErr) { | ||
189 | + // No existing item found--simply return nil for the password | ||
190 | + if (error != nil && status != errSecItemNotFound) { | ||
191 | + //Only return an error if a real exception happened--not simply for "not found." | ||
192 | + *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: status userInfo: nil]; | ||
193 | + } | ||
194 | + return nil; | ||
195 | + } | ||
196 | + | ||
197 | + // We have an existing item, now query for the password data associated with it. | ||
198 | + NSMutableDictionary *passwordQuery = [query mutableCopy]; | ||
199 | + [passwordQuery setObject: (id) kCFBooleanTrue forKey: (__bridge_transfer id) kSecReturnData]; | ||
200 | + CFTypeRef resData = NULL; | ||
201 | + status = SecItemCopyMatching((__bridge CFDictionaryRef) passwordQuery, (CFTypeRef *) &resData); | ||
202 | + NSData *resultData = (__bridge_transfer NSData *)resData; | ||
203 | + if (status != noErr) { | ||
204 | + if (status == errSecItemNotFound) { | ||
205 | + // We found attributes for the item previously, but no password now, so return a special error. | ||
206 | + // Users of this API will probably want to detect this error and prompt the user to | ||
207 | + // re-enter their credentials. When you attempt to store the re-entered credentials | ||
208 | + // using storeUsername:andPassword:forServiceName:updateExisting:error | ||
209 | + // the old, incorrect entry will be deleted and a new one with a properly encrypted | ||
210 | + // password will be added. | ||
211 | + | ||
212 | + if (error != nil) { | ||
213 | + *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: -1999 userInfo: nil]; | ||
214 | + } | ||
215 | + } | ||
216 | + else { | ||
217 | + // Something else went wrong. Simply return the normal Keychain API error code. | ||
218 | + if (error != nil) { | ||
219 | + *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: status userInfo: nil]; | ||
220 | + } | ||
221 | + } | ||
222 | + return nil; | ||
223 | + } | ||
224 | + NSString *password = nil; | ||
225 | + if (resultData) { | ||
226 | + password = [[NSString alloc] initWithData: resultData encoding: NSUTF8StringEncoding]; | ||
227 | + } | ||
228 | + else { | ||
229 | + // There is an existing item, but we weren't able to get password data for it for some reason, | ||
230 | + // Possibly as a result of an item being incorrectly entered by the previous code. | ||
231 | + // Set the -1999 error so the code above us can prompt the user again. | ||
232 | + | ||
233 | + if (error != nil) { | ||
234 | + *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: -1999 userInfo: nil]; | ||
235 | + } | ||
236 | + } | ||
237 | + return password; | ||
238 | +} | ||
239 | + | ||
240 | ++ (BOOL) storeUsername: (NSString *) username andPassword: (NSString *) password forServiceName: (NSString *) serviceName updateExisting: (BOOL) updateExisting error: (NSError **) error | ||
241 | + | ||
242 | +{ | ||
243 | + if (!username || !password || !serviceName) | ||
244 | + | ||
245 | + { | ||
246 | + if (error != nil) | ||
247 | + { | ||
248 | + *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: -2000 userInfo: nil]; | ||
249 | + } | ||
250 | + return NO; | ||
251 | + } | ||
252 | + | ||
253 | + // See if we already have a password entered for these credentials. | ||
254 | + | ||
255 | + NSError *getError = nil; | ||
256 | + NSString *existingPassword = [SFHFKeychainUtils getPasswordForUsername: username andServiceName: serviceName error:&getError]; | ||
257 | + | ||
258 | + if ([getError code] == -1999) | ||
259 | + { | ||
260 | + // There is an existing entry without a password properly stored (possibly as a result of the previous incorrect version of this code. | ||
261 | + | ||
262 | + // Delete the existing item before moving on entering a correct one. | ||
263 | + getError = nil; | ||
264 | + | ||
265 | + [self deleteItemForUsername: username andServiceName: serviceName error: &getError]; | ||
266 | + | ||
267 | + if ([getError code] != noErr) | ||
268 | + { | ||
269 | + if (error != nil) | ||
270 | + { | ||
271 | + *error = getError; | ||
272 | + } | ||
273 | + return NO; | ||
274 | + } | ||
275 | + } | ||
276 | + else if ([getError code] != noErr) | ||
277 | + { | ||
278 | + if (error != nil) | ||
279 | + { | ||
280 | + *error = getError; | ||
281 | + } | ||
282 | + return NO; | ||
283 | + } | ||
284 | + if (error != nil) | ||
285 | + { | ||
286 | + *error = nil; | ||
287 | + } | ||
288 | + | ||
289 | + OSStatus status = noErr; | ||
290 | + | ||
291 | + if (existingPassword) | ||
292 | + { | ||
293 | + | ||
294 | + // We have an existing, properly entered item with a password. | ||
295 | + // Update the existing item. | ||
296 | + | ||
297 | + if (![existingPassword isEqualToString:password] && updateExisting) | ||
298 | + { | ||
299 | + //Only update if we're allowed to update existing. If not, simply do nothing. | ||
300 | + | ||
301 | + NSArray *keys = [[NSArray alloc] initWithObjects: (__bridge_transfer NSString *) kSecClass,kSecAttrService,kSecAttrLabel,kSecAttrAccount,nil]; | ||
302 | + | ||
303 | + NSArray *objects = [[NSArray alloc] initWithObjects: (__bridge_transfer NSString *) kSecClassGenericPassword,serviceName,serviceName,username,nil]; | ||
304 | + | ||
305 | + NSDictionary *query = [[NSDictionary alloc] initWithObjects: objects forKeys: keys]; | ||
306 | + | ||
307 | + status = SecItemUpdate((__bridge CFDictionaryRef) query, (__bridge CFDictionaryRef) [NSDictionary dictionaryWithObject: [password dataUsingEncoding: NSUTF8StringEncoding] forKey: (__bridge_transfer NSString *) kSecValueData]); | ||
308 | + } | ||
309 | + } | ||
310 | + else | ||
311 | + { | ||
312 | + // No existing entry (or an existing, improperly entered, and therefore now | ||
313 | + | ||
314 | + // deleted, entry). Create a new entry. | ||
315 | + | ||
316 | + | ||
317 | + NSArray *keys = [[NSArray alloc] initWithObjects: (__bridge_transfer NSString *) kSecClass,kSecAttrService,kSecAttrLabel,kSecAttrAccount,kSecValueData,nil]; | ||
318 | + | ||
319 | + NSArray *objects = [[NSArray alloc] initWithObjects: (__bridge_transfer NSString *) kSecClassGenericPassword,serviceName,serviceName,username,[password dataUsingEncoding: NSUTF8StringEncoding],nil]; | ||
320 | + | ||
321 | + NSDictionary *query = [[NSDictionary alloc] initWithObjects: objects forKeys: keys]; | ||
322 | + | ||
323 | + status = SecItemAdd((__bridge CFDictionaryRef) query, NULL); | ||
324 | + } | ||
325 | + if (error != nil && status != noErr) | ||
326 | + { | ||
327 | + // Something went wrong with adding the new item. Return the Keychain error code. | ||
328 | + *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: status userInfo: nil]; | ||
329 | + return NO; | ||
330 | + } | ||
331 | + return YES; | ||
332 | +} | ||
333 | + | ||
334 | ++ (BOOL) deleteItemForUsername: (NSString *) username andServiceName: (NSString *) serviceName error: (NSError **) error | ||
335 | +{ | ||
336 | + if (!username || !serviceName) | ||
337 | + { | ||
338 | + if (error != nil) | ||
339 | + { | ||
340 | + *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: -2000 userInfo: nil]; | ||
341 | + } | ||
342 | + return NO; | ||
343 | + } | ||
344 | + if (error != nil) | ||
345 | + { | ||
346 | + *error = nil; | ||
347 | + } | ||
348 | + NSArray *keys = [[NSArray alloc] initWithObjects: (__bridge_transfer NSString *) kSecClass, kSecAttrAccount, kSecAttrService, kSecReturnAttributes, nil]; | ||
349 | + NSArray *objects = [[NSArray alloc] initWithObjects: (__bridge_transfer NSString *) kSecClassGenericPassword, username, serviceName, kCFBooleanTrue, nil]; | ||
350 | + NSDictionary *query = [[NSDictionary alloc] initWithObjects: objects forKeys: keys]; | ||
351 | + OSStatus status = SecItemDelete((__bridge CFDictionaryRef) query); | ||
352 | + | ||
353 | + if (error != nil && status != noErr) | ||
354 | + { | ||
355 | + *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: status userInfo: nil]; | ||
356 | + return NO; | ||
357 | + } | ||
358 | + return YES; | ||
359 | +} | ||
360 | +#endif | ||
361 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +{"payorderurl": "https://public.sdk.gzyouai.com/paycheck/create", "usertype": 160, "sdkSimpleName": "youdian_ios", "channelId": "710007", "gamechannelid": "710007", "custom": "{}", "sdkVersionCode": "V1_0_9", "loginCheckUrl": "https://public.sdk.gzyouai.com/logincheck/check", "appScheme": "com.qyjx.ydios", "appId": "AB72820BB4BB21C0CAB8BC275A007B34C", "c2": "", "c1": "", "productId": "P000155", "openKey": "3616ba4b7e9f386f4ff7928da38b3523", "paycheckurl": "https://public.sdk.gzyouai.com/paycheck/confirm", "gameSimpleName": "qyjios2"} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +# 公共SDK服务端接入文档 | ||
2 | + | ||
3 | +### 1.登录验证 | ||
4 | + 客户端发送请求参数给服务端,服务端对参数进行 MD5 加密,如果加密结果和serverSign 一致,则验证通过,否则不通过 | ||
5 | +参数 | 类型 | 描述 | ||
6 | +------------ | ------------- | ------------ | ||
7 | +userType | int | 用户类型 ID(渠道类型,兼容以 前帐号体系) | ||
8 | +openId | string | 平台渠道方返回用户ID | ||
9 | +timestamp | string | 时间戳,公共SDK发送到客户端的参数timestamp, 服务端可以判断 timestamp 是否 在有效的登录时间内 | ||
10 | +serverSign | string | 验证密钥,公共 SDK 发送到 客户端的参数 serverSign,加密串:gameAppkey=%s&userType=% s&openId=%s×tamp=%s注意:(游戏测试验证时 gameAppkey 默认值为 fytx_onlie#@12&34 进行验证, 出正式母包时改为游戏本身的gameAppkey值) | ||
11 | + | ||
12 | +验证方式: | ||
13 | +serverSign=MD5(gameAppkey=%s&userType=%s&openId=%s×tamp=%s) 如: | ||
14 | +md5("gameAppkey=xxxx&userType=1&openId=123×tamp=111111111111") | ||
15 | +gameAppkey : 在公共SDK后台的 Md5加密的KEY | ||
16 | + | ||
17 | +### 2. 充值验证(通知游戏方发货) | ||
18 | + 公共SDK服务器接收到渠道服务器充值回调,对回调进行 MD5 验证,如果验证通过, 则采用Post方式马上回调给游戏充值服务器,否则不会回调充值服务器,然后再返回 信息给渠道服务器。回调参数如下: | ||
19 | +参数 | 类型 | 描述 | ||
20 | +------------ | -------------| ------------ | ||
21 | +serverId | int | 服务器 ID | ||
22 | +playerId | int | 角色 ID | ||
23 | +orderId | string | 渠道方订单 ID | ||
24 | +payAmount | double | 充值金额(如有商品 ID,此值为商 品的金额) | ||
25 | +currency | string | 充值货币(CNY:人民币) | ||
26 | +goodsId | string | 商品ID,参数对一些有商品列表 的充值有效 | ||
27 | +goodsName | string | 客户端充值 IP | ||
28 | +custom | string | 透传参数 ,长度 512 | ||
29 | +serverSign | string | 发给充值服务器验证的注意:(游戏测试验证时 gameAppkey 默认值为fytx_onlie#@12&34 进行验证, 出正式母包时改为游戏本身的 gameAppkey 值) | ||
30 | +uId | string | 平台渠道帐号 ID | ||
31 | +gameSimpleName | string | 公告SDK后台游戏名 | ||
32 | +sdkSimpleName | string | 平台渠道代号 | ||
33 | +queryId | string | 公共SDK订单号 | ||
34 | +postTime | string | 订单创建时间戳 | ||
35 | + | ||
36 | +验证方式: | ||
37 | +serverSign=MD5(serverId=%s&playerId=%s&orderId=%s&gameAppKe y=%s)%s:为相应的值 | ||
38 | +gameAppkey : 在公共SDK后台的Md5加密的KEY | ||
39 | +验证通过后,返回公共 SDK 服务器数据,数据格式:{"code":0,"message":"无订 单"}。code:0 表示失败,1 表示成功,message:描述原因。 | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +import shutil | ||
2 | +import os | ||
3 | +import plistlib | ||
4 | + | ||
5 | +import config | ||
6 | +import json | ||
7 | +import packageProj | ||
8 | + | ||
9 | +from mod_pbxproj import XcodeProject | ||
10 | + | ||
11 | + | ||
12 | +gameProjName = config.gameProjName | ||
13 | +channelName = "linyou" | ||
14 | +#copy dir xcodeproj | ||
15 | +copyNewDirName = gameProjName + '_' + channelName + '.xcodeproj' | ||
16 | +currentPath = os.path.abspath('.') | ||
17 | +currentPath += '/' + copyNewDirName | ||
18 | + | ||
19 | + | ||
20 | +if os.path.exists(currentPath): | ||
21 | + shutil.rmtree(currentPath) | ||
22 | + | ||
23 | +shutil.copytree(gameProjName + '.xcodeproj',currentPath) | ||
24 | + | ||
25 | +project = XcodeProject.Load(copyNewDirName + '/project.pbxproj') | ||
26 | + | ||
27 | +#project.add_other_ldflags('-ObjC') | ||
28 | +#frameworks = project.add_folder('poolsdk_file/poolsdk_itools') | ||
29 | +#print(frameworks); | ||
30 | +#add search path | ||
31 | + | ||
32 | +channelRootPath = config.channelRootPath#'poolsdk_file' | ||
33 | + | ||
34 | +frameworksPath = '$(PROJECT_DIR)/' + channelRootPath + '/poolsdk_' + channelName + '/SDK' | ||
35 | +print(frameworksPath); | ||
36 | +#add header search path | ||
37 | +project.add_header_search_paths(frameworksPath, recursive=False) | ||
38 | +#add framework search path | ||
39 | +project.add_framework_search_paths(frameworksPath, recursive=False) | ||
40 | +#add library search path | ||
41 | +project.add_library_search_paths(frameworksPath, recursive=False) | ||
42 | + | ||
43 | +#add poolsdk_xy dir all file into project | ||
44 | +project.remove_group_by_name('poolsdk') | ||
45 | +frameworkRelativePath = project.add_folder(channelRootPath + '/poolsdk_' + channelName + '/SDK') | ||
46 | + | ||
47 | +project.add_file_if_doesnt_exist('pool_setting',parent=frameworkRelativePath, weak=True,ignore_unknown_type=True) | ||
48 | + | ||
49 | + | ||
50 | +systemFrameworks = project.get_or_create_group('Frameworks') | ||
51 | +#add system framework | ||
52 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/CoreTelephony.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
53 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/Security.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
54 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/QuartzCore.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
55 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/SystemConfiguration.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
56 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/AdSupport.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
57 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/StoreKit.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
58 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/CoreText.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
59 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/CoreMotion.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
60 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/CFNetwork.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
61 | + | ||
62 | +#add system dylib | ||
63 | +systemLibs = project.get_or_create_group('Libraries') | ||
64 | +project.add_file_if_doesnt_exist('/usr/lib/libsqlite3.dylib',parent=systemLibs, weak=True, tree='<absolute>')#absolute path | ||
65 | +project.add_file_if_doesnt_exist('/usr/lib/libz.1.dylib',parent=systemLibs, weak=True, tree='<absolute>') | ||
66 | +project.add_file_if_doesnt_exist('/usr/lib/libc++.1.dylib',parent=systemLibs, weak=True, tree='<absolute>') | ||
67 | + | ||
68 | +#modify info.plist reference path | ||
69 | +project.add_single_valued_flag('INFOPLIST_FILE',channelRootPath + '/poolsdk_' + channelName + '/Info.plist') | ||
70 | + | ||
71 | +project.add_single_valued_flag('ENABLE_BITCODE', 'NO') | ||
72 | + | ||
73 | +readInfoPlistFilePath = channelRootPath + '/poolsdk/Info.plist' | ||
74 | +writeInfoFilePath = channelRootPath + '/poolsdk_' + channelName + '/Info.plist' | ||
75 | +infoContent = plistlib.readPlist(readInfoPlistFilePath) | ||
76 | + | ||
77 | +xyInfoPath = channelRootPath + '/poolsdk_' + channelName + '/Info_' + channelName + '.plist' | ||
78 | +xyInfoContent = plistlib.readPlist(xyInfoPath) | ||
79 | + | ||
80 | +#read pool_setting file | ||
81 | +settingFile = open(channelRootPath + '/poolsdk_' + channelName + '/SDK/pool_setting','rw') | ||
82 | +try: | ||
83 | + settingFileContent = settingFile.read( ) | ||
84 | +finally: | ||
85 | + settingFile.close( ) | ||
86 | +#json op | ||
87 | +jsonStr = json.loads(settingFileContent) | ||
88 | + | ||
89 | +#modify bundle id | ||
90 | +project.add_single_valued_flag('PRODUCT_BUNDLE_IDENTIFIER',jsonStr["appScheme"]) | ||
91 | + | ||
92 | +#update and add info.plist content | ||
93 | +infoContent.update(xyInfoContent) | ||
94 | +#write | ||
95 | +plistlib.writePlist(infoContent,writeInfoFilePath) | ||
96 | + | ||
97 | +project.save() | ||
98 | + | ||
99 | + | ||
100 | +packageProj.buildProjName = gameProjName + '_' + channelName | ||
101 | +packageProj.targetName = gameProjName | ||
102 | +packageProj.buildProj() |
1 | +import shutil | ||
2 | +import os | ||
3 | +import plistlib | ||
4 | + | ||
5 | +import config | ||
6 | +import json | ||
7 | +import packageProj | ||
8 | + | ||
9 | +from mod_pbxproj import XcodeProject | ||
10 | + | ||
11 | + | ||
12 | +gameProjName = config.gameProjName | ||
13 | +channelName = "qiyu" | ||
14 | +#copy dir xcodeproj | ||
15 | +copyNewDirName = gameProjName + '_' + channelName + '.xcodeproj' | ||
16 | +currentPath = os.path.abspath('.') | ||
17 | +currentPath += '/' + copyNewDirName | ||
18 | + | ||
19 | + | ||
20 | +if os.path.exists(currentPath): | ||
21 | + shutil.rmtree(currentPath) | ||
22 | + | ||
23 | +shutil.copytree(gameProjName + '.xcodeproj',currentPath) | ||
24 | + | ||
25 | +project = XcodeProject.Load(copyNewDirName + '/project.pbxproj') | ||
26 | + | ||
27 | +#project.add_other_ldflags('-ObjC') | ||
28 | +#frameworks = project.add_folder('poolsdk_file/poolsdk_itools') | ||
29 | +#print(frameworks); | ||
30 | +#add search path | ||
31 | + | ||
32 | +channelRootPath = config.channelRootPath#'poolsdk_file' | ||
33 | + | ||
34 | +frameworksPath = '$(PROJECT_DIR)/' + channelRootPath + '/poolsdk_' + channelName + '/SDK' | ||
35 | +print(frameworksPath); | ||
36 | +#add header search path | ||
37 | +project.add_header_search_paths(frameworksPath, recursive=False) | ||
38 | +#add framework search path | ||
39 | +project.add_framework_search_paths(frameworksPath, recursive=False) | ||
40 | +#add library search path | ||
41 | +project.add_library_search_paths(frameworksPath, recursive=False) | ||
42 | + | ||
43 | +#add poolsdk_xy dir all file into project | ||
44 | +project.remove_group_by_name('poolsdk') | ||
45 | +frameworkRelativePath = project.add_folder(channelRootPath + '/poolsdk_' + channelName + '/SDK') | ||
46 | +#add sdk lib framework | ||
47 | +#project.add_file_if_doesnt_exist('XYPlatform.framework',parent=frameworkRelativePath, weak=True) | ||
48 | +#project.add_file_if_doesnt_exist('XYPlatformResources.bundle',parent=frameworkRelativePath, weak=True) | ||
49 | + | ||
50 | +#remove demo file and replace sdk file | ||
51 | +#project.remove_file_by_path('poolsdk_file/Demo') | ||
52 | +#project.remove_group_by_name('poolsdk_file') | ||
53 | +#project.add_file_if_doesnt_exist('PoolSdk.h',parent=frameworkRelativePath, weak=True) | ||
54 | +#project.add_file_if_doesnt_exist('PoolSdk.m',parent=frameworkRelativePath, weak=True) | ||
55 | +#project.add_file_if_doesnt_exist('SDKInterface.h',parent=frameworkRelativePath, weak=True) | ||
56 | +#project.add_file_if_doesnt_exist('SDKInterface.m',parent=frameworkRelativePath, weak=True) | ||
57 | +#ignore_unknown_type | ||
58 | +project.add_file_if_doesnt_exist('pool_setting',parent=frameworkRelativePath, weak=True,ignore_unknown_type=True) | ||
59 | + | ||
60 | + | ||
61 | +systemFrameworks = project.get_or_create_group('Frameworks') | ||
62 | +#add system framework | ||
63 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/CoreLocation.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
64 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/StoreKit.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
65 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/AdSupport.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
66 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/SafariServices.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
67 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/Security.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
68 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/CFNetwork.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
69 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/CoreTelephony.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
70 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/SystemConfiguration.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
71 | + | ||
72 | + | ||
73 | +#add system dylib | ||
74 | +systemLibs = project.get_or_create_group('Libraries') | ||
75 | +project.add_file_if_doesnt_exist('/usr/lib/libsqlite3.dylib',parent=systemLibs, weak=True, tree='<absolute>')#absolute path | ||
76 | +project.add_file_if_doesnt_exist('/usr/lib/libz.1.dylib',parent=systemLibs, weak=True, tree='<absolute>') | ||
77 | + | ||
78 | +#modify info.plist reference path | ||
79 | +project.add_single_valued_flag('INFOPLIST_FILE',channelRootPath + '/poolsdk_' + channelName + '/Info.plist') | ||
80 | + | ||
81 | +project.add_single_valued_flag('ENABLE_BITCODE', 'NO') | ||
82 | + | ||
83 | +readInfoPlistFilePath = channelRootPath + '/poolsdk/Info.plist' | ||
84 | +writeInfoFilePath = channelRootPath + '/poolsdk_' + channelName + '/Info.plist' | ||
85 | +infoContent = plistlib.readPlist(readInfoPlistFilePath) | ||
86 | + | ||
87 | +xyInfoPath = channelRootPath + '/poolsdk_' + channelName + '/Info_' + channelName + '.plist' | ||
88 | +xyInfoContent = plistlib.readPlist(xyInfoPath) | ||
89 | + | ||
90 | +#read pool_setting file | ||
91 | +settingFile = open(channelRootPath + '/poolsdk_' + channelName + '/SDK/pool_setting','rw') | ||
92 | +try: | ||
93 | + settingFileContent = settingFile.read( ) | ||
94 | +finally: | ||
95 | + settingFile.close( ) | ||
96 | +#json op | ||
97 | +jsonStr = json.loads(settingFileContent) | ||
98 | + | ||
99 | +#modify bundle id | ||
100 | +project.add_single_valued_flag('PRODUCT_BUNDLE_IDENTIFIER',jsonStr["appScheme"]) | ||
101 | + | ||
102 | +#update and add info.plist content | ||
103 | +infoContent.update(xyInfoContent) | ||
104 | +#write | ||
105 | +plistlib.writePlist(infoContent,writeInfoFilePath) | ||
106 | + | ||
107 | +project.save() | ||
108 | + | ||
109 | + | ||
110 | +packageProj.buildProjName = gameProjName + '_' + channelName | ||
111 | +packageProj.targetName = gameProjName | ||
112 | +packageProj.buildProj() |
1 | +import shutil | ||
2 | +import os | ||
3 | +import plistlib | ||
4 | + | ||
5 | +import config | ||
6 | +import json | ||
7 | +import packageProj | ||
8 | + | ||
9 | +from mod_pbxproj import XcodeProject | ||
10 | + | ||
11 | + | ||
12 | +gameProjName = config.gameProjName | ||
13 | +#copy dir xcodeproj | ||
14 | +copyNewDirName = gameProjName + '_qiyu.xcodeproj' | ||
15 | +currentPath = os.path.abspath('.') | ||
16 | +currentPath += '/' + copyNewDirName | ||
17 | + | ||
18 | + | ||
19 | +if os.path.exists(currentPath): | ||
20 | + shutil.rmtree(currentPath) | ||
21 | + | ||
22 | +shutil.copytree(gameProjName + '.xcodeproj',currentPath) | ||
23 | + | ||
24 | +project = XcodeProject.Load(copyNewDirName + '/project.pbxproj') | ||
25 | + | ||
26 | +#project.add_other_ldflags('-ObjC') | ||
27 | +#frameworks = project.add_folder('poolsdk_file/poolsdk_itools') | ||
28 | +#print(frameworks); | ||
29 | +#add search path | ||
30 | + | ||
31 | +channelRootPath = config.channelRootPath#'poolsdk_file' | ||
32 | + | ||
33 | +frameworksPath = '$(PROJECT_DIR)/' + channelRootPath + '/poolsdk_qiyu/SDK' | ||
34 | +print(frameworksPath); | ||
35 | +#add header search path | ||
36 | +project.add_header_search_paths(frameworksPath, recursive=False) | ||
37 | +#add framework search path | ||
38 | +project.add_framework_search_paths(frameworksPath, recursive=False) | ||
39 | +#add library search path | ||
40 | +project.add_library_search_paths(frameworksPath, recursive=False) | ||
41 | + | ||
42 | +#add poolsdk_xy dir all file into project | ||
43 | +project.remove_group_by_name('poolsdk') | ||
44 | +frameworkRelativePath = project.add_folder(channelRootPath + '/poolsdk_qiyu/SDK') | ||
45 | +#add sdk lib framework | ||
46 | +#project.add_file_if_doesnt_exist('XYPlatform.framework',parent=frameworkRelativePath, weak=True) | ||
47 | +#project.add_file_if_doesnt_exist('XYPlatformResources.bundle',parent=frameworkRelativePath, weak=True) | ||
48 | + | ||
49 | +#remove demo file and replace sdk file | ||
50 | +#project.remove_file_by_path('poolsdk_file/Demo') | ||
51 | +#project.remove_group_by_name('poolsdk_file') | ||
52 | +#project.add_file_if_doesnt_exist('PoolSdk.h',parent=frameworkRelativePath, weak=True) | ||
53 | +#project.add_file_if_doesnt_exist('PoolSdk.m',parent=frameworkRelativePath, weak=True) | ||
54 | +#project.add_file_if_doesnt_exist('SDKInterface.h',parent=frameworkRelativePath, weak=True) | ||
55 | +#project.add_file_if_doesnt_exist('SDKInterface.m',parent=frameworkRelativePath, weak=True) | ||
56 | +#ignore_unknown_type | ||
57 | +project.add_file_if_doesnt_exist('pool_setting',parent=frameworkRelativePath, weak=True,ignore_unknown_type=True) | ||
58 | + | ||
59 | + | ||
60 | +systemFrameworks = project.get_or_create_group('Frameworks') | ||
61 | +#add system framework | ||
62 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/CoreLocation.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
63 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/StoreKit.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
64 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/AdSupport.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
65 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/SafariServices.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
66 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/Security.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
67 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/CFNetwork.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
68 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/CoreTelephony.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
69 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/SystemConfiguration.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
70 | + | ||
71 | + | ||
72 | +#add system dylib | ||
73 | +systemLibs = project.get_or_create_group('Libraries') | ||
74 | +project.add_file_if_doesnt_exist('/usr/lib/libsqlite3.dylib',parent=systemLibs, weak=True, tree='<absolute>')#absolute path | ||
75 | +project.add_file_if_doesnt_exist('/usr/lib/libz.1.dylib',parent=systemLibs, weak=True, tree='<absolute>') | ||
76 | + | ||
77 | +#modify info.plist reference path | ||
78 | +project.add_single_valued_flag('INFOPLIST_FILE',channelRootPath + '/poolsdk_qiyu/Info.plist') | ||
79 | + | ||
80 | +project.add_single_valued_flag('ENABLE_BITCODE', 'NO') | ||
81 | + | ||
82 | +readInfoPlistFilePath = channelRootPath + '/poolsdk/Info.plist' | ||
83 | +writeInfoFilePath = channelRootPath + '/poolsdk_qiyu/Info.plist' | ||
84 | +infoContent = plistlib.readPlist(readInfoPlistFilePath) | ||
85 | + | ||
86 | +xyInfoPath = channelRootPath + '/poolsdk_qiyu/Info_qiyu.plist' | ||
87 | +xyInfoContent = plistlib.readPlist(xyInfoPath) | ||
88 | + | ||
89 | +#read pool_setting file | ||
90 | +settingFile = open(channelRootPath + '/poolsdk_qiyu/SDK/pool_setting','rw') | ||
91 | +try: | ||
92 | + settingFileContent = settingFile.read( ) | ||
93 | +finally: | ||
94 | + settingFile.close( ) | ||
95 | +#json op | ||
96 | +jsonStr = json.loads(settingFileContent) | ||
97 | + | ||
98 | +#modify bundle id | ||
99 | +project.add_single_valued_flag('PRODUCT_BUNDLE_IDENTIFIER',jsonStr["appScheme"]) | ||
100 | + | ||
101 | +#update and add info.plist content | ||
102 | +infoContent.update(xyInfoContent) | ||
103 | +#write | ||
104 | +plistlib.writePlist(infoContent,writeInfoFilePath) | ||
105 | + | ||
106 | +project.save() | ||
107 | + | ||
108 | + | ||
109 | +packageProj.buildProjName = gameProjName + '_qiyu' | ||
110 | +packageProj.targetName = gameProjName | ||
111 | +packageProj.buildProj() |
1 | +import shutil | ||
2 | +import os | ||
3 | +import plistlib | ||
4 | + | ||
5 | +import config | ||
6 | +import json | ||
7 | +import packageProj | ||
8 | + | ||
9 | +from mod_pbxproj import XcodeProject | ||
10 | + | ||
11 | + | ||
12 | +gameProjName = config.gameProjName | ||
13 | +#copy dir xcodeproj | ||
14 | +copyNewDirName = gameProjName + '_youdian.xcodeproj' | ||
15 | +currentPath = os.path.abspath('.') | ||
16 | +currentPath += '/' + copyNewDirName | ||
17 | + | ||
18 | + | ||
19 | +if os.path.exists(currentPath): | ||
20 | + shutil.rmtree(currentPath) | ||
21 | + | ||
22 | +shutil.copytree(gameProjName + '.xcodeproj',currentPath) | ||
23 | + | ||
24 | +project = XcodeProject.Load(copyNewDirName + '/project.pbxproj') | ||
25 | + | ||
26 | +project.add_other_ldflags('-ObjC') | ||
27 | +#frameworks = project.add_folder('poolsdk_file/poolsdk_itools') | ||
28 | +#print(frameworks); | ||
29 | +#add search path | ||
30 | + | ||
31 | +channelRootPath = config.channelRootPath#'poolsdk_file' | ||
32 | + | ||
33 | +frameworksPath = '$(PROJECT_DIR)/' + channelRootPath + '/poolsdk_youdian/SDK' | ||
34 | +print(frameworksPath); | ||
35 | +#add header search path | ||
36 | +project.add_header_search_paths(frameworksPath, recursive=False) | ||
37 | +#add framework search path | ||
38 | +project.add_framework_search_paths(frameworksPath, recursive=False) | ||
39 | +#add library search path | ||
40 | +project.add_library_search_paths(frameworksPath, recursive=False) | ||
41 | + | ||
42 | +#add poolsdk_xy dir all file into project | ||
43 | +project.remove_group_by_name('poolsdk') | ||
44 | +frameworkRelativePath = project.add_folder(channelRootPath + '/poolsdk_youdian/SDK') | ||
45 | + | ||
46 | +#ignore_unknown_type | ||
47 | +project.add_file_if_doesnt_exist('pool_setting',parent=frameworkRelativePath, weak=True,ignore_unknown_type=True) | ||
48 | + | ||
49 | + | ||
50 | +systemFrameworks = project.get_or_create_group('Frameworks') | ||
51 | +#add system framework | ||
52 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/MobileCoreServices.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
53 | +project.add_file_if_doesnt_exist('System/Library/Frameworks/WebKit.framework',parent=systemFrameworks, weak=True, tree='SDKROOT') | ||
54 | + | ||
55 | +#add system dylib | ||
56 | +systemLibs = project.get_or_create_group('Libraries') | ||
57 | +project.add_file_if_doesnt_exist('/usr/lib/libz.1.dylib',parent=systemLibs, weak=True, tree='<absolute>') | ||
58 | + | ||
59 | +#modify info.plist reference path | ||
60 | +project.add_single_valued_flag('INFOPLIST_FILE',channelRootPath + '/poolsdk_youdian/Info.plist') | ||
61 | + | ||
62 | +project.add_single_valued_flag('ENABLE_BITCODE', 'NO') | ||
63 | + | ||
64 | +readInfoPlistFilePath = channelRootPath + '/poolsdk/Info.plist' | ||
65 | +writeInfoFilePath = channelRootPath + '/poolsdk_youdian/Info.plist' | ||
66 | +infoContent = plistlib.readPlist(readInfoPlistFilePath) | ||
67 | + | ||
68 | +xyInfoPath = channelRootPath + '/poolsdk_youdian/Info_youdian.plist' | ||
69 | +xyInfoContent = plistlib.readPlist(xyInfoPath) | ||
70 | + | ||
71 | +#read pool_setting file | ||
72 | +settingFile = open(channelRootPath + '/poolsdk_youdian/SDK/pool_setting','rw') | ||
73 | +try: | ||
74 | + settingFileContent = settingFile.read( ) | ||
75 | +finally: | ||
76 | + settingFile.close( ) | ||
77 | +#json op | ||
78 | +jsonStr = json.loads(settingFileContent) | ||
79 | + | ||
80 | +#modify bundle id | ||
81 | +project.add_single_valued_flag('PRODUCT_BUNDLE_IDENTIFIER',jsonStr["appScheme"]) | ||
82 | + | ||
83 | +#update and add info.plist content | ||
84 | +infoContent.update(xyInfoContent) | ||
85 | +#write | ||
86 | +plistlib.writePlist(infoContent,writeInfoFilePath) | ||
87 | + | ||
88 | +project.save() | ||
89 | + | ||
90 | + | ||
91 | +packageProj.buildProjName = gameProjName + '_youdian' | ||
92 | +packageProj.targetName = gameProjName | ||
93 | +packageProj.buildProj() |
1 | +// | ||
2 | +// PGLogger.h | ||
3 | +// PanguCommonLib | ||
4 | +// | ||
5 | +// Created by ouyanghua on 14-2-22. | ||
6 | +// Copyright (c) 2014年 pangu. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | + | ||
11 | +void DGLog(NSString *fmt, ...); | ||
12 | + | ||
13 | +typedef NS_ENUM(NSInteger, DGLoggerLevel) | ||
14 | +{ | ||
15 | + ELogVerbose = 1, | ||
16 | + ELogDebug, | ||
17 | + ELogInfo, | ||
18 | + ELogWarn, | ||
19 | + ELogError | ||
20 | +}; | ||
21 | + | ||
22 | +@interface DGLogger : NSObject | ||
23 | + | ||
24 | ++ (void)showLog:(NSString *)fmt,...; | ||
25 | + | ||
26 | ++ (void)showLog:(DGLoggerLevel)level log:(NSString *)fmt,...; | ||
27 | + | ||
28 | ++ (void)isShowLog:(BOOL)flag; | ||
29 | + | ||
30 | +@end |
1 | +// | ||
2 | +// Interface.h | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 12/10/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | + | ||
10 | +#include "UnionInterface.h" | ||
11 | +#import <SafariServices/SafariServices.h> | ||
12 | +@interface Interface : NSObject <UnionInterface,SFSafariViewControllerDelegate> | ||
13 | +@property(nonatomic, strong)UIViewController *controller; | ||
14 | + | ||
15 | + | ||
16 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// NetCenter.h | ||
3 | +// public_i9133 | ||
4 | +// | ||
5 | +// Created by winFan on 12/2/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | + | ||
11 | +@interface NetCenter : NSObject | ||
12 | + | ||
13 | +@property(nonatomic,retain) NSMutableData *receiveData; | ||
14 | + | ||
15 | +@property(nonatomic,assign)int dataPackSerialNo; | ||
16 | + | ||
17 | + | ||
18 | ++ (NetCenter *)getInstance; | ||
19 | + | ||
20 | +- (NSString *)httpGetSyn:(NSString *) getUrl; | ||
21 | + | ||
22 | +- (NSString *)httpPostSyn:(NSString *) postUrl : (NSDictionary *) postData; | ||
23 | + | ||
24 | +- (void)httpGetNoSyn; | ||
25 | + | ||
26 | +- (void)httpPostNoSyn:(NSString *) postUrl :(NSDictionary *)postDict; | ||
27 | + | ||
28 | +- (void)httpPostAsync:(NSString*)postUrl :(NSDictionary*)postDict; | ||
29 | + | ||
30 | +- (void)httpPostAsyncOpen:(NSString*)postUrl :(NSDictionary*)postDict; | ||
31 | + | ||
32 | +- (NSString *)dicToString:(NSDictionary *) dict; | ||
33 | +@end |
1 | +// | ||
2 | +// OtherSetting.h | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 11/23/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#ifndef __PoolSdk__OtherSetting__ | ||
10 | +#define __PoolSdk__OtherSetting__ | ||
11 | + | ||
12 | + | ||
13 | +/** | ||
14 | + 应用支持的方向 | ||
15 | + */ | ||
16 | +typedef NS_ENUM(NSUInteger, ESDKOrientation) { | ||
17 | + ESDKOrientationPortrait = 1,//竖 | ||
18 | + ESDKOrientationLandscape,//横 | ||
19 | + ESDKOrientationNone//自动旋转 | ||
20 | +}; | ||
21 | + | ||
22 | +/** | ||
23 | + 应用支持的方向 | ||
24 | + */ | ||
25 | +typedef NS_ENUM(NSUInteger, REPORT_TYPE) { | ||
26 | + REPORT_TYPE_OPEN = 1,//竖 | ||
27 | + REPORT_TYPE_ENTER,//横 | ||
28 | + REPORT_TYPE_DEFINE//自动旋转 | ||
29 | +}; | ||
30 | + | ||
31 | +#endif /* defined(__PoolSdk__OtherSetting__) */ |
1 | +// | ||
2 | +// PoolBaseModel.h | ||
3 | +// public_i9133 | ||
4 | +// | ||
5 | +// Created by winFan on 12/2/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | + | ||
10 | +#import <Foundation/Foundation.h> | ||
11 | +#import "OtherSetting.h" | ||
12 | +@interface PoolBaseModel : NSObject | ||
13 | + | ||
14 | +- (NSString *)objectToJsonString; | ||
15 | +- (NSMutableString *)paramAddToString; | ||
16 | +- (id)initWithDiction:(NSDictionary *)diction; | ||
17 | + | ||
18 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// PoolLoginChecker.h | ||
3 | +// public_i9133 | ||
4 | +// | ||
5 | +// Created by winFan on 12/1/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | +#import <Foundation/Foundation.h> | ||
9 | +#import "PoolSdk/PoolLoginInfo.h" | ||
10 | +#import "PoolSdk/PoolNotification.h" | ||
11 | +#import "PoolSdk/PoolCreateOrderInfo.h" | ||
12 | +#import "PoolSdk/PoolPayInfo.h" | ||
13 | +#import "PoolReportInfo.h" | ||
14 | +#import "PoolSdkDelegate.h" | ||
15 | + | ||
16 | +@interface PoolChecker : NSObject<PoolSdkDelegate> | ||
17 | +@property(nonatomic, strong)NSString *userId; | ||
18 | +@property(nonatomic, strong)id<PoolSdkDelegate> mPoolSdkDelegate; | ||
19 | + | ||
20 | +@property bool onlyOneTimePay; | ||
21 | ++ (PoolChecker *)getInstance; | ||
22 | +- (void)initChecker; | ||
23 | +- (void)startCheck:(PoolLoginInfo *)loginInfo; | ||
24 | +- (void) createOrder:(PoolCreateOrderInfo *)payInfo; | ||
25 | +- (void) reportOpen; | ||
26 | +- (void) reportSDKOpen; | ||
27 | +- (void)handleFirstOpenApp:(NSString*) path; | ||
28 | +- (void) reportEnter:(PoolReportInfo *)reInfo; | ||
29 | +- (void) report:(NSString *)_action :(PoolReportInfo *)reInfo; | ||
30 | +- (void)sendNotice:(PoolSDKNotificationType)notiType | ||
31 | + notiName:(NSString *)notiName | ||
32 | + statusCode:(int)nCode | ||
33 | + description:(NSString *)szDescripton | ||
34 | + extendData:(NSObject *)extendData; | ||
35 | + | ||
36 | +- (void)startCheckDelegate:(PoolLoginInfo *)loginInfo; | ||
37 | +- (void)setPoolSdkDelegate:(nullable id<PoolSdkDelegate>)poolSdkDeletate; | ||
38 | +@end | ||
39 | + | ||
40 | + | ||
41 | + | ||
42 | + |
1 | +// | ||
2 | +// PoolConfig.h | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 12/11/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | + | ||
11 | +@interface PoolConfig : NSObject | ||
12 | + | ||
13 | +@property(nonatomic, strong)NSString *gameSimpleName; | ||
14 | +@property(nonatomic, strong)NSString *sdkSimpleName; | ||
15 | +@property(nonatomic, strong)NSString *sdkVersionCode; | ||
16 | +@property(nonatomic, strong)NSString *loginCheckUrl; | ||
17 | +@property(nonatomic, strong)NSString *payOrderUrl; | ||
18 | +@property(nonatomic, strong)NSString *payCheckUrl; | ||
19 | +@property(nonatomic, strong)NSString *c1; | ||
20 | +@property(nonatomic, strong)NSString *c2; | ||
21 | +@property(nonatomic, strong)NSString *custom; | ||
22 | + | ||
23 | ++ (PoolConfig *)getInstance; | ||
24 | + | ||
25 | +- (void) loadFile:(NSString *) fileName; | ||
26 | + | ||
27 | +- (NSString *)getValueByKey:(NSString *) key; | ||
28 | + | ||
29 | +- (void) updateC1C2Value:(NSString *)c1 c2:(NSString *)c2; | ||
30 | + | ||
31 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// PayInfo.h | ||
3 | +// public_i9133 | ||
4 | +// | ||
5 | +// Created by winFan on 12/3/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | + | ||
10 | +#import "PoolSdk/PoolBaseModel.h" | ||
11 | +@interface PoolCreateOrderInfo : PoolBaseModel | ||
12 | + | ||
13 | +@property(nonatomic,strong)NSString *serverId;//服务器ID | ||
14 | +@property(nonatomic, strong)NSString *serverName;//角色名称 | ||
15 | +@property(nonatomic, strong)NSString *playerId;//玩家ID | ||
16 | +@property(nonatomic, strong)NSString *playerName;//玩家名称 | ||
17 | +@property(nonatomic, strong)NSString *playerLevel;//玩家等级 | ||
18 | +@property(nonatomic, strong)NSString *postAmount;//金额 | ||
19 | +@property(nonatomic, strong)NSString *productId;//产品ID | ||
20 | +@property(nonatomic, strong)NSString *productName;//产品名称 | ||
21 | +@property(nonatomic, strong)NSString *productDesc;//产品描述 | ||
22 | +@property(nonatomic, strong)NSString *custom;//透传参数 | ||
23 | +@property(nonatomic, strong)NSString *exchange;//兑换比例 | ||
24 | +@property(nonatomic, strong)NSString *otherInfo;//扩展参数 | ||
25 | +@property(nonatomic, strong)NSString *userId;//用户ID | ||
26 | +@property(nonatomic, strong)NSString *timestamp;//时间戳 | ||
27 | + | ||
28 | +- (NSString *) getTsign ; | ||
29 | +- (NSString *) getTimestamp ; | ||
30 | + | ||
31 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// PoolLoginInfo.h | ||
3 | +// public_i9133 | ||
4 | +// | ||
5 | +// Created by winFan on 12/1/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import "PoolSdk/PoolBaseModel.h" | ||
10 | +@interface PoolLoginInfo : PoolBaseModel | ||
11 | + | ||
12 | +@property(nonatomic,strong)NSString *timestamp; | ||
13 | +@property(nonatomic, strong)NSString *sign;//serverSign | ||
14 | +@property(nonatomic, strong)NSString *other;//透传 | ||
15 | +@property(nonatomic, strong)NSString *openId; | ||
16 | +@property(nonatomic, strong)NSString *userType; | ||
17 | + | ||
18 | + | ||
19 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// PoolNotification.h | ||
3 | +// public_i9133 | ||
4 | +// | ||
5 | +// Created by winFan on 12/1/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | + | ||
11 | +extern NSString * const poolSDK_Notification; /**< */ | ||
12 | +extern NSString * const _create_order_notification; /**< */ | ||
13 | + | ||
14 | + | ||
15 | +/** | ||
16 | + 应用支持的方向 | ||
17 | + */ | ||
18 | +typedef NS_ENUM(int, PoolSDKNotificationType) { | ||
19 | + PoolSDKNotificationLogin = 1,//登录 | ||
20 | + PoolSDKNotificationLogout,//注销 | ||
21 | + PoolSDKNotificationPay,//支付完成 | ||
22 | + PoolSDKNotificationPause,//暂停退出 | ||
23 | + PoolSDKNotificationRole,//创建角色 | ||
24 | + PoolSDKNotificationInitSDK//初始化SDK | ||
25 | +}; | ||
26 | + | ||
27 | + | ||
28 | + | ||
29 | +@interface PoolNotification : NSObject | ||
30 | + | ||
31 | +@end | ||
32 | + | ||
33 | + | ||
34 | +////////////////////////////////////////////////////////////////////// | ||
35 | +@interface PoolSDKResult : NSObject | ||
36 | +@property(nonatomic, assign)int statusCode;//请参照此文件下面状态标识 | ||
37 | +@property(nonatomic, strong)NSString *resultDescription; | ||
38 | +@property(nonatomic, strong)NSObject *extendData; | ||
39 | +//V1.2.0新增 | ||
40 | +@property(nonatomic, assign)PoolSDKNotificationType notiType;//消息类型 | ||
41 | +@property(nonatomic, strong)NSString *notiName;//消息名称 | ||
42 | +@end | ||
43 | +////////////////////////////////////////////////////////////////////// | ||
44 | + | ||
45 | +////////////////////////////////////////////////////////////////////// | ||
46 | +/* 状态标识 */ | ||
47 | +#define POOLSDK_NO_ERROR 0 /*操作成功*/ | ||
48 | + | ||
49 | +#define POOLSDK_ERROR_LOGIN_FAILED -100 /*登录失败*/ | ||
50 | +#define POOLSDK_ERROR_LOGIN_CANCEL -101 /*登录取消*/ | ||
51 | +#define POOLSDK_ERROR_LOGIN_GAMGEACCOUNT -102 /*游戏帐号登录,非平台账号*/ | ||
52 | + | ||
53 | +#define POOLSDK_ERROR_PAY_FAILED -200 /*支付失败*/ | ||
54 | +#define POOLSDK_ERROR_PAY_CANCEL -201 /*支付取消*/ | ||
55 | +#define POOLSDK_ERROR_PAY_VERSIGN -202 /*支付验签失败*/ | ||
56 | +#define POOLSDK_ERROR_CREATE_ORDER_FAILED -203 /*支付验签失败*/ | ||
57 | + | ||
58 | +#define POOLSDK_ERROR_ROLE_CREATE_FAILED -300 /*角色创建失败*/ | ||
59 | + | ||
60 | +#define POOLSDK_ERROR_INIT_FAILED -400 /*初始化失败*/ | ||
61 | + | ||
62 | +////////////////////////////////////////////////////////////////////// |
1 | +// | ||
2 | +// PoolPayInfo.h | ||
3 | +// public_i9133 | ||
4 | +// | ||
5 | +// Created by winFan on 12/3/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | + | ||
10 | +#import "PoolSdk/PoolBaseModel.h" | ||
11 | +@interface PoolPayInfo : PoolBaseModel | ||
12 | + | ||
13 | +@property(nonatomic, strong)NSString *serverId; | ||
14 | +@property(nonatomic, strong)NSString *queryId; | ||
15 | +@property(nonatomic, strong)NSString *playerId; | ||
16 | +@property(nonatomic, strong)NSString *playerName; | ||
17 | +@property(nonatomic, strong)NSString *postAmount; | ||
18 | +@property(nonatomic, strong)NSString *productId; | ||
19 | +@property(nonatomic, strong)NSString *products; | ||
20 | +@property(nonatomic, strong)NSString *custom; | ||
21 | +@property(nonatomic, strong)NSString *postTime; | ||
22 | +@property(nonatomic, strong)NSString *other; | ||
23 | +@property(nonatomic, strong)NSString *isOpenThirdPay;//是否开启第三方充值 | ||
24 | + | ||
25 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// PoolReportInfo.h | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 12/21/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import "PoolSdk/PoolBaseModel.h" | ||
10 | +@interface PoolReportInfo : PoolBaseModel | ||
11 | + | ||
12 | +@property(nonatomic, strong)NSString *serverId;//服务器ID | ||
13 | +@property(nonatomic, strong)NSString *serverName;//服务器名称 | ||
14 | +@property(nonatomic, strong)NSString *playerId;//玩家ID | ||
15 | +@property(nonatomic, strong)NSString *playerName;//玩家名称 | ||
16 | +@property(nonatomic, strong)NSString *playerLevel;//玩家等级 | ||
17 | +@property(nonatomic, strong)NSString *custom;//透传参数 | ||
18 | +@property(nonatomic, strong)NSString *reportType;//类型 | ||
19 | + | ||
20 | + | ||
21 | +@property(nonatomic, strong)NSString *openId; | ||
22 | + | ||
23 | +#define REPORT_URL @"https://statistic.public.sdk.gzyouai.com/sdk/statistic" //@http://public.sdk.gzyouai.com:9030/sdk/statistic"//@"http://10.200.201.230:9001/sdk/statistic"//@"https://statistic.public.sdk.gzyouai.com/sdk/statistic"// | ||
24 | +#define REPORT_OPEN @"open" | ||
25 | +#define REPORT_ENTER @"enter" | ||
26 | +#define REPORT_CREATEROLE @"createrole" | ||
27 | +#define REPORT_ROLEUPGRADE @"roleupgrade" | ||
28 | +#define REPORT_SDK_OPEN @"opensdk" | ||
29 | + | ||
30 | +@end |
1 | +// | ||
2 | +// PoolSdk.h | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 11/23/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | +#import <PoolSdk/PoolSdk2.h> | ||
11 | +#import <UIKit/UIKit.h> | ||
12 | +#import "TrackingIO.h" | ||
13 | + | ||
14 | +@interface PoolSdk : NSObject | ||
15 | +/** | ||
16 | + * 当前SDK的版本 | ||
17 | + */ | ||
18 | +@property(nonatomic, strong, readonly)NSString *sdkVersion; | ||
19 | + | ||
20 | +/** | ||
21 | + * 用于设置url types schemes 默认为工程名 | ||
22 | + */ | ||
23 | +@property(nonatomic, strong)NSString *urlSchemes; | ||
24 | + | ||
25 | +/** | ||
26 | + 获取SDK实例对象 | ||
27 | + */ | ||
28 | ++ (PoolSdk *)shareSDK; | ||
29 | + | ||
30 | +/** | ||
31 | + 初始化SDK | ||
32 | + */ | ||
33 | +- (void)initSDK:(UIViewController *) control; | ||
34 | + | ||
35 | + | ||
36 | +-(void)viewDidAppear; | ||
37 | + | ||
38 | +/** | ||
39 | + 登录SDK | ||
40 | + */ | ||
41 | +- (void)loginSDK; | ||
42 | + | ||
43 | +/** | ||
44 | + 进行支付 | ||
45 | + */ | ||
46 | +- (void)payWithPaymentInfo:(PoolCreateOrderInfo *)payInfo; | ||
47 | + | ||
48 | +/** | ||
49 | + 用户中心 | ||
50 | + */ | ||
51 | +- (void)gotoUserCenter; | ||
52 | + | ||
53 | +/** | ||
54 | + report | ||
55 | + */ | ||
56 | +- (void)reportSDK:(PoolReportInfo *)reportInfo; | ||
57 | + | ||
58 | +/** | ||
59 | + 注销 | ||
60 | + */ | ||
61 | +- (void)logoutSDK; | ||
62 | + | ||
63 | +/** | ||
64 | + 退出 | ||
65 | + */ | ||
66 | +- (void)exitSDK; | ||
67 | + | ||
68 | + | ||
69 | + | ||
70 | +/** | ||
71 | + 显示/隐藏浮标 | ||
72 | + */ | ||
73 | +//- (void)showFloatIcon:(BOOL)bFlag; | ||
74 | + | ||
75 | + | ||
76 | +/** | ||
77 | + // called in - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url | ||
78 | + */ | ||
79 | +- (void)handleOpenurl:(NSURL *)url; | ||
80 | + | ||
81 | +- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window; | ||
82 | +/** | ||
83 | + 应用 appid | ||
84 | + */ | ||
85 | + | ||
86 | +/** | ||
87 | + 应用支持的方向 默认为 EDreamSDKOrientationLandscape | ||
88 | + */ | ||
89 | +@property(nonatomic, assign)ESDKOrientation sdkOrientation; | ||
90 | + | ||
91 | +/** | ||
92 | + 浮标是否已经显示,默认为NO | ||
93 | + */ | ||
94 | +@property(nonatomic, assign)BOOL bShowedFloat; | ||
95 | + | ||
96 | + | ||
97 | +/** | ||
98 | + serverId | ||
99 | + */ | ||
100 | +@property(nonatomic, assign)int serverId; | ||
101 | + | ||
102 | +/** | ||
103 | + 获取gamechannelid | ||
104 | + */ | ||
105 | +-(NSString *) getGameChannelId; | ||
106 | + | ||
107 | +/** | ||
108 | + 获取Custom | ||
109 | + */ | ||
110 | +- (NSString *) getCustomValue; | ||
111 | + | ||
112 | +/** | ||
113 | + 获取ChannelParameter1 | ||
114 | + */ | ||
115 | +- (NSString *) getChannelParameter1; | ||
116 | + | ||
117 | +/** | ||
118 | + 获取ChannelParameter2 | ||
119 | + */ | ||
120 | +- (NSString *) getChannelParameter2; | ||
121 | + | ||
122 | + | ||
123 | +@end |
1 | +// | ||
2 | +// PoolSdk.h | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by 许 on 16/1/15. | ||
6 | +// Copyright © 2016年 许. All rights reserved. | ||
7 | +// | ||
8 | +// In this header, you should import all the public headers of your framework using statements like #import <PoolSdk/PublicHeader.h> | ||
9 | + | ||
10 | +#import <UIKit/UIKit.h> | ||
11 | +#import "PoolChecker.h" | ||
12 | +#import "Interface.h" | ||
13 | +#import "PoolReportInfo.h" | ||
14 | +#import "PoolLoginInfo.h" | ||
15 | +#import "PoolNotification.h" | ||
16 | +#import "PoolPayInfo.h" | ||
17 | +#import "UnionInterface.h" | ||
18 | +#import "PoolCreateOrderInfo.h" | ||
19 | +#import "PoolConfig.h" | ||
20 | +#import "TrackingIO.h" | ||
21 | +#import "PoolUtils.h" | ||
22 | +#import "NetCenter.h" | ||
23 | +#import "PoolSdkDelegate.h" | ||
24 | + |
1 | +// | ||
2 | +// PoolSdkDelegate.h | ||
3 | +// PoolSdk_i9133 | ||
4 | +// | ||
5 | +// Created by 许 on 17/6/30. | ||
6 | +// Copyright © 2017年 许. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | + | ||
11 | +@protocol PoolSdkDelegate <NSObject> | ||
12 | +@optional | ||
13 | +-(void)PoolSdkLoginSuccess:(PoolLoginInfo*)loginInfo; | ||
14 | +-(void)PoolSdkLoginFail:(NSString*)msg; | ||
15 | +@end |
1 | +// | ||
2 | +// PoolUtils.h | ||
3 | +// public_i9133 | ||
4 | +// | ||
5 | +// Created by winFan on 12/3/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | + | ||
10 | +#import <Foundation/Foundation.h> | ||
11 | +@interface PoolUtils : NSObject | ||
12 | + | ||
13 | ++(NSString *)md5:(NSString *)str; | ||
14 | ++ (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString; | ||
15 | ++(NSString *)createPayOrderUrl; | ||
16 | +//*充值回调地址 | ||
17 | ++(NSString *)createPayUrl; | ||
18 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// NewTtack.h | ||
3 | +// NewTtack | ||
4 | +// | ||
5 | +// Created by yun on 16/1/11. | ||
6 | +// Copyright © 2016年 yun. All rights reserved. | ||
7 | +// | ||
8 | +#define TRACK_VERSION @"1.0.1" | ||
9 | + | ||
10 | +#import <Foundation/Foundation.h> | ||
11 | +#import <UIKit/UIKit.h> | ||
12 | + | ||
13 | + | ||
14 | +/* | ||
15 | + 热云移动广告效果监测 平台 api 请选择对应的api进行使用 | ||
16 | + */ | ||
17 | +NS_ASSUME_NONNULL_BEGIN | ||
18 | +@interface TrackingIO : NSObject | ||
19 | +//开启打印日志 正式上线包请关掉 | ||
20 | ++(void) setPrintLog :(BOOL)print; | ||
21 | +// 开启数据统计 | ||
22 | ++ (void)initWithappKey:(NSString *)appKey withChannelId:(NSString *)channelId; | ||
23 | +//注册成功后调用 | ||
24 | ++ (void)setRegisterWithAccountID:(NSString *)account; | ||
25 | +//登陆成功后调用 | ||
26 | ++ (void)setLoginWithAccountID:(NSString *)account; | ||
27 | +//开始付费时 调用(人民币单位是元) | ||
28 | ++(void)setPaymentStart:(NSString *)transactionId paymentType:(NSString*)paymentType currentType:(NSString*)currencyType currencyAmount:(float)currencyAmount; | ||
29 | +// 支付完成,付费分析,记录玩家充值的金额(人民币单位是元) | ||
30 | ++(void)setPayment:(NSString *)transactionId paymentType:(NSString*)paymentType currentType:(NSString*)currencyType currencyAmount:(float)currencyAmount; | ||
31 | +//自定义事件 | ||
32 | ++(void)setEvent:(NSString *)eventName andExtra:(nullable NSDictionary *)extra; | ||
33 | +//标准接口 | ||
34 | ++(void)setProfile:(NSDictionary *)dataDic; | ||
35 | +//获取设备信息 | ||
36 | ++(NSString*)getDeviceId; | ||
37 | +@end | ||
38 | +NS_ASSUME_NONNULL_END |
1 | +// | ||
2 | +// UnionInterface.h | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 11/23/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | +#import <Foundation/Foundation.h> | ||
9 | +#import <UIKit/UIKit.h> | ||
10 | +#import "PoolCreateOrderInfo.h" | ||
11 | +#import "PoolReportInfo.h" | ||
12 | +@protocol UnionInterface | ||
13 | +/** | ||
14 | + 初始化SDK | ||
15 | + */ | ||
16 | + | ||
17 | +//[[PoolChecker getInstance] sendNotice:PoolSDKNotificationPay notiName:@"" statusCode:POOLSDK_NO_ERROR description:@"" extendData:order_id]; | ||
18 | + | ||
19 | +- (void)SDKinit:(UIViewController *) control; | ||
20 | + | ||
21 | +/** | ||
22 | + 登录SDK | ||
23 | + */ | ||
24 | +- (void)SDKloginSDK; | ||
25 | + | ||
26 | +/** | ||
27 | + 注销 | ||
28 | + */ | ||
29 | +- (void)SDKlogoutSDK; | ||
30 | + | ||
31 | +/** | ||
32 | + 退出 | ||
33 | + */ | ||
34 | +- (void)SDKexitSDK; | ||
35 | + | ||
36 | +/** | ||
37 | + 用户中心 | ||
38 | + */ | ||
39 | +- (void)SDKgotoUserCenter; | ||
40 | + | ||
41 | +- (void)viewDidAppear; | ||
42 | + | ||
43 | +/** | ||
44 | + 提交数据 | ||
45 | + */ | ||
46 | +- (void)SDKreport:(PoolReportInfo *) reportInfo; | ||
47 | + | ||
48 | +/** | ||
49 | + 进行支付 | ||
50 | + */ | ||
51 | + | ||
52 | +- (void)SDKpayWithPaymentInfo:(PoolCreateOrderInfo *)payInfo; | ||
53 | +- (void)receiveCreateOrder: (NSNotification *)notification; | ||
54 | + | ||
55 | +- (void)handleOpenurl:(NSURL *)url; | ||
56 | +- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window; | ||
57 | + | ||
58 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// IapController.h | ||
3 | +// mangosanguo | ||
4 | +// | ||
5 | +// Created by Gino on 12-11-6. | ||
6 | +// Copyright (c) 2012年 private. All rights reserved. | ||
7 | +// | ||
8 | +#if applepay | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | +#import "StoreKit/StoreKit.h" | ||
11 | + | ||
12 | +@interface IapController : NSObject<SKProductsRequestDelegate,SKPaymentTransactionObserver> | ||
13 | +{ | ||
14 | + bool isRequestedBuy; | ||
15 | + SKPaymentTransaction *PayTransaction; | ||
16 | + | ||
17 | + NSMutableArray *payArray; | ||
18 | + SKPaymentTransaction *curTransaction; | ||
19 | +} | ||
20 | + | ||
21 | ++ (IapController *)sharedController; | ||
22 | +- (id)init; | ||
23 | +- (void)removeIt; | ||
24 | +- (void)requestProductData; | ||
25 | +- (void)requestBuyProduct:(NSString *)identifier; | ||
26 | + | ||
27 | +- (void)requestProductInfoById:(NSString *)str; | ||
28 | +- (void)comfireTransactions:(bool)isSuessPosted; | ||
29 | +- (void)checkReceiptIsFail; | ||
30 | + | ||
31 | +- (void)addItemToPayArray:(SKPaymentTransaction *)transaction; | ||
32 | +- (bool)checkPayArrayIsEmpty; | ||
33 | +- (void)checkReceiptForArray; | ||
34 | + | ||
35 | +- (void)setAppleCallBack: (NSString*)url; | ||
36 | +@end | ||
37 | +#endif | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// YouaiLoginInfo.h | ||
3 | +// YouaiSDK | ||
4 | +// | ||
5 | +// Created by 莫 东荣 on 13-4-10. | ||
6 | +// Copyright (c) 2013年 莫 东荣. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | + | ||
11 | +@interface YouaiLoginInfo : NSObject //用户uid | ||
12 | +{ | ||
13 | +// | ||
14 | +NSString *openId; | ||
15 | +//token | ||
16 | +NSString *token; | ||
17 | +//时间戳 | ||
18 | +NSString *timestamp; | ||
19 | + | ||
20 | +} | ||
21 | + | ||
22 | +@property(retain,nonatomic) NSString *openId; | ||
23 | +@property(retain,nonatomic) NSString *token; | ||
24 | +@property(retain,nonatomic) NSString *timestamp; | ||
25 | ++ (YouaiLoginInfo *)getInstance; | ||
26 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// YouaiNotifications.h | ||
3 | +// YouaiSDK | ||
4 | +// | ||
5 | +// Created by 莫 东荣 on 13-4-10. | ||
6 | +// Copyright (c) 2013年 莫 东荣. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | + | ||
11 | +extern NSString * const youaiExitNotification; /**< 退出 */ | ||
12 | +extern NSString * const youaiLoginNotification; /**< 登录完成的通知*/ | ||
13 | +extern NSString * const youaiPaytNotification; /**< 支付通知 */ | ||
14 | +extern NSString * const youaiShareNotification; /**< 分享通知 */ | ||
15 | +extern NSString * const youaiCenterNotification; /**< 用户中心通知 */ | ||
16 | +extern NSString * const youaiErrorNotification; /**< 出错 */ | ||
17 | + | ||
18 | + | ||
19 | +@interface YouaiNotifications : NSObject | ||
20 | + | ||
21 | +@end |
1 | +// | ||
2 | +// YouaiSDKMgr.h | ||
3 | +// YouaiSDK | ||
4 | +// | ||
5 | +// Created by 莫 东荣 on 13-4-9. | ||
6 | +// Copyright (c) 2013年 莫 东荣. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <UIKit/UIKit.h> | ||
10 | +#import "StoreKit/StoreKit.h" | ||
11 | + | ||
12 | +@interface YouaiSDKMgr : NSObject | ||
13 | +{ | ||
14 | + NSString* appId_; | ||
15 | + NSString* appKey_; | ||
16 | + | ||
17 | + NSString* inviterCode_; | ||
18 | + | ||
19 | +// NSString* openId; | ||
20 | +// NSString* loginKey; | ||
21 | +} | ||
22 | + | ||
23 | ++ (YouaiSDKMgr *)getInstance; | ||
24 | +- (void)initSDK; | ||
25 | +- (void)initSDK:(NSString *)weixinId; | ||
26 | + | ||
27 | +- (void)openLogin:(NSString *)appId : (NSString *)appKey : (UIViewController *)controller; | ||
28 | +- (void)openLogin:(NSString *)appId : (NSString *)appKey : (UIViewController *)controller : (NSString *) inviterCode; | ||
29 | +- (void)openLogin:(NSString *)appId : (NSString *)appKey : (UIViewController *)controller : (NSString *) inviterCode : (NSString *)userName : (NSString *)passWord; | ||
30 | +- (void)setStyleName:(NSString*)styleName; | ||
31 | +- (void)openLogin:(NSString *)appId : (NSString *)appKey : (UIViewController *)controller : (NSString *)userName : (NSString *)passWord; | ||
32 | + | ||
33 | +- (void)openCenter: (UIViewController *)controller; | ||
34 | +- (void)openPay: (NSString *)serverId : (NSString *)nickName : (NSString *)callBack : (UIViewController *)controller; | ||
35 | +- (void)openPay: (NSString *)serverId : (NSString *)nickName : (NSNumber *)payAmount : (NSString *)callBack : (UIViewController *)controller; | ||
36 | +- (void)openShare: (UIViewController *)controller; | ||
37 | +- (void)log: (NSString*)log_key : (NSInteger)log_data: (NSString*)log_remark; | ||
38 | + | ||
39 | +- (void)openApplePay:(UIViewController*)controll products:(NSString*)products amount:(NSString*)amount queryId:(NSString*) queryId; | ||
40 | + | ||
41 | + | ||
42 | +- (void)checkAilpay: (NSURL *)url : (UIViewController *)controller; | ||
43 | + | ||
44 | +- (void)applePayCallBack:(NSString *)url :(SKPaymentTransaction *)transaction :(NSString *)resultStr; | ||
45 | + | ||
46 | + | ||
47 | + | ||
48 | +@end |
1 | +// | ||
2 | +// YouaiViewController.h | ||
3 | +// newYouaiSDK | ||
4 | +// | ||
5 | +// Created by Mog90 on 14-9-28. | ||
6 | +// Copyright (c) 2014年 东荣 莫. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <UIKit/UIKit.h> | ||
10 | +#import "YouaiLoginInfo.h" | ||
11 | + | ||
12 | +@interface YouaiViewController : UIViewController<UIWebViewDelegate,UIAlertViewDelegate> | ||
13 | +{ | ||
14 | + UIWebView *webView_; | ||
15 | + UIActivityIndicatorView *activityIndicator; | ||
16 | +} | ||
17 | + | ||
18 | + | ||
19 | +//@property(assign) int webViewWidth; | ||
20 | +//@property(assign) int webViewHeight; | ||
21 | +//@property(assign) int screenwidth; | ||
22 | +//@property(assign) int screenHeight; | ||
23 | + | ||
24 | +@property(assign) BOOL hasCorner; | ||
25 | + | ||
26 | +-(void)setView:(int)webViewWidth :(int) webViewHeight :(int) screenwidth :(int) screenHeight; | ||
27 | +- (void)initWebView; | ||
28 | +- (void)loadWebPageWithString:(NSString *)url; | ||
29 | +- (void)loadWebPageWithJs:(NSString *)content; | ||
30 | +- (void)postNotification:(NSString *)name : (NSString *)code; | ||
31 | +- (void)receiveIap:(NSNotification *)notification; | ||
32 | + | ||
33 | +@end |
1 | +{ | ||
2 | + "images" : [ | ||
3 | + { | ||
4 | + "idiom" : "iphone", | ||
5 | + "size" : "29x29", | ||
6 | + "scale" : "2x" | ||
7 | + }, | ||
8 | + { | ||
9 | + "idiom" : "iphone", | ||
10 | + "size" : "29x29", | ||
11 | + "scale" : "3x" | ||
12 | + }, | ||
13 | + { | ||
14 | + "idiom" : "iphone", | ||
15 | + "size" : "40x40", | ||
16 | + "scale" : "2x" | ||
17 | + }, | ||
18 | + { | ||
19 | + "idiom" : "iphone", | ||
20 | + "size" : "40x40", | ||
21 | + "scale" : "3x" | ||
22 | + }, | ||
23 | + { | ||
24 | + "idiom" : "iphone", | ||
25 | + "size" : "60x60", | ||
26 | + "scale" : "2x" | ||
27 | + }, | ||
28 | + { | ||
29 | + "idiom" : "iphone", | ||
30 | + "size" : "60x60", | ||
31 | + "scale" : "3x" | ||
32 | + } | ||
33 | + ], | ||
34 | + "info" : { | ||
35 | + "version" : 1, | ||
36 | + "author" : "xcode" | ||
37 | + } | ||
38 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +{ | ||
2 | + "images" : [ | ||
3 | + { | ||
4 | + "orientation" : "portrait", | ||
5 | + "idiom" : "iphone", | ||
6 | + "minimum-system-version" : "7.0", | ||
7 | + "scale" : "2x" | ||
8 | + }, | ||
9 | + { | ||
10 | + "orientation" : "portrait", | ||
11 | + "idiom" : "iphone", | ||
12 | + "minimum-system-version" : "7.0", | ||
13 | + "subtype" : "retina4", | ||
14 | + "scale" : "2x" | ||
15 | + } | ||
16 | + ], | ||
17 | + "info" : { | ||
18 | + "version" : 1, | ||
19 | + "author" : "xcode" | ||
20 | + } | ||
21 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
3 | +<plist version="1.0"> | ||
4 | +<dict> | ||
5 | + <key>CFBundleDevelopmentRegion</key> | ||
6 | + <string>en</string> | ||
7 | + <key>CFBundleExecutable</key> | ||
8 | + <string>$(EXECUTABLE_NAME)</string> | ||
9 | + <key>CFBundleIdentifier</key> | ||
10 | + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
11 | + <key>CFBundleInfoDictionaryVersion</key> | ||
12 | + <string>6.0</string> | ||
13 | + <key>CFBundleName</key> | ||
14 | + <string>$(PRODUCT_NAME)</string> | ||
15 | + <key>CFBundlePackageType</key> | ||
16 | + <string>APPL</string> | ||
17 | + <key>CFBundleShortVersionString</key> | ||
18 | + <string>1.0</string> | ||
19 | + <key>CFBundleSignature</key> | ||
20 | + <string>????</string> | ||
21 | + <key>CFBundleURLTypes</key> | ||
22 | + <array> | ||
23 | + <dict> | ||
24 | + <key>CFBundleTypeRole</key> | ||
25 | + <string>Editor</string> | ||
26 | + <key>CFBundleURLSchemes</key> | ||
27 | + <array> | ||
28 | + <string>com.youai.sdk</string> | ||
29 | + </array> | ||
30 | + </dict> | ||
31 | + </array> | ||
32 | + <key>CFBundleVersion</key> | ||
33 | + <string>1</string> | ||
34 | + <key>LSRequiresIPhoneOS</key> | ||
35 | + <true/> | ||
36 | + <key>UILaunchStoryboardName</key> | ||
37 | + <string>LaunchScreen</string> | ||
38 | + <key>UIMainStoryboardFile</key> | ||
39 | + <string>Main</string> | ||
40 | + <key>UIRequiredDeviceCapabilities</key> | ||
41 | + <array> | ||
42 | + <string>armv7</string> | ||
43 | + </array> | ||
44 | + <key>UISupportedInterfaceOrientations</key> | ||
45 | + <array> | ||
46 | + <string>UIInterfaceOrientationLandscapeLeft</string> | ||
47 | + <string>UIInterfaceOrientationLandscapeRight</string> | ||
48 | + </array> | ||
49 | +</dict> | ||
50 | +</plist> |
1 | +// | ||
2 | +// PoolSdk.h | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 11/23/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | +#import <PoolSdk/PoolSdk2.h> | ||
11 | +#import <UIKit/UIKit.h> | ||
12 | + | ||
13 | +@interface PoolSdk : NSObject | ||
14 | +/** | ||
15 | + * 当前SDK的版本 | ||
16 | + */ | ||
17 | +@property(nonatomic, strong, readonly)NSString *sdkVersion; | ||
18 | + | ||
19 | +/** | ||
20 | + * 用于设置url types schemes 默认为工程名 | ||
21 | + */ | ||
22 | +@property(nonatomic, strong)NSString *urlSchemes; | ||
23 | + | ||
24 | +/** | ||
25 | + 获取SDK实例对象 | ||
26 | + */ | ||
27 | ++ (PoolSdk *)shareSDK; | ||
28 | + | ||
29 | +/** | ||
30 | + 初始化SDK | ||
31 | + */ | ||
32 | +- (void)initSDK:(UIViewController *) control; | ||
33 | + | ||
34 | + | ||
35 | +-(void)viewDidAppear; | ||
36 | + | ||
37 | +/** | ||
38 | + 登录SDK | ||
39 | + */ | ||
40 | +- (void)loginSDK; | ||
41 | + | ||
42 | +/** | ||
43 | + 进行支付 | ||
44 | + */ | ||
45 | +- (void)payWithPaymentInfo:(PoolCreateOrderInfo *)payInfo; | ||
46 | + | ||
47 | +/** | ||
48 | + 用户中心 | ||
49 | + */ | ||
50 | +- (void)gotoUserCenter; | ||
51 | + | ||
52 | +/** | ||
53 | + report | ||
54 | + */ | ||
55 | +- (void)reportSDK:(PoolReportInfo *)reportInfo; | ||
56 | + | ||
57 | +/** | ||
58 | + 注销 | ||
59 | + */ | ||
60 | +- (void)logoutSDK; | ||
61 | + | ||
62 | +/** | ||
63 | + 退出 | ||
64 | + */ | ||
65 | +- (void)exitSDK; | ||
66 | + | ||
67 | + | ||
68 | + | ||
69 | +/** | ||
70 | + 显示/隐藏浮标 | ||
71 | + */ | ||
72 | +//- (void)showFloatIcon:(BOOL)bFlag; | ||
73 | + | ||
74 | + | ||
75 | +/** | ||
76 | + // called in - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url | ||
77 | + */ | ||
78 | +- (void)handleOpenurl:(NSURL *)url; | ||
79 | + | ||
80 | +- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window; | ||
81 | +/** | ||
82 | + 应用 appid | ||
83 | + */ | ||
84 | + | ||
85 | +/** | ||
86 | + 应用支持的方向 默认为 EDreamSDKOrientationLandscape | ||
87 | + */ | ||
88 | +@property(nonatomic, assign)ESDKOrientation sdkOrientation; | ||
89 | + | ||
90 | +/** | ||
91 | + 浮标是否已经显示,默认为NO | ||
92 | + */ | ||
93 | +@property(nonatomic, assign)BOOL bShowedFloat; | ||
94 | + | ||
95 | + | ||
96 | +/** | ||
97 | + serverId | ||
98 | + */ | ||
99 | +@property(nonatomic, assign)int serverId; | ||
100 | + | ||
101 | +/** | ||
102 | + 获取gamechannelid | ||
103 | + */ | ||
104 | +-(NSString *) getGameChannelId; | ||
105 | + | ||
106 | +/** | ||
107 | + 获取Custom | ||
108 | + */ | ||
109 | +- (NSString *) getCustomValue; | ||
110 | + | ||
111 | +/** | ||
112 | + 获取ChannelParameter1 | ||
113 | + */ | ||
114 | +- (NSString *) getChannelParameter1; | ||
115 | + | ||
116 | +/** | ||
117 | + 获取ChannelParameter2 | ||
118 | + */ | ||
119 | +- (NSString *) getChannelParameter2; | ||
120 | + | ||
121 | + | ||
122 | +@end |
1 | +// | ||
2 | +// PoolSdk.m | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 11/23/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import "PoolSdk.h" | ||
10 | +#import "SDKInterface.h" | ||
11 | + | ||
12 | +static PoolSdk *s_PoolSdkCerterInstance = nil; | ||
13 | +static id<UnionInterface> _interface = nil; | ||
14 | +@implementation PoolSdk : NSObject | ||
15 | + | ||
16 | +- (id)init | ||
17 | +{ | ||
18 | + if(self = [super init]) | ||
19 | + { | ||
20 | + _sdkVersion = [NSString stringWithFormat:@"%@ - %@",[[PoolConfig getInstance] gameSimpleName], [[PoolConfig getInstance] sdkSimpleName]]; | ||
21 | + _interface = [[SDKInterface alloc] init]; | ||
22 | + self.urlSchemes = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]; | ||
23 | + } | ||
24 | + return self; | ||
25 | +} | ||
26 | + | ||
27 | +- (void)initSDK :(UIViewController *) control | ||
28 | +{ | ||
29 | + if (![[NSUserDefaults standardUserDefaults] boolForKey:@"pool_everLaunched"]) { | ||
30 | + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"pool_everLaunched"]; | ||
31 | + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"pool_firstLaunch"]; | ||
32 | + } | ||
33 | + else{ | ||
34 | + [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"pool_firstLaunch"]; | ||
35 | + } | ||
36 | + | ||
37 | + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"firstLaunch"]) { | ||
38 | + | ||
39 | + } | ||
40 | + [_interface SDKinit:control]; | ||
41 | + | ||
42 | + [[PoolChecker getInstance] reportSDKOpen]; | ||
43 | + | ||
44 | + NSString* channelId = [[PoolConfig getInstance] getValueByKey:@"gamechannelid"]; | ||
45 | + [TrackingIO initWithappKey:[[PoolConfig getInstance] getValueByKey:@"renyunAppKey"] withChannelId:channelId]; | ||
46 | +} | ||
47 | + | ||
48 | +/** | ||
49 | + 获取SDK实例对象 | ||
50 | + */ | ||
51 | ++ (PoolSdk *)shareSDK | ||
52 | +{ | ||
53 | + static dispatch_once_t dgonceToken; | ||
54 | + dispatch_once(&dgonceToken, ^{ | ||
55 | + s_PoolSdkCerterInstance = [[PoolSdk alloc] init]; | ||
56 | + s_PoolSdkCerterInstance.sdkOrientation = ESDKOrientationLandscape; | ||
57 | + s_PoolSdkCerterInstance.bShowedFloat = NO; | ||
58 | + }); | ||
59 | + | ||
60 | + return s_PoolSdkCerterInstance; | ||
61 | +} | ||
62 | + | ||
63 | +-(void)viewDidAppear{ | ||
64 | + [_interface viewDidAppear]; | ||
65 | +} | ||
66 | + | ||
67 | +- (void)loginSDK | ||
68 | +{ | ||
69 | + [[PoolChecker getInstance] reportOpen]; | ||
70 | + [_interface SDKloginSDK]; | ||
71 | +} | ||
72 | + | ||
73 | +- (void)payWithPaymentInfo:(PoolCreateOrderInfo *)payInfo | ||
74 | +{ | ||
75 | + [_interface SDKpayWithPaymentInfo:payInfo]; | ||
76 | +} | ||
77 | + | ||
78 | +- (void)reportSDK:(PoolReportInfo *)reportInfo | ||
79 | +{ | ||
80 | + NSString *reportT = [reportInfo reportType]; | ||
81 | + reportInfo.openId = [[PoolChecker getInstance] userId]; | ||
82 | + if ([reportT isEqualToString:REPORT_ENTER]) { | ||
83 | + [[PoolChecker getInstance] reportEnter:reportInfo]; | ||
84 | + NSLog(@"reportSDK enter"); | ||
85 | + [TrackingIO setLoginWithAccountID:[reportInfo playerId]]; | ||
86 | + }else if ([reportT isEqualToString:REPORT_ROLEUPGRADE]){ | ||
87 | + | ||
88 | + }else if ([reportT isEqualToString:REPORT_CREATEROLE]){ | ||
89 | + NSLog(@"reportSDK createRole"); | ||
90 | + [TrackingIO setRegisterWithAccountID:[reportInfo playerId]]; | ||
91 | + } | ||
92 | +// [[PoolChecker getInstance] reportOpen]; | ||
93 | + [_interface SDKreport:reportInfo]; | ||
94 | + | ||
95 | +} | ||
96 | + | ||
97 | +- (void)gotoUserCenter | ||
98 | +{ | ||
99 | + [_interface SDKgotoUserCenter]; | ||
100 | +} | ||
101 | + | ||
102 | +- (void)logoutSDK | ||
103 | +{ | ||
104 | + [_interface SDKlogoutSDK]; | ||
105 | +} | ||
106 | + | ||
107 | +- (void)exitSDK | ||
108 | +{ | ||
109 | + [_interface SDKexitSDK]; | ||
110 | +} | ||
111 | + | ||
112 | +- (void)handleOpenurl:(NSURL *)url | ||
113 | +{ | ||
114 | + NSLog(@"handleOpenurl%@",url); | ||
115 | + if([[url host] isEqualToString:@"c_code"]){ | ||
116 | + NSString* path = url.path; | ||
117 | + NSString* codeValue = [path substringFromIndex:1]; | ||
118 | + [[PoolChecker getInstance] handleFirstOpenApp:codeValue]; | ||
119 | + } | ||
120 | + [_interface handleOpenurl:url]; | ||
121 | +} | ||
122 | + | ||
123 | +- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window | ||
124 | +{ | ||
125 | + return [_interface application:application supportedInterfaceOrientationsForWindow:window]; | ||
126 | +} | ||
127 | + | ||
128 | +- (NSString *)getGameChannelId{ | ||
129 | + return [[PoolConfig getInstance]getValueByKey:@"gamechannelid"]; | ||
130 | +} | ||
131 | + | ||
132 | +- (NSString *)getCustomValue{ | ||
133 | + return [[PoolConfig getInstance]getValueByKey:@"custom"]; | ||
134 | +} | ||
135 | + | ||
136 | +- (NSString *)getChannelParameter1{ | ||
137 | + return [[PoolConfig getInstance]getValueByKey:@"c1"]; | ||
138 | +} | ||
139 | + | ||
140 | +- (NSString *)getChannelParameter2{ | ||
141 | + return [[PoolConfig getInstance]getValueByKey:@"c2"]; | ||
142 | +} | ||
143 | + | ||
144 | +@end |
1 | +// | ||
2 | +// UnionInterface.m | ||
3 | +// PoolSdk | ||
4 | +// | ||
5 | +// Created by winFan on 11/23/15. | ||
6 | +// Copyright (c) 2015 winFan. All rights reserved. | ||
7 | +// | ||
8 | +#include "SDKInterface.h" | ||
9 | +#import <UIKit/UIKit.h> | ||
10 | + | ||
11 | +#import "YouaiSDK/YouaiSDKMgr.h" | ||
12 | +#import "YouaiSDK/YouaiNotifications.h" | ||
13 | +#import "YouaiSDK/YouaiLoginInfo.h" | ||
14 | + | ||
15 | + | ||
16 | +//SDK | ||
17 | + | ||
18 | + | ||
19 | +@implementation SDKInterface : Interface | ||
20 | + | ||
21 | + | ||
22 | +int mExchange; | ||
23 | + | ||
24 | + | ||
25 | +/** | ||
26 | + 初始化SDK | ||
27 | +*/ | ||
28 | +- (void)SDKinit:(UIViewController *) control | ||
29 | +{ | ||
30 | + //必须继承 | ||
31 | + [super SDKinit:control]; | ||
32 | + | ||
33 | + [PoolConfig getInstance]; | ||
34 | + [[YouaiSDKMgr getInstance]initSDK]; | ||
35 | + [[YouaiSDKMgr getInstance]setStyleName:@"sdk"]; | ||
36 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveLoginMessage:) name:youaiLoginNotification object:nil]; | ||
37 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applePayCallBack:) name:@"applePayCallBack" object:nil]; | ||
38 | + | ||
39 | + [[PoolChecker getInstance] sendNotice:PoolSDKNotificationInitSDK notiName:@"InitSuccess" statusCode:POOLSDK_NO_ERROR description:@"initSuccess" extendData:nil]; | ||
40 | +} | ||
41 | + | ||
42 | +/** | ||
43 | + 登录SDK | ||
44 | + */ | ||
45 | +- (void)SDKloginSDK | ||
46 | +{ | ||
47 | + NSLog(@"调用了LoginSDK"); | ||
48 | + NSString *appId = [[PoolConfig getInstance] getValueByKey:@"APP_ID"]; | ||
49 | + NSString *appKey =[[PoolConfig getInstance] getValueByKey:@"APP_KEY"]; | ||
50 | + [[YouaiSDKMgr getInstance]openLogin:appId :appKey :self.controller]; | ||
51 | + | ||
52 | +} | ||
53 | + | ||
54 | +/** | ||
55 | + loginCheck | ||
56 | + */ | ||
57 | +- (void)receiveLoginMessage:(NSNotification *)notification | ||
58 | +{ | ||
59 | + NSLog(@"loginchek"); | ||
60 | + PoolLoginInfo *loginInfo = [PoolLoginInfo alloc]; | ||
61 | + loginInfo.openId = [[YouaiLoginInfo getInstance]openId]; | ||
62 | + loginInfo.sign = [[YouaiLoginInfo getInstance] token]; | ||
63 | + loginInfo.timestamp = [YouaiLoginInfo getInstance].timestamp; | ||
64 | + | ||
65 | + dispatch_async(dispatch_get_global_queue(0, 0), ^{ | ||
66 | + [[PoolChecker getInstance] startCheck:loginInfo]; | ||
67 | + }); | ||
68 | + | ||
69 | +} | ||
70 | + | ||
71 | + | ||
72 | +-(NSString*)DataTojsonString:(id)object | ||
73 | +{ | ||
74 | + NSString *jsonString = nil; | ||
75 | + NSError *error; | ||
76 | + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:object | ||
77 | + options:NSJSONWritingPrettyPrinted // Pass 0 if you don't care about the readability of the generated string | ||
78 | + error:&error]; | ||
79 | + jsonString = [jsonData base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength]; | ||
80 | + return jsonString; | ||
81 | +} | ||
82 | + | ||
83 | +/** | ||
84 | + 苹果支付结果回调 | ||
85 | + */ | ||
86 | + | ||
87 | +- (void)applePayCallBack:(NSNotification *)notification | ||
88 | +{ | ||
89 | + NSDictionary* payResultDic = notification.object; | ||
90 | + | ||
91 | + NSString* receiptStr = [payResultDic objectForKey:@"payResult"]; | ||
92 | + NSString* queryId = [payResultDic objectForKey:@"query_id"]; | ||
93 | + | ||
94 | + NSDictionary* receiptDic = [NSDictionary dictionaryWithObjectsAndKeys:receiptStr,@"receipt",queryId,@"query_id", nil]; | ||
95 | + NSString* result = [[NetCenter getInstance] httpPostSyn:[PoolUtils createPayUrl] :receiptDic]; | ||
96 | + | ||
97 | + | ||
98 | + if([@"success" isEqualToString:result]){//确认订单成功 | ||
99 | + }else{//失败 | ||
100 | + NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults]; | ||
101 | + NSMutableArray* queryIdArray = [userDefaults objectForKey:@"queryIds"]; | ||
102 | + | ||
103 | + NSMutableArray* tempQueryIdArray = [[NSMutableArray alloc] initWithCapacity:10]; | ||
104 | + | ||
105 | + if (queryIdArray) { | ||
106 | + }else{ | ||
107 | + queryIdArray = [[NSMutableArray alloc]initWithCapacity:10]; | ||
108 | + } | ||
109 | + | ||
110 | + for (NSString* arrayQueryId in queryIdArray) { | ||
111 | + [tempQueryIdArray addObject:arrayQueryId]; | ||
112 | + } | ||
113 | + | ||
114 | + [tempQueryIdArray addObject:queryId]; | ||
115 | + [userDefaults setObject:tempQueryIdArray forKey:@"queryIds"]; | ||
116 | + [userDefaults setObject:receiptStr forKey:queryId]; | ||
117 | + [userDefaults synchronize]; | ||
118 | + } | ||
119 | +} | ||
120 | + | ||
121 | +/** | ||
122 | + 支付 创建订单 | ||
123 | + */ | ||
124 | +- (void)SDKpayWithPaymentInfo:(PoolCreateOrderInfo *)payInfo | ||
125 | +{ | ||
126 | + mExchange = [payInfo exchange].intValue; | ||
127 | + [super SDKpayWithPaymentInfo:payInfo]; | ||
128 | +} | ||
129 | + | ||
130 | +/** | ||
131 | + SDK | ||
132 | + */ | ||
133 | +- (void)SDKgotoUserCenter | ||
134 | +{ | ||
135 | +} | ||
136 | + | ||
137 | +- (void)SDKreport:(PoolReportInfo *)reportInfo | ||
138 | +{ | ||
139 | + NSLog(@"reportInfo"); | ||
140 | + NSString* reportType = [reportInfo reportType]; | ||
141 | + if (reportInfo) { | ||
142 | + if ([reportType isEqualToString:REPORT_ENTER]) { | ||
143 | + dispatch_async(dispatch_get_global_queue(0, 0), ^{ | ||
144 | + [self handlerLeakOrder]; | ||
145 | + }); | ||
146 | + } | ||
147 | + } | ||
148 | +} | ||
149 | + | ||
150 | +/** | ||
151 | + SDK | ||
152 | + */ | ||
153 | +- (void)SDKexitSDK | ||
154 | +{ | ||
155 | + | ||
156 | +} | ||
157 | + | ||
158 | +- (void)SDKlogoutSDK | ||
159 | +{ | ||
160 | + NSLog(@"切换账号"); | ||
161 | +} | ||
162 | + | ||
163 | +- (void)handleOpenurl:(NSURL *)url | ||
164 | +{ | ||
165 | +} | ||
166 | + | ||
167 | +- (void)receivePayMessage : (NSNotification *)notification; | ||
168 | +{ | ||
169 | + NSString *order_id = [notification object]; | ||
170 | + NSLog(@"订单ID:%@", order_id); | ||
171 | +} | ||
172 | + | ||
173 | +//补单处理 | ||
174 | +- (void) handlerLeakOrder{ | ||
175 | + NSUserDefaults* userDefaults2 = [NSUserDefaults standardUserDefaults]; | ||
176 | + NSMutableArray* queryIdArray = [userDefaults2 objectForKey:@"queryIds"]; | ||
177 | + | ||
178 | + NSLog(@"orderDic%@",queryIdArray); | ||
179 | + NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults]; | ||
180 | + NSMutableArray* failQueryIdArray = [[NSMutableArray alloc]initWithCapacity:10];//补单失败的queryid集合 | ||
181 | + | ||
182 | + if(queryIdArray){ | ||
183 | + for (NSString* queryId in queryIdArray) { | ||
184 | + NSString* receiptStr = [userDefaults valueForKey:queryId]; | ||
185 | + NSDictionary* receiptDic = [NSDictionary dictionaryWithObjectsAndKeys:receiptStr,@"receipt",queryId,@"query_id", nil]; | ||
186 | + NSString* result = [[NetCenter getInstance] httpPostSyn:[PoolUtils createPayUrl] :receiptDic]; | ||
187 | + if([@"success" isEqualToString:result]){//成功 | ||
188 | + [userDefaults removeObjectForKey:queryId]; | ||
189 | + }else{//补单失败 | ||
190 | + [failQueryIdArray addObject:queryId]; | ||
191 | + } | ||
192 | + } | ||
193 | + | ||
194 | + NSLog(@"order count:%lu",(unsigned long)[failQueryIdArray count]); | ||
195 | + if([failQueryIdArray count] > 0){//含有补单失败项 | ||
196 | + [userDefaults setObject:failQueryIdArray forKey:@"queryIds"]; | ||
197 | + }else{//全部补单成功 | ||
198 | + [userDefaults removeObjectForKey:@"queryIds"]; | ||
199 | + } | ||
200 | + [userDefaults synchronize]; | ||
201 | + } | ||
202 | +} | ||
203 | + | ||
204 | + | ||
205 | +- (void)receiveCreateOrder:(NSNotification *)notification | ||
206 | +{ | ||
207 | + NSLog(@"创建订单成功"); | ||
208 | + PoolPayInfo *payInfo = [notification object]; | ||
209 | + | ||
210 | + NSNumber *amount = @([[payInfo postAmount] integerValue] * mExchange); | ||
211 | + NSString *serverId = [payInfo serverId]; | ||
212 | + NSString *roleName = [payInfo playerName]; | ||
213 | + NSString *queryId = [payInfo queryId]; | ||
214 | + | ||
215 | + dispatch_async(dispatch_get_global_queue(0, 0), ^{ | ||
216 | + [self handlerLeakOrder]; | ||
217 | + }); | ||
218 | + | ||
219 | + NSString *isOpenThirdPay = [payInfo isOpenThirdPay]; | ||
220 | + NSLog(@"custom%@",[payInfo custom]); | ||
221 | + if([isOpenThirdPay isEqualToString:@"false"]){ | ||
222 | + NSString* products = [payInfo products]; | ||
223 | + //NSLog(@"products:%@",products); | ||
224 | + [[YouaiSDKMgr getInstance] openApplePay:self.controller products:products amount:[payInfo postAmount] queryId:queryId]; | ||
225 | + }else{ | ||
226 | + [[YouaiSDKMgr getInstance] openPay:serverId :roleName :amount :[payInfo queryId] :self.controller]; | ||
227 | + } | ||
228 | + | ||
229 | + int64_t delayInSeconds = 5.0; // 延迟的时间 | ||
230 | + dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); | ||
231 | + dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ | ||
232 | + NSLog(@"chage state"); | ||
233 | + [[PoolChecker getInstance] setOnlyOneTimePay:false]; | ||
234 | + }); | ||
235 | +} | ||
236 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// IapController.h | ||
3 | +// mangosanguo | ||
4 | +// | ||
5 | +// Created by Gino on 12-11-6. | ||
6 | +// Copyright (c) 2012年 private. All rights reserved. | ||
7 | +// | ||
8 | +#if applepay | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | +#import "StoreKit/StoreKit.h" | ||
11 | + | ||
12 | +@interface IapController : NSObject<SKProductsRequestDelegate,SKPaymentTransactionObserver> | ||
13 | +{ | ||
14 | + bool isRequestedBuy; | ||
15 | + SKPaymentTransaction *PayTransaction; | ||
16 | + | ||
17 | + NSMutableArray *payArray; | ||
18 | + SKPaymentTransaction *curTransaction; | ||
19 | +} | ||
20 | + | ||
21 | ++ (IapController *)sharedController; | ||
22 | +- (id)init; | ||
23 | +- (void)removeIt; | ||
24 | +- (void)requestProductData; | ||
25 | +- (void)requestBuyProduct:(NSString *)identifier; | ||
26 | + | ||
27 | +- (void)requestProductInfoById:(NSString *)str; | ||
28 | +- (void)comfireTransactions:(bool)isSuessPosted; | ||
29 | +- (void)checkReceiptIsFail; | ||
30 | + | ||
31 | +- (void)addItemToPayArray:(SKPaymentTransaction *)transaction; | ||
32 | +- (bool)checkPayArrayIsEmpty; | ||
33 | +- (void)checkReceiptForArray; | ||
34 | + | ||
35 | +- (void)setAppleCallBack: (NSString*)url; | ||
36 | +@end | ||
37 | +#endif | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// YouaiLoginInfo.h | ||
3 | +// YouaiSDK | ||
4 | +// | ||
5 | +// Created by 莫 东荣 on 13-4-10. | ||
6 | +// Copyright (c) 2013年 莫 东荣. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | + | ||
11 | +@interface YouaiLoginInfo : NSObject //用户uid | ||
12 | +{ | ||
13 | +// | ||
14 | +NSString *openId; | ||
15 | +//token | ||
16 | +NSString *token; | ||
17 | +//时间戳 | ||
18 | +NSString *timestamp; | ||
19 | + | ||
20 | +} | ||
21 | + | ||
22 | +@property(retain,nonatomic) NSString *openId; | ||
23 | +@property(retain,nonatomic) NSString *token; | ||
24 | +@property(retain,nonatomic) NSString *timestamp; | ||
25 | ++ (YouaiLoginInfo *)getInstance; | ||
26 | +@end | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// | ||
2 | +// YouaiNotifications.h | ||
3 | +// YouaiSDK | ||
4 | +// | ||
5 | +// Created by 莫 东荣 on 13-4-10. | ||
6 | +// Copyright (c) 2013年 莫 东荣. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <Foundation/Foundation.h> | ||
10 | + | ||
11 | +extern NSString * const youaiExitNotification; /**< 退出 */ | ||
12 | +extern NSString * const youaiLoginNotification; /**< 登录完成的通知*/ | ||
13 | +extern NSString * const youaiPaytNotification; /**< 支付通知 */ | ||
14 | +extern NSString * const youaiShareNotification; /**< 分享通知 */ | ||
15 | +extern NSString * const youaiCenterNotification; /**< 用户中心通知 */ | ||
16 | +extern NSString * const youaiErrorNotification; /**< 出错 */ | ||
17 | + | ||
18 | + | ||
19 | +@interface YouaiNotifications : NSObject | ||
20 | + | ||
21 | +@end |
1 | +// | ||
2 | +// YouaiSDKMgr.h | ||
3 | +// YouaiSDK | ||
4 | +// | ||
5 | +// Created by 莫 东荣 on 13-4-9. | ||
6 | +// Copyright (c) 2013年 莫 东荣. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <UIKit/UIKit.h> | ||
10 | +#import "StoreKit/StoreKit.h" | ||
11 | + | ||
12 | +@interface YouaiSDKMgr : NSObject | ||
13 | +{ | ||
14 | + NSString* appId_; | ||
15 | + NSString* appKey_; | ||
16 | + | ||
17 | + NSString* inviterCode_; | ||
18 | + | ||
19 | +// NSString* openId; | ||
20 | +// NSString* loginKey; | ||
21 | +} | ||
22 | + | ||
23 | ++ (YouaiSDKMgr *)getInstance; | ||
24 | +- (void)initSDK; | ||
25 | +- (void)initSDK:(NSString *)weixinId; | ||
26 | + | ||
27 | +- (void)openLogin:(NSString *)appId : (NSString *)appKey : (UIViewController *)controller; | ||
28 | +- (void)openLogin:(NSString *)appId : (NSString *)appKey : (UIViewController *)controller : (NSString *) inviterCode; | ||
29 | +- (void)openLogin:(NSString *)appId : (NSString *)appKey : (UIViewController *)controller : (NSString *) inviterCode : (NSString *)userName : (NSString *)passWord; | ||
30 | +- (void)setStyleName:(NSString*)styleName; | ||
31 | +- (void)openLogin:(NSString *)appId : (NSString *)appKey : (UIViewController *)controller : (NSString *)userName : (NSString *)passWord; | ||
32 | + | ||
33 | +- (void)openCenter: (UIViewController *)controller; | ||
34 | +- (void)openPay: (NSString *)serverId : (NSString *)nickName : (NSString *)callBack : (UIViewController *)controller; | ||
35 | +- (void)openPay: (NSString *)serverId : (NSString *)nickName : (NSNumber *)payAmount : (NSString *)callBack : (UIViewController *)controller; | ||
36 | +- (void)openShare: (UIViewController *)controller; | ||
37 | +- (void)log: (NSString*)log_key : (NSInteger)log_data: (NSString*)log_remark; | ||
38 | + | ||
39 | +- (void)openApplePay:(UIViewController*)controll products:(NSString*)products amount:(NSString*)amount queryId:(NSString*) queryId; | ||
40 | + | ||
41 | + | ||
42 | +- (void)checkAilpay: (NSURL *)url : (UIViewController *)controller; | ||
43 | + | ||
44 | +- (void)applePayCallBack:(NSString *)url :(SKPaymentTransaction *)transaction :(NSString *)resultStr; | ||
45 | + | ||
46 | + | ||
47 | + | ||
48 | +@end |
1 | +// | ||
2 | +// YouaiViewController.h | ||
3 | +// newYouaiSDK | ||
4 | +// | ||
5 | +// Created by Mog90 on 14-9-28. | ||
6 | +// Copyright (c) 2014年 东荣 莫. All rights reserved. | ||
7 | +// | ||
8 | + | ||
9 | +#import <UIKit/UIKit.h> | ||
10 | +#import "YouaiLoginInfo.h" | ||
11 | + | ||
12 | +@interface YouaiViewController : UIViewController<UIWebViewDelegate,UIAlertViewDelegate> | ||
13 | +{ | ||
14 | + UIWebView *webView_; | ||
15 | + UIActivityIndicatorView *activityIndicator; | ||
16 | +} | ||
17 | + | ||
18 | + | ||
19 | +//@property(assign) int webViewWidth; | ||
20 | +//@property(assign) int webViewHeight; | ||
21 | +//@property(assign) int screenwidth; | ||
22 | +//@property(assign) int screenHeight; | ||
23 | + | ||
24 | +@property(assign) BOOL hasCorner; | ||
25 | + | ||
26 | +-(void)setView:(int)webViewWidth :(int) webViewHeight :(int) screenwidth :(int) screenHeight; | ||
27 | +- (void)initWebView; | ||
28 | +- (void)loadWebPageWithString:(NSString *)url; | ||
29 | +- (void)loadWebPageWithJs:(NSString *)content; | ||
30 | +- (void)postNotification:(NSString *)name : (NSString *)code; | ||
31 | +- (void)receiveIap:(NSNotification *)notification; | ||
32 | + | ||
33 | +@end |
1 | +{ | ||
2 | +"APP_ID": "58fd78a9834e7246b8dc0eac", | ||
3 | +"APP_KEY":"b06b86b79c25774ec758657a7203bae6", | ||
4 | +"renyunAppKey":"7ca554a6f94f5477c6592f4e484bb49d", | ||
5 | + | ||
6 | +"appScheme": "com.qyj.ios.xw", | ||
7 | + | ||
8 | +"gameSimpleName": "fytx_test", | ||
9 | +"sdkSimpleName": "apple_youyu", | ||
10 | +"sdkVersionCode":"V1_0", | ||
11 | + | ||
12 | +"gamechannelid": "123456", | ||
13 | +"custom": "", | ||
14 | +"c2": "", | ||
15 | +"c1": "", | ||
16 | +"loginCheckUrl": "https://public.sdk.gzyouai.com/logincheck/check/", | ||
17 | +"payorderurl": "https://public.sdk.gzyouai.com/paycheck/create", | ||
18 | +"paycheckurl": "https://public.sdk.gzyouai.com/paycheck/confirm" | ||
19 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment