diff --git a/AVOS/AVOS.xcodeproj/project.pbxproj b/AVOS/AVOS.xcodeproj/project.pbxproj index 26b48b797..467f7bed2 100644 --- a/AVOS/AVOS.xcodeproj/project.pbxproj +++ b/AVOS/AVOS.xcodeproj/project.pbxproj @@ -38,7 +38,6 @@ 704F3BB41BE0D05C0033245C /* AVIMVideoMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C9A92711A70AF1800CA4912 /* AVIMVideoMessage.m */; }; 704F3BB51BE0D05C0033245C /* AVIMFileMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = 833E1F621B69F629002A691C /* AVIMFileMessage.m */; }; 704F3BB61BE0D05C0033245C /* AVIMBlockHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C841C011A5A84C600C5C6C4 /* AVIMBlockHelper.m */; }; - 704F3BB71BE0D05C0033245C /* AVIMRuntimeHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C841C031A5A84C600C5C6C4 /* AVIMRuntimeHelper.m */; }; 704F3BB81BE0D05C0033245C /* AVIMErrorUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C630C801A6EB259008F1B00 /* AVIMErrorUtil.m */; }; 704F3BBB1BE0D05C0033245C /* AVIMWebSocketWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C841C0A1A5A84C600C5C6C4 /* AVIMWebSocketWrapper.m */; }; 704F3BBC1BE0D07E0033245C /* AVIMClient_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841BCB1A5A84C600C5C6C4 /* AVIMClient_Internal.h */; }; @@ -80,7 +79,6 @@ 704F3BF91BE0D0820033245C /* AVIMVideoMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C9A92701A70AF1800CA4912 /* AVIMVideoMessage.h */; settings = {ATTRIBUTES = (Public, ); }; }; 704F3BFA1BE0D0820033245C /* AVIMFileMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = 833E1F611B69F629002A691C /* AVIMFileMessage.h */; settings = {ATTRIBUTES = (Public, ); }; }; 704F3BFB1BE0D0830033245C /* AVIMBlockHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841C001A5A84C600C5C6C4 /* AVIMBlockHelper.h */; }; - 704F3BFC1BE0D0830033245C /* AVIMRuntimeHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841C021A5A84C600C5C6C4 /* AVIMRuntimeHelper.h */; }; 704F3BFD1BE0D0830033245C /* AVIMErrorUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C630C7F1A6EB259008F1B00 /* AVIMErrorUtil.h */; }; 704F3C001BE0D0830033245C /* AVIMWebSocketWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841C091A5A84C600C5C6C4 /* AVIMWebSocketWrapper.h */; }; 704F3C051BE0D5400033245C /* AVOSCloud.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 70CA7F681BDE2DC3000A3B21 /* AVOSCloud.framework */; }; @@ -140,7 +138,6 @@ 70CA7FAF1BDE374C000A3B21 /* LCDatabaseCoordinator.m in Sources */ = {isa = PBXBuildFile; fileRef = 830E7CF71B1CA2A2005F4B22 /* LCDatabaseCoordinator.m */; }; 70CA7FB01BDE374C000A3B21 /* LCDatabaseMigrator.m in Sources */ = {isa = PBXBuildFile; fileRef = 830E7CFB1B1CAD3B005F4B22 /* LCDatabaseMigrator.m */; }; 70CA7FB21BDE374C000A3B21 /* LCKeyValueStore.m in Sources */ = {isa = PBXBuildFile; fileRef = 838DD79F1B3D3FB600C95897 /* LCKeyValueStore.m */; }; - 70CA7FB31BDE374C000A3B21 /* LCSSLChallenger.m in Sources */ = {isa = PBXBuildFile; fileRef = 838DD7C11B42630400C95897 /* LCSSLChallenger.m */; }; 70CA7FB41BDE374C000A3B21 /* NSDictionary+LCHash.m in Sources */ = {isa = PBXBuildFile; fileRef = 837CC71D1B568431001333AD /* NSDictionary+LCHash.m */; }; 70CA7FDB1BDE42F5000A3B21 /* AVACL.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C8419DD1A5A79FF00C5C6C4 /* AVACL.h */; settings = {ATTRIBUTES = (Public, ); }; }; 70CA7FDC1BDE42F5000A3B21 /* AVACL_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C8419DF1A5A79FF00C5C6C4 /* AVACL_Internal.h */; }; @@ -154,7 +151,6 @@ 70CA7FE51BDE42F5000A3B21 /* AVDuration.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C8419EF1A5A79FF00C5C6C4 /* AVDuration.h */; }; 70CA7FE71BDE42F6000A3B21 /* AVConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C8419F31A5A79FF00C5C6C4 /* AVConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; 70CA7FE81BDE42F6000A3B21 /* AVGlobal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C8419F41A5A79FF00C5C6C4 /* AVGlobal.h */; }; - 70CA7FE91BDE42F6000A3B21 /* AVOSCloud_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C8419F61A5A79FF00C5C6C4 /* AVOSCloud_Internal.h */; }; 70CA7FEA1BDE42F6000A3B21 /* AVOSCloud.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C84198B1A5A791300C5C6C4 /* AVOSCloud.h */; settings = {ATTRIBUTES = (Public, ); }; }; 70CA7FEB1BDE42F6000A3B21 /* AVCacheManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C8419FA1A5A79FF00C5C6C4 /* AVCacheManager.h */; }; 70CA7FEC1BDE42F6000A3B21 /* AVPersistenceUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C8419FC1A5A79FF00C5C6C4 /* AVPersistenceUtils.h */; }; @@ -195,7 +191,6 @@ 70CA801D1BDE4315000A3B21 /* LCDatabaseQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 83DF02AB1AF86032000E289C /* LCDatabaseQueue.h */; }; 70CA801E1BDE4315000A3B21 /* LCDB.h in Headers */ = {isa = PBXBuildFile; fileRef = 83DF02AD1AF86032000E289C /* LCDB.h */; }; 70CA801F1BDE4315000A3B21 /* LCResultSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 83DF02AE1AF86032000E289C /* LCResultSet.h */; }; - 70CA80301BDE4318000A3B21 /* SDMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 836705AA1BA1358D0050E968 /* SDMacros.h */; }; 70CA80321BDE4318000A3B21 /* AVAnonymousUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841A9C1A5A7A0000C5C6C4 /* AVAnonymousUtils.h */; settings = {ATTRIBUTES = (Public, ); }; }; 70CA80331BDE4318000A3B21 /* AVUser.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841A9E1A5A7A0000C5C6C4 /* AVUser.h */; settings = {ATTRIBUTES = (Public, ); }; }; 70CA80341BDE4318000A3B21 /* AVUser_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841AA01A5A7A0000C5C6C4 /* AVUser_Internal.h */; }; @@ -210,7 +205,6 @@ 70CA803E1BDE431A000A3B21 /* LCDatabaseMigrator.h in Headers */ = {isa = PBXBuildFile; fileRef = 830E7CFA1B1CAD3B005F4B22 /* LCDatabaseMigrator.h */; }; 70CA80401BDE431A000A3B21 /* LCKeyValueSQL.h in Headers */ = {isa = PBXBuildFile; fileRef = 838DD7A21B3D3FD100C95897 /* LCKeyValueSQL.h */; }; 70CA80411BDE431A000A3B21 /* LCKeyValueStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 838DD79E1B3D3FB600C95897 /* LCKeyValueStore.h */; }; - 70CA80421BDE431A000A3B21 /* LCSSLChallenger.h in Headers */ = {isa = PBXBuildFile; fileRef = 838DD7C01B42630400C95897 /* LCSSLChallenger.h */; }; 70CA80431BDE431A000A3B21 /* NSDictionary+LCHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 837CC71C1B568431001333AD /* NSDictionary+LCHash.h */; }; 70DA62481B4BD21B00D95D4D /* testImage.png in Resources */ = {isa = PBXBuildFile; fileRef = 70DA62471B4BD21B00D95D4D /* testImage.png */; }; 70DA624A1B4BD7D100D95D4D /* testAudio.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 70DA62491B4BD7D100D95D4D /* testAudio.mp3 */; }; @@ -270,7 +264,6 @@ 8320F89C1C1918C60024B45E /* LCDatabasePool.m in Sources */ = {isa = PBXBuildFile; fileRef = 83DF02AA1AF86032000E289C /* LCDatabasePool.m */; }; 8320F89E1C1918C60024B45E /* AVOSCloud.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C8419F81A5A79FF00C5C6C4 /* AVOSCloud.m */; }; 8320F8A01C1918C60024B45E /* AVObjectUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C841A551A5A79FF00C5C6C4 /* AVObjectUtils.m */; }; - 8320F8A11C1918C60024B45E /* LCSSLChallenger.m in Sources */ = {isa = PBXBuildFile; fileRef = 838DD7C11B42630400C95897 /* LCSSLChallenger.m */; }; 8320F8A51C1918C60024B45E /* AVCloud.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C841A021A5A79FF00C5C6C4 /* AVCloud.m */; }; 8320F8A61C1918C60024B45E /* AVObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C841A521A5A79FF00C5C6C4 /* AVObject.m */; }; 8320F8A91C1918C60024B45E /* LCFileTaskManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C841A1B1A5A79FF00C5C6C4 /* LCFileTaskManager.m */; }; @@ -333,7 +326,6 @@ 8320F91A1C1918C60024B45E /* AVObjectUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841A541A5A79FF00C5C6C4 /* AVObjectUtils.h */; }; 8320F91C1C1918C60024B45E /* AVRequestOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841A6C1A5A79FF00C5C6C4 /* AVRequestOperation.h */; }; 8320F9211C1918C60024B45E /* LCDatabasePool.h in Headers */ = {isa = PBXBuildFile; fileRef = 83DF02A91AF86032000E289C /* LCDatabasePool.h */; }; - 8320F9271C1918C60024B45E /* SDMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 836705AA1BA1358D0050E968 /* SDMacros.h */; }; 8320F9281C1918C60024B45E /* AVFriendQuery.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841A651A5A79FF00C5C6C4 /* AVFriendQuery.h */; }; 8320F9291C1918C60024B45E /* AVObject_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841A531A5A79FF00C5C6C4 /* AVObject_Internal.h */; }; 8320F92A1C1918C60024B45E /* AVRelation_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841A581A5A79FF00C5C6C4 /* AVRelation_Internal.h */; }; @@ -343,13 +335,11 @@ 8320F92F1C1918C60024B45E /* AVRequestManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 7068A7211BA3614D0004623A /* AVRequestManager.h */; }; 8320F9301C1918C60024B45E /* LCDatabaseQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 83DF02AB1AF86032000E289C /* LCDatabaseQueue.h */; }; 8320F9311C1918C60024B45E /* LCFileTaskManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841A1A1A5A79FF00C5C6C4 /* LCFileTaskManager.h */; }; - 8320F9321C1918C60024B45E /* AVOSCloud_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C8419F61A5A79FF00C5C6C4 /* AVOSCloud_Internal.h */; }; 8320F9351C1918C60024B45E /* AVCacheManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C8419FA1A5A79FF00C5C6C4 /* AVCacheManager.h */; }; 8320F9371C1918C60024B45E /* AVUser_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841AA01A5A7A0000C5C6C4 /* AVUser_Internal.h */; }; 8320F9381C1918C60024B45E /* AVInstallation_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841A5D1A5A79FF00C5C6C4 /* AVInstallation_Internal.h */; }; 8320F9391C1918C60024B45E /* AVPersistenceUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C8419FC1A5A79FF00C5C6C4 /* AVPersistenceUtils.h */; }; 8320F93B1C1918C60024B45E /* AVUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841AAA1A5A7A0000C5C6C4 /* AVUtils.h */; }; - 8320F93D1C1918C60024B45E /* LCSSLChallenger.h in Headers */ = {isa = PBXBuildFile; fileRef = 838DD7C01B42630400C95897 /* LCSSLChallenger.h */; }; 8320F93E1C1918C60024B45E /* AVScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C8419FE1A5A79FF00C5C6C4 /* AVScheduler.h */; }; 8320F9401C1918C60024B45E /* AVGeoPoint_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841A1F1A5A79FF00C5C6C4 /* AVGeoPoint_Internal.h */; }; 8320F9471C1918C60024B45E /* AVDuration.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C8419EF1A5A79FF00C5C6C4 /* AVDuration.h */; }; @@ -414,7 +404,6 @@ 8366BD081ECE0FF2008A5264 /* AVExponentialTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 8366BD051ECE0FF2008A5264 /* AVExponentialTimer.h */; }; 8366BD091ECE0FF2008A5264 /* AVExponentialTimer.m in Sources */ = {isa = PBXBuildFile; fileRef = 8366BD061ECE0FF2008A5264 /* AVExponentialTimer.m */; }; 8366BD0A1ECE0FF2008A5264 /* AVExponentialTimer.m in Sources */ = {isa = PBXBuildFile; fileRef = 8366BD061ECE0FF2008A5264 /* AVExponentialTimer.m */; }; - 836705AB1BA1358D0050E968 /* SDMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 836705AA1BA1358D0050E968 /* SDMacros.h */; }; 836705DF1BA1C1710050E968 /* AVKeychain.h in Headers */ = {isa = PBXBuildFile; fileRef = 836705DC1BA1C1710050E968 /* AVKeychain.h */; }; 836705E01BA1C1710050E968 /* AVKeychain.m in Sources */ = {isa = PBXBuildFile; fileRef = 836705DD1BA1C1710050E968 /* AVKeychain.m */; }; 837CC71E1B568431001333AD /* NSDictionary+LCHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 837CC71C1B568431001333AD /* NSDictionary+LCHash.h */; }; @@ -436,8 +425,6 @@ 838DD7A01B3D3FB600C95897 /* LCKeyValueStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 838DD79E1B3D3FB600C95897 /* LCKeyValueStore.h */; }; 838DD7A11B3D3FB600C95897 /* LCKeyValueStore.m in Sources */ = {isa = PBXBuildFile; fileRef = 838DD79F1B3D3FB600C95897 /* LCKeyValueStore.m */; }; 838DD7A31B3D3FD100C95897 /* LCKeyValueSQL.h in Headers */ = {isa = PBXBuildFile; fileRef = 838DD7A21B3D3FD100C95897 /* LCKeyValueSQL.h */; }; - 838DD7C21B42630400C95897 /* LCSSLChallenger.h in Headers */ = {isa = PBXBuildFile; fileRef = 838DD7C01B42630400C95897 /* LCSSLChallenger.h */; }; - 838DD7C31B42630400C95897 /* LCSSLChallenger.m in Sources */ = {isa = PBXBuildFile; fileRef = 838DD7C11B42630400C95897 /* LCSSLChallenger.m */; }; 839A35671D2A1DC000B3AF1D /* AVIMMessage_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C895DF21A78B73600992A8F /* AVIMMessage_Internal.h */; }; 83A2BD2F1CF33CDA0047B230 /* AVPaasClient_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 83A2BD2E1CF33CDA0047B230 /* AVPaasClient_internal.h */; }; 83A2BD311CF33CDA0047B230 /* AVPaasClient_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 83A2BD2E1CF33CDA0047B230 /* AVPaasClient_internal.h */; }; @@ -445,32 +432,10 @@ 83A2BD331CF33CDA0047B230 /* AVPaasClient_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 83A2BD2E1CF33CDA0047B230 /* AVPaasClient_internal.h */; }; 83AB6DF81C3CFEA70064BE17 /* AVOSCloudIM.m in Sources */ = {isa = PBXBuildFile; fileRef = 83AB6DF71C3CFEA70064BE17 /* AVOSCloudIM.m */; }; 83AB6DFA1C3CFEA70064BE17 /* AVOSCloudIM.m in Sources */ = {isa = PBXBuildFile; fileRef = 83AB6DF71C3CFEA70064BE17 /* AVOSCloudIM.m */; }; - 83B0E5841F28375900EE1A75 /* JRSwizzle.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B0E5821F28375900EE1A75 /* JRSwizzle.h */; }; - 83B0E5851F28375900EE1A75 /* JRSwizzle.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B0E5821F28375900EE1A75 /* JRSwizzle.h */; }; - 83B0E5861F28375900EE1A75 /* JRSwizzle.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B0E5821F28375900EE1A75 /* JRSwizzle.h */; }; - 83B0E5871F28375900EE1A75 /* JRSwizzle.h in Headers */ = {isa = PBXBuildFile; fileRef = 83B0E5821F28375900EE1A75 /* JRSwizzle.h */; }; - 83B0E5881F28375900EE1A75 /* JRSwizzle.m in Sources */ = {isa = PBXBuildFile; fileRef = 83B0E5831F28375900EE1A75 /* JRSwizzle.m */; }; - 83B0E5891F28375900EE1A75 /* JRSwizzle.m in Sources */ = {isa = PBXBuildFile; fileRef = 83B0E5831F28375900EE1A75 /* JRSwizzle.m */; }; - 83B0E58A1F28375900EE1A75 /* JRSwizzle.m in Sources */ = {isa = PBXBuildFile; fileRef = 83B0E5831F28375900EE1A75 /* JRSwizzle.m */; }; - 83B0E58B1F28375900EE1A75 /* JRSwizzle.m in Sources */ = {isa = PBXBuildFile; fileRef = 83B0E5831F28375900EE1A75 /* JRSwizzle.m */; }; - 83BE43971D242905000C7AC3 /* SDMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BE43931D242905000C7AC3 /* SDMacros.h */; }; - 83BE43991D242905000C7AC3 /* SDMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BE43931D242905000C7AC3 /* SDMacros.h */; }; 83BE439A1D242905000C7AC3 /* AVIMWebSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BE43951D242905000C7AC3 /* AVIMWebSocket.h */; }; 83BE439C1D242905000C7AC3 /* AVIMWebSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BE43951D242905000C7AC3 /* AVIMWebSocket.h */; }; 83BE439D1D242905000C7AC3 /* AVIMWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 83BE43961D242905000C7AC3 /* AVIMWebSocket.m */; }; 83BE439F1D242905000C7AC3 /* AVIMWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 83BE43961D242905000C7AC3 /* AVIMWebSocket.m */; }; - 83BE73041D8105AF008ED3CF /* EXTScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BE73021D8105AF008ED3CF /* EXTScope.h */; }; - 83BE73051D8105AF008ED3CF /* EXTScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BE73021D8105AF008ED3CF /* EXTScope.h */; }; - 83BE73061D8105AF008ED3CF /* EXTScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BE73021D8105AF008ED3CF /* EXTScope.h */; }; - 83BE73071D8105AF008ED3CF /* EXTScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BE73021D8105AF008ED3CF /* EXTScope.h */; }; - 83BE73081D8105AF008ED3CF /* EXTScope.m in Sources */ = {isa = PBXBuildFile; fileRef = 83BE73031D8105AF008ED3CF /* EXTScope.m */; }; - 83BE73091D8105AF008ED3CF /* EXTScope.m in Sources */ = {isa = PBXBuildFile; fileRef = 83BE73031D8105AF008ED3CF /* EXTScope.m */; }; - 83BE730A1D8105AF008ED3CF /* EXTScope.m in Sources */ = {isa = PBXBuildFile; fileRef = 83BE73031D8105AF008ED3CF /* EXTScope.m */; }; - 83BE730B1D8105AF008ED3CF /* EXTScope.m in Sources */ = {isa = PBXBuildFile; fileRef = 83BE73031D8105AF008ED3CF /* EXTScope.m */; }; - 83BE730D1D810651008ED3CF /* metamacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BE730C1D810651008ED3CF /* metamacros.h */; }; - 83BE730E1D810651008ED3CF /* metamacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BE730C1D810651008ED3CF /* metamacros.h */; }; - 83BE730F1D810651008ED3CF /* metamacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BE730C1D810651008ED3CF /* metamacros.h */; }; - 83BE73101D810651008ED3CF /* metamacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BE730C1D810651008ED3CF /* metamacros.h */; }; 83CFCB601B2A5D2700F97C92 /* AVIMKeyedConversation.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CFCB5E1B2A5D2700F97C92 /* AVIMKeyedConversation.h */; settings = {ATTRIBUTES = (Public, ); }; }; 83CFCB611B2A5D2700F97C92 /* AVIMKeyedConversation.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CFCB5F1B2A5D2700F97C92 /* AVIMKeyedConversation.m */; }; 83D8CE751C17DAF50094279D /* AVRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C841A6D1A5A79FF00C5C6C4 /* AVRequestOperation.m */; }; @@ -495,7 +460,6 @@ 83D8CE951C17DAF50094279D /* LCDatabasePool.m in Sources */ = {isa = PBXBuildFile; fileRef = 83DF02AA1AF86032000E289C /* LCDatabasePool.m */; }; 83D8CE971C17DAF50094279D /* AVOSCloud.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C8419F81A5A79FF00C5C6C4 /* AVOSCloud.m */; }; 83D8CE991C17DAF50094279D /* AVObjectUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C841A551A5A79FF00C5C6C4 /* AVObjectUtils.m */; }; - 83D8CE9A1C17DAF50094279D /* LCSSLChallenger.m in Sources */ = {isa = PBXBuildFile; fileRef = 838DD7C11B42630400C95897 /* LCSSLChallenger.m */; }; 83D8CE9E1C17DAF50094279D /* AVCloud.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C841A021A5A79FF00C5C6C4 /* AVCloud.m */; }; 83D8CE9F1C17DAF50094279D /* AVObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C841A521A5A79FF00C5C6C4 /* AVObject.m */; }; 83D8CEA01C17DAF50094279D /* AVAnalyticsActivity.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C8419E81A5A79FF00C5C6C4 /* AVAnalyticsActivity.m */; }; @@ -564,7 +528,6 @@ 83D8CF151C17DAF50094279D /* AVRequestOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841A6C1A5A79FF00C5C6C4 /* AVRequestOperation.h */; }; 83D8CF171C17DAF50094279D /* AVAnalyticsImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C8419E91A5A79FF00C5C6C4 /* AVAnalyticsImpl.h */; }; 83D8CF1A1C17DAF50094279D /* LCDatabasePool.h in Headers */ = {isa = PBXBuildFile; fileRef = 83DF02A91AF86032000E289C /* LCDatabasePool.h */; }; - 83D8CF201C17DAF50094279D /* SDMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 836705AA1BA1358D0050E968 /* SDMacros.h */; }; 83D8CF211C17DAF50094279D /* AVFriendQuery.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841A651A5A79FF00C5C6C4 /* AVFriendQuery.h */; }; 83D8CF221C17DAF50094279D /* AVObject_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841A531A5A79FF00C5C6C4 /* AVObject_Internal.h */; }; 83D8CF231C17DAF50094279D /* AVRelation_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841A581A5A79FF00C5C6C4 /* AVRelation_Internal.h */; }; @@ -574,14 +537,12 @@ 83D8CF281C17DAF50094279D /* AVRequestManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 7068A7211BA3614D0004623A /* AVRequestManager.h */; }; 83D8CF291C17DAF50094279D /* LCDatabaseQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 83DF02AB1AF86032000E289C /* LCDatabaseQueue.h */; }; 83D8CF2A1C17DAF50094279D /* LCFileTaskManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841A1A1A5A79FF00C5C6C4 /* LCFileTaskManager.h */; }; - 83D8CF2B1C17DAF50094279D /* AVOSCloud_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C8419F61A5A79FF00C5C6C4 /* AVOSCloud_Internal.h */; }; 83D8CF2E1C17DAF50094279D /* AVCacheManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C8419FA1A5A79FF00C5C6C4 /* AVCacheManager.h */; }; 83D8CF301C17DAF50094279D /* AVUser_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841AA01A5A7A0000C5C6C4 /* AVUser_Internal.h */; }; 83D8CF311C17DAF50094279D /* AVInstallation_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841A5D1A5A79FF00C5C6C4 /* AVInstallation_Internal.h */; }; 83D8CF321C17DAF50094279D /* AVPersistenceUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C8419FC1A5A79FF00C5C6C4 /* AVPersistenceUtils.h */; }; 83D8CF341C17DAF50094279D /* AVUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841AAA1A5A7A0000C5C6C4 /* AVUtils.h */; }; 83D8CF351C17DAF50094279D /* AVAnalyticsSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C8419EB1A5A79FF00C5C6C4 /* AVAnalyticsSession.h */; }; - 83D8CF361C17DAF50094279D /* LCSSLChallenger.h in Headers */ = {isa = PBXBuildFile; fileRef = 838DD7C01B42630400C95897 /* LCSSLChallenger.h */; }; 83D8CF371C17DAF50094279D /* AVScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C8419FE1A5A79FF00C5C6C4 /* AVScheduler.h */; }; 83D8CF391C17DAF50094279D /* AVGeoPoint_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841A1F1A5A79FF00C5C6C4 /* AVGeoPoint_Internal.h */; }; 83D8CF3F1C17DAF50094279D /* AVReachability.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841AA81A5A7A0000C5C6C4 /* AVReachability.h */; }; @@ -699,7 +660,6 @@ 8C841ABF1A5A7A0000C5C6C4 /* AVDuration.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C8419F01A5A79FF00C5C6C4 /* AVDuration.m */; }; 8C841AC21A5A7A0000C5C6C4 /* AVConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C8419F31A5A79FF00C5C6C4 /* AVConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; 8C841AC31A5A7A0000C5C6C4 /* AVGlobal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C8419F41A5A79FF00C5C6C4 /* AVGlobal.h */; }; - 8C841AC51A5A7A0000C5C6C4 /* AVOSCloud_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C8419F61A5A79FF00C5C6C4 /* AVOSCloud_Internal.h */; }; 8C841AC71A5A7A0000C5C6C4 /* AVOSCloud.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C8419F81A5A79FF00C5C6C4 /* AVOSCloud.m */; }; 8C841AC81A5A7A0000C5C6C4 /* AVCacheManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C8419FA1A5A79FF00C5C6C4 /* AVCacheManager.h */; }; 8C841AC91A5A7A0000C5C6C4 /* AVCacheManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C8419FB1A5A79FF00C5C6C4 /* AVCacheManager.m */; }; @@ -781,8 +741,6 @@ 8C841C161A5A84C600C5C6C4 /* AVIMSignature.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C841BD61A5A84C600C5C6C4 /* AVIMSignature.m */; }; 8C841C3E1A5A84C600C5C6C4 /* AVIMBlockHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841C001A5A84C600C5C6C4 /* AVIMBlockHelper.h */; }; 8C841C3F1A5A84C600C5C6C4 /* AVIMBlockHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C841C011A5A84C600C5C6C4 /* AVIMBlockHelper.m */; }; - 8C841C401A5A84C600C5C6C4 /* AVIMRuntimeHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841C021A5A84C600C5C6C4 /* AVIMRuntimeHelper.h */; }; - 8C841C411A5A84C600C5C6C4 /* AVIMRuntimeHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C841C031A5A84C600C5C6C4 /* AVIMRuntimeHelper.m */; }; 8C841C461A5A84C600C5C6C4 /* AVIMWebSocketWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C841C091A5A84C600C5C6C4 /* AVIMWebSocketWrapper.h */; }; 8C841C471A5A84C600C5C6C4 /* AVIMWebSocketWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C841C0A1A5A84C600C5C6C4 /* AVIMWebSocketWrapper.m */; }; 8C895DDA1A78A5D900992A8F /* avmp.c in Sources */ = {isa = PBXBuildFile; fileRef = 8C895DC61A78A5D900992A8F /* avmp.c */; }; @@ -1032,6 +990,7 @@ D3F8747B20F8B1690035C7D1 /* LCTestEnvironment.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F8747A20F8B1690035C7D1 /* LCTestEnvironment.m */; }; D3F8747D20F8B1690035C7D1 /* LCTestEnvironment.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F8747A20F8B1690035C7D1 /* LCTestEnvironment.m */; }; D3F8747F20F8B1690035C7D1 /* LCTestEnvironment.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F8747A20F8B1690035C7D1 /* LCTestEnvironment.m */; }; + D3FF8D35233E0B2A00017A45 /* AVInstallationTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3FF8D34233E0B2A00017A45 /* AVInstallationTestCase.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -1131,7 +1090,6 @@ 835092111EB1ECB7000DA884 /* AVDynamicObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AVDynamicObject.m; sourceTree = ""; }; 8366BD051ECE0FF2008A5264 /* AVExponentialTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVExponentialTimer.h; sourceTree = ""; }; 8366BD061ECE0FF2008A5264 /* AVExponentialTimer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AVExponentialTimer.m; sourceTree = ""; }; - 836705AA1BA1358D0050E968 /* SDMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDMacros.h; sourceTree = ""; }; 836705DC1BA1C1710050E968 /* AVKeychain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVKeychain.h; sourceTree = ""; }; 836705DD1BA1C1710050E968 /* AVKeychain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AVKeychain.m; sourceTree = ""; }; 837CC71C1B568431001333AD /* NSDictionary+LCHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+LCHash.h"; sourceTree = ""; }; @@ -1153,18 +1111,10 @@ 838DD79E1B3D3FB600C95897 /* LCKeyValueStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LCKeyValueStore.h; sourceTree = ""; }; 838DD79F1B3D3FB600C95897 /* LCKeyValueStore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LCKeyValueStore.m; sourceTree = ""; }; 838DD7A21B3D3FD100C95897 /* LCKeyValueSQL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LCKeyValueSQL.h; sourceTree = ""; }; - 838DD7C01B42630400C95897 /* LCSSLChallenger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LCSSLChallenger.h; sourceTree = ""; }; - 838DD7C11B42630400C95897 /* LCSSLChallenger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LCSSLChallenger.m; sourceTree = ""; }; 83A2BD2E1CF33CDA0047B230 /* AVPaasClient_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVPaasClient_internal.h; sourceTree = ""; }; 83AB6DF71C3CFEA70064BE17 /* AVOSCloudIM.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AVOSCloudIM.m; sourceTree = ""; }; - 83B0E5821F28375900EE1A75 /* JRSwizzle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JRSwizzle.h; sourceTree = ""; }; - 83B0E5831F28375900EE1A75 /* JRSwizzle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JRSwizzle.m; sourceTree = ""; }; - 83BE43931D242905000C7AC3 /* SDMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDMacros.h; sourceTree = ""; }; 83BE43951D242905000C7AC3 /* AVIMWebSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVIMWebSocket.h; sourceTree = ""; }; 83BE43961D242905000C7AC3 /* AVIMWebSocket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AVIMWebSocket.m; sourceTree = ""; }; - 83BE73021D8105AF008ED3CF /* EXTScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EXTScope.h; sourceTree = ""; }; - 83BE73031D8105AF008ED3CF /* EXTScope.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EXTScope.m; sourceTree = ""; }; - 83BE730C1D810651008ED3CF /* metamacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = metamacros.h; sourceTree = ""; }; 83CFCB5E1B2A5D2700F97C92 /* AVIMKeyedConversation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVIMKeyedConversation.h; sourceTree = ""; }; 83CFCB5F1B2A5D2700F97C92 /* AVIMKeyedConversation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AVIMKeyedConversation.m; sourceTree = ""; }; 83D8CF551C17DAF50094279D /* AVOSCloud.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AVOSCloud.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1236,7 +1186,6 @@ 8C8419F31A5A79FF00C5C6C4 /* AVConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVConstants.h; sourceTree = ""; }; 8C8419F41A5A79FF00C5C6C4 /* AVGlobal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVGlobal.h; sourceTree = ""; }; 8C8419F51A5A79FF00C5C6C4 /* AVOSCloud_Art.inc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; path = AVOSCloud_Art.inc; sourceTree = ""; }; - 8C8419F61A5A79FF00C5C6C4 /* AVOSCloud_Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVOSCloud_Internal.h; sourceTree = ""; }; 8C8419F81A5A79FF00C5C6C4 /* AVOSCloud.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AVOSCloud.m; sourceTree = ""; }; 8C8419FA1A5A79FF00C5C6C4 /* AVCacheManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVCacheManager.h; sourceTree = ""; }; 8C8419FB1A5A79FF00C5C6C4 /* AVCacheManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AVCacheManager.m; sourceTree = ""; }; @@ -1318,8 +1267,6 @@ 8C841BD61A5A84C600C5C6C4 /* AVIMSignature.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AVIMSignature.m; sourceTree = ""; }; 8C841C001A5A84C600C5C6C4 /* AVIMBlockHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVIMBlockHelper.h; sourceTree = ""; }; 8C841C011A5A84C600C5C6C4 /* AVIMBlockHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AVIMBlockHelper.m; sourceTree = ""; }; - 8C841C021A5A84C600C5C6C4 /* AVIMRuntimeHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVIMRuntimeHelper.h; sourceTree = ""; }; - 8C841C031A5A84C600C5C6C4 /* AVIMRuntimeHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AVIMRuntimeHelper.m; sourceTree = ""; }; 8C841C091A5A84C600C5C6C4 /* AVIMWebSocketWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVIMWebSocketWrapper.h; sourceTree = ""; }; 8C841C0A1A5A84C600C5C6C4 /* AVIMWebSocketWrapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = AVIMWebSocketWrapper.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 8C895DC61A78A5D900992A8F /* avmp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = avmp.c; sourceTree = ""; }; @@ -1473,6 +1420,7 @@ D3D80080210AFC7F0058F86C /* AVIMCommon_Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AVIMCommon_Internal.h; sourceTree = ""; }; D3F8747920F8B1690035C7D1 /* LCTestEnvironment.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LCTestEnvironment.h; sourceTree = ""; }; D3F8747A20F8B1690035C7D1 /* LCTestEnvironment.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LCTestEnvironment.m; sourceTree = ""; }; + D3FF8D34233E0B2A00017A45 /* AVInstallationTestCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AVInstallationTestCase.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1612,14 +1560,6 @@ path = SMS; sourceTree = ""; }; - 836705A91BA1358D0050E968 /* SDMacros */ = { - isa = PBXGroup; - children = ( - 836705AA1BA1358D0050E968 /* SDMacros.h */, - ); - path = SDMacros; - sourceTree = ""; - }; 836705DA1BA1C1710050E968 /* JNKeychain */ = { isa = PBXGroup; children = ( @@ -1673,32 +1613,14 @@ path = Statistics; sourceTree = ""; }; - 83B0E5811F28375900EE1A75 /* JRSwizzle */ = { - isa = PBXGroup; - children = ( - 83B0E5821F28375900EE1A75 /* JRSwizzle.h */, - 83B0E5831F28375900EE1A75 /* JRSwizzle.m */, - ); - path = JRSwizzle; - sourceTree = ""; - }; 83BE43911D242905000C7AC3 /* Vendor */ = { isa = PBXGroup; children = ( - 83BE43921D242905000C7AC3 /* SDMacros */, 83BE43941D242905000C7AC3 /* SocketRocket */, ); path = Vendor; sourceTree = ""; }; - 83BE43921D242905000C7AC3 /* SDMacros */ = { - isa = PBXGroup; - children = ( - 83BE43931D242905000C7AC3 /* SDMacros.h */, - ); - path = SDMacros; - sourceTree = ""; - }; 83BE43941D242905000C7AC3 /* SocketRocket */ = { isa = PBXGroup; children = ( @@ -1708,16 +1630,6 @@ path = SocketRocket; sourceTree = ""; }; - 83BE73011D8105AF008ED3CF /* libextobjc */ = { - isa = PBXGroup; - children = ( - 83BE73021D8105AF008ED3CF /* EXTScope.h */, - 83BE73031D8105AF008ED3CF /* EXTScope.m */, - 83BE730C1D810651008ED3CF /* metamacros.h */, - ); - path = libextobjc; - sourceTree = ""; - }; 83DF02A41AF86032000E289C /* LCDB */ = { isa = PBXGroup; children = ( @@ -1830,7 +1742,6 @@ 8C8419F41A5A79FF00C5C6C4 /* AVGlobal.h */, 8C8419F51A5A79FF00C5C6C4 /* AVOSCloud_Art.inc */, 8311CD841C3D25B9007DEFF8 /* AVAvailability.h */, - 8C8419F61A5A79FF00C5C6C4 /* AVOSCloud_Internal.h */, 8C84198B1A5A791300C5C6C4 /* AVOSCloud.h */, 8C8419F81A5A79FF00C5C6C4 /* AVOSCloud.m */, 8C8419DC1A5A79FF00C5C6C4 /* ACL */, @@ -2067,9 +1978,6 @@ 83FCB9911CEDC57C007D8712 /* LCNetworking */, 836705DA1BA1C1710050E968 /* JNKeychain */, 83DF02A41AF86032000E289C /* LCDB */, - 836705A91BA1358D0050E968 /* SDMacros */, - 83BE73011D8105AF008ED3CF /* libextobjc */, - 83B0E5811F28375900EE1A75 /* JRSwizzle */, ); path = ThirdParty; sourceTree = ""; @@ -2106,8 +2014,6 @@ 838DD7A21B3D3FD100C95897 /* LCKeyValueSQL.h */, 838DD79E1B3D3FB600C95897 /* LCKeyValueStore.h */, 838DD79F1B3D3FB600C95897 /* LCKeyValueStore.m */, - 838DD7C01B42630400C95897 /* LCSSLChallenger.h */, - 838DD7C11B42630400C95897 /* LCSSLChallenger.m */, 837CC71C1B568431001333AD /* NSDictionary+LCHash.h */, 837CC71D1B568431001333AD /* NSDictionary+LCHash.m */, 83331D521EB9D55100CADC9C /* NSDictionary+LeanCloud.h */, @@ -2146,8 +2052,6 @@ children = ( 8C841C001A5A84C600C5C6C4 /* AVIMBlockHelper.h */, 8C841C011A5A84C600C5C6C4 /* AVIMBlockHelper.m */, - 8C841C021A5A84C600C5C6C4 /* AVIMRuntimeHelper.h */, - 8C841C031A5A84C600C5C6C4 /* AVIMRuntimeHelper.m */, 8C630C7F1A6EB259008F1B00 /* AVIMErrorUtil.h */, 8C630C801A6EB259008F1B00 /* AVIMErrorUtil.m */, ); @@ -2339,6 +2243,7 @@ D305470E208F2F7200B547B9 /* AVCloudTestCase.swift */, D336C56F212D02A2008D0E3E /* LCRouterTestCase.swift */, D3CC5D272252242A00B3C778 /* AVQueryTestCase.swift */, + D3FF8D34233E0B2A00017A45 /* AVInstallationTestCase.swift */, ); path = Swift; sourceTree = ""; @@ -2499,7 +2404,6 @@ 704F3BC21BE0D07E0033245C /* AVIMKeyedConversation_internal.h in Headers */, 704F3BC31BE0D07E0033245C /* AVIMConversationQuery_Internal.h in Headers */, 9A2F1B4B1CF6F6FA00BE52F2 /* LCIMRootObject.h in Headers */, - 83BE43991D242905000C7AC3 /* SDMacros.h in Headers */, 704F3BC71BE0D07E0033245C /* AVIMMessage_Internal.h in Headers */, D3C53FCD2106D84A00D48686 /* AVIMClientProtocol.h in Headers */, 704F3BCA1BE0D07E0033245C /* avmp.h in Headers */, @@ -2553,7 +2457,6 @@ 9A2F1B001CF6F6FA00BE52F2 /* LCIMArray.h in Headers */, 9A2F1B721CF6F6FA00BE52F2 /* LCIMWellKnownTypes.h in Headers */, 704F3BFB1BE0D0830033245C /* AVIMBlockHelper.h in Headers */, - 704F3BFC1BE0D0830033245C /* AVIMRuntimeHelper.h in Headers */, 704F3BFD1BE0D0830033245C /* AVIMErrorUtil.h in Headers */, 9A2F1B6F1CF6F6FA00BE52F2 /* LCIMUtilities_PackagePrivate.h in Headers */, 9A2F1B451CF6F6FA00BE52F2 /* LCIMProtocolBuffers.h in Headers */, @@ -2597,7 +2500,6 @@ 835C5F721D2594EA00EF0EBB /* AVAnalyticsActivity.h in Headers */, 835C5F711D25929600EF0EBB /* AVFriendQuery.h in Headers */, 70CA7FF91BDE4313000A3B21 /* AVObject+Subclass.h in Headers */, - 83BE730E1D810651008ED3CF /* metamacros.h in Headers */, 70CA7FFB1BDE4313000A3B21 /* AVObject_Internal.h in Headers */, 70CA7FFC1BDE4313000A3B21 /* AVObjectUtils.h in Headers */, 70CA7FFE1BDE4313000A3B21 /* AVRequestManager.h in Headers */, @@ -2612,7 +2514,6 @@ 70CA800F1BDE4314000A3B21 /* LCNetworkStatistics.h in Headers */, 83FCB9B01CEDC57C007D8712 /* LCNetworkReachabilityManager.h in Headers */, 8311CD871C3D25B9007DEFF8 /* AVAvailability.h in Headers */, - 83B0E5851F28375900EE1A75 /* JRSwizzle.h in Headers */, 83331D4F1EB9A34000CADC9C /* AVDynamicObject_Internal.h in Headers */, 83FCB9A11CEDC57C007D8712 /* LCHTTPSessionManager.h in Headers */, 83FCB9CE1CEDC57C007D8712 /* LCURLResponseSerialization.h in Headers */, @@ -2622,9 +2523,7 @@ 70CA801D1BDE4315000A3B21 /* LCDatabaseQueue.h in Headers */, 70CA801E1BDE4315000A3B21 /* LCDB.h in Headers */, 70CA801F1BDE4315000A3B21 /* LCResultSet.h in Headers */, - 83BE73051D8105AF008ED3CF /* EXTScope.h in Headers */, 83FCB9D81CEDC57C007D8712 /* LCURLSessionManager.h in Headers */, - 70CA80301BDE4318000A3B21 /* SDMacros.h in Headers */, 70CA80341BDE4318000A3B21 /* AVUser_Internal.h in Headers */, 70CA80351BDE4318000A3B21 /* AVErrorUtils.h in Headers */, 70CA80361BDE4318000A3B21 /* AVHelpers.h in Headers */, @@ -2637,7 +2536,6 @@ 70CA803E1BDE431A000A3B21 /* LCDatabaseMigrator.h in Headers */, 70CA80401BDE431A000A3B21 /* LCKeyValueSQL.h in Headers */, 70CA80411BDE431A000A3B21 /* LCKeyValueStore.h in Headers */, - 70CA80421BDE431A000A3B21 /* LCSSLChallenger.h in Headers */, 70CA80431BDE431A000A3B21 /* NSDictionary+LCHash.h in Headers */, 70CA7FDC1BDE42F5000A3B21 /* AVACL_Internal.h in Headers */, 830EBA011C44F3D600BA917F /* AVSaveOption_internal.h in Headers */, @@ -2650,7 +2548,6 @@ 70CA7FE51BDE42F5000A3B21 /* AVDuration.h in Headers */, 70CA7FE81BDE42F6000A3B21 /* AVGlobal.h in Headers */, 9A404DD41CE5A9B700DEB3DC /* LCRouter.h in Headers */, - 70CA7FE91BDE42F6000A3B21 /* AVOSCloud_Internal.h in Headers */, 70CA7FEB1BDE42F6000A3B21 /* AVCacheManager.h in Headers */, 70CA7FEC1BDE42F6000A3B21 /* AVPersistenceUtils.h in Headers */, 70CA7FED1BDE42F6000A3B21 /* AVScheduler.h in Headers */, @@ -2698,7 +2595,6 @@ 8320F8F61C1918C60024B45E /* AVCloudQueryResult.h in Headers */, 8320F8F71C1918C60024B45E /* AVQuery.h in Headers */, 9A404DD61CE5A9BB00DEB3DC /* LCRouter.h in Headers */, - 83B0E5871F28375900EE1A75 /* JRSwizzle.h in Headers */, 83FCB9DA1CEDC57C007D8712 /* LCURLSessionManager.h in Headers */, 8320F8F81C1918C60024B45E /* AVSearchQuery.h in Headers */, 83FCB9D01CEDC57C007D8712 /* LCURLResponseSerialization.h in Headers */, @@ -2707,14 +2603,12 @@ 8320F8FD1C1918C60024B45E /* AVStatus.h in Headers */, 83FCB9A31CEDC57C007D8712 /* LCHTTPSessionManager.h in Headers */, 83FCB9B21CEDC57C007D8712 /* LCNetworkReachabilityManager.h in Headers */, - 83BE73071D8105AF008ED3CF /* EXTScope.h in Headers */, 8320F8FF1C1918C60024B45E /* AVAnonymousUtils.h in Headers */, 8320F9001C1918C60024B45E /* AVUser.h in Headers */, 8320F9011C1918C60024B45E /* AVLogger.h in Headers */, 830EBA031C44F3D600BA917F /* AVSaveOption_internal.h in Headers */, 8320F9021C1918C60024B45E /* AVGlobal.h in Headers */, 83331D511EB9A34000CADC9C /* AVDynamicObject_Internal.h in Headers */, - 83BE73101D810651008ED3CF /* metamacros.h in Headers */, 83FCB9BC1CEDC57C007D8712 /* LCSecurityPolicy.h in Headers */, 8320F90F1C1918C60024B45E /* AVHelpers.h in Headers */, 8320F9111C1918C60024B45E /* LCDatabaseCommon.h in Headers */, @@ -2728,7 +2622,6 @@ 8311CD891C3D25B9007DEFF8 /* AVAvailability.h in Headers */, 8320F9211C1918C60024B45E /* LCDatabasePool.h in Headers */, 830EB9F81C44D68400BA917F /* AVSaveOption.h in Headers */, - 8320F9271C1918C60024B45E /* SDMacros.h in Headers */, 8320F9281C1918C60024B45E /* AVFriendQuery.h in Headers */, 8320F9291C1918C60024B45E /* AVObject_Internal.h in Headers */, 8320F92A1C1918C60024B45E /* AVRelation_Internal.h in Headers */, @@ -2738,13 +2631,11 @@ 8320F92F1C1918C60024B45E /* AVRequestManager.h in Headers */, 8320F9301C1918C60024B45E /* LCDatabaseQueue.h in Headers */, 8320F9311C1918C60024B45E /* LCFileTaskManager.h in Headers */, - 8320F9321C1918C60024B45E /* AVOSCloud_Internal.h in Headers */, 8320F9351C1918C60024B45E /* AVCacheManager.h in Headers */, 8320F9371C1918C60024B45E /* AVUser_Internal.h in Headers */, 8320F9381C1918C60024B45E /* AVInstallation_Internal.h in Headers */, 8320F9391C1918C60024B45E /* AVPersistenceUtils.h in Headers */, 8320F93B1C1918C60024B45E /* AVUtils.h in Headers */, - 8320F93D1C1918C60024B45E /* LCSSLChallenger.h in Headers */, 8320F93E1C1918C60024B45E /* AVScheduler.h in Headers */, 8320F9401C1918C60024B45E /* AVGeoPoint_Internal.h in Headers */, 8320F9471C1918C60024B45E /* AVDuration.h in Headers */, @@ -2808,7 +2699,6 @@ 83D8CEDD1C17DAF50094279D /* AVFile.h in Headers */, 83D8CEDF1C17DAF50094279D /* AVGeoPoint.h in Headers */, 83D8CEE21C17DAF50094279D /* LCDatabaseAdditions.h in Headers */, - 83BE73061D8105AF008ED3CF /* EXTScope.h in Headers */, 83D8CEE81C17DAF50094279D /* AVObject+Subclass.h in Headers */, 83D8CEE91C17DAF50094279D /* AVObject.h in Headers */, 83D8CEEA1C17DAF50094279D /* AVRelation.h in Headers */, @@ -2831,7 +2721,6 @@ 83D8CEFB1C17DAF50094279D /* AVGlobal.h in Headers */, 83331D561EB9D55100CADC9C /* NSDictionary+LeanCloud.h in Headers */, 9A404DD51CE5A9BA00DEB3DC /* LCRouter.h in Headers */, - 83B0E5861F28375900EE1A75 /* JRSwizzle.h in Headers */, 83D8CF081C17DAF50094279D /* AVHelpers.h in Headers */, 83D8CF0A1C17DAF50094279D /* LCDatabaseCommon.h in Headers */, 83D8CF0B1C17DAF50094279D /* LCResultSet.h in Headers */, @@ -2845,8 +2734,6 @@ 83FCB9A21CEDC57C007D8712 /* LCHTTPSessionManager.h in Headers */, 83FCB9C51CEDC57C007D8712 /* LCURLRequestSerialization.h in Headers */, 83D8CF1A1C17DAF50094279D /* LCDatabasePool.h in Headers */, - 83BE730F1D810651008ED3CF /* metamacros.h in Headers */, - 83D8CF201C17DAF50094279D /* SDMacros.h in Headers */, 83D8CF211C17DAF50094279D /* AVFriendQuery.h in Headers */, 83D8CF221C17DAF50094279D /* AVObject_Internal.h in Headers */, 83D8CF231C17DAF50094279D /* AVRelation_Internal.h in Headers */, @@ -2856,7 +2743,6 @@ 83D8CF281C17DAF50094279D /* AVRequestManager.h in Headers */, 83D8CF291C17DAF50094279D /* LCDatabaseQueue.h in Headers */, 83D8CF2A1C17DAF50094279D /* LCFileTaskManager.h in Headers */, - 83D8CF2B1C17DAF50094279D /* AVOSCloud_Internal.h in Headers */, 83D8CF2E1C17DAF50094279D /* AVCacheManager.h in Headers */, 83D8CF301C17DAF50094279D /* AVUser_Internal.h in Headers */, 83D8CF311C17DAF50094279D /* AVInstallation_Internal.h in Headers */, @@ -2865,7 +2751,6 @@ 83D8CF351C17DAF50094279D /* AVAnalyticsSession.h in Headers */, 83331D501EB9A34000CADC9C /* AVDynamicObject_Internal.h in Headers */, 83A2BD321CF33CDA0047B230 /* AVPaasClient_internal.h in Headers */, - 83D8CF361C17DAF50094279D /* LCSSLChallenger.h in Headers */, 83D8CF371C17DAF50094279D /* AVScheduler.h in Headers */, 8311CD881C3D25B9007DEFF8 /* AVAvailability.h in Headers */, 83D8CF391C17DAF50094279D /* AVGeoPoint_Internal.h in Headers */, @@ -2909,7 +2794,6 @@ 8C841ADE1A5A7A0000C5C6C4 /* AVFile.h in Headers */, 8C841AE71A5A7A0000C5C6C4 /* AVGeoPoint.h in Headers */, 83DF02B21AF86032000E289C /* LCDatabaseAdditions.h in Headers */, - 83BE73041D8105AF008ED3CF /* EXTScope.h in Headers */, 8C841B171A5A7A0000C5C6C4 /* AVObject+Subclass.h in Headers */, 8C841B181A5A7A0000C5C6C4 /* AVObject.h in Headers */, 8C841B1D1A5A7A0000C5C6C4 /* AVRelation.h in Headers */, @@ -2931,7 +2815,6 @@ 8C841B601A5A7A0000C5C6C4 /* AVLogger.h in Headers */, 8C841AC31A5A7A0000C5C6C4 /* AVGlobal.h in Headers */, 83331D541EB9D55100CADC9C /* NSDictionary+LeanCloud.h in Headers */, - 83B0E5841F28375900EE1A75 /* JRSwizzle.h in Headers */, 8C841B5E1A5A7A0000C5C6C4 /* AVHelpers.h in Headers */, 830E7CFF1B1CB07B005F4B22 /* LCDatabaseCommon.h in Headers */, 83DF02B91AF86032000E289C /* LCResultSet.h in Headers */, @@ -2944,8 +2827,6 @@ 8C841B301A5A7A0000C5C6C4 /* AVRequestOperation.h in Headers */, 8C841AB81A5A7A0000C5C6C4 /* AVAnalyticsImpl.h in Headers */, 83DF02B41AF86032000E289C /* LCDatabasePool.h in Headers */, - 836705AB1BA1358D0050E968 /* SDMacros.h in Headers */, - 83BE730D1D810651008ED3CF /* metamacros.h in Headers */, 83FCB9C21CEDC57C007D8712 /* LCURLRequestSerialization.h in Headers */, 8C841B2A1A5A7A0000C5C6C4 /* AVFriendQuery.h in Headers */, 8C841B1A1A5A7A0000C5C6C4 /* AVObject_Internal.h in Headers */, @@ -2956,7 +2837,6 @@ 7068A7231BA3614D0004623A /* AVRequestManager.h in Headers */, 83DF02B61AF86032000E289C /* LCDatabaseQueue.h in Headers */, 8C841AE51A5A7A0000C5C6C4 /* LCFileTaskManager.h in Headers */, - 8C841AC51A5A7A0000C5C6C4 /* AVOSCloud_Internal.h in Headers */, 83A2BD2F1CF33CDA0047B230 /* AVPaasClient_internal.h in Headers */, 8C841AC81A5A7A0000C5C6C4 /* AVCacheManager.h in Headers */, 8C841B5B1A5A7A0000C5C6C4 /* AVUser_Internal.h in Headers */, @@ -2966,7 +2846,6 @@ 83F9A2C71CE014430002E21B /* LCRouter.h in Headers */, 8C841ABA1A5A7A0000C5C6C4 /* AVAnalyticsSession.h in Headers */, 83331D4E1EB9A34000CADC9C /* AVDynamicObject_Internal.h in Headers */, - 838DD7C21B42630400C95897 /* LCSSLChallenger.h in Headers */, 83FCB9B81CEDC57C007D8712 /* LCSecurityPolicy.h in Headers */, 8C841ACC1A5A7A0000C5C6C4 /* AVScheduler.h in Headers */, 8311CD851C3D25B9007DEFF8 /* AVAvailability.h in Headers */, @@ -3067,9 +2946,7 @@ 8C841C101A5A84C600C5C6C4 /* AVIMConversation_Internal.h in Headers */, 83F745F31B91732D00437259 /* LCIMMessageCacheStoreSQL.h in Headers */, 9AD27C3F1E1418DB002F9C7C /* LCIMAny.pbobjc.h in Headers */, - 8C841C401A5A84C600C5C6C4 /* AVIMRuntimeHelper.h in Headers */, 9A2F1B521CF6F6FA00BE52F2 /* LCIMRuntimeTypes.h in Headers */, - 83BE43971D242905000C7AC3 /* SDMacros.h in Headers */, D328B8E820FEE2200039091A /* AVIMClientInternalConversationManager.h in Headers */, 9AD27C471E1418DB002F9C7C /* LCIMDuration.pbobjc.h in Headers */, 9A7C67D71C3FDD1D00B08D4F /* AVIMDirectCommand+DirectCommandAdditions.h in Headers */, @@ -3321,7 +3198,7 @@ attributes = { CLASSPREFIX = AV; LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 0930; + LastUpgradeCheck = 1100; ORGANIZATIONNAME = "LeanCloud Inc."; TargetAttributes = { 704F3B6D1BE0D0180033245C = { @@ -3336,7 +3213,7 @@ }; 838CE3221EC97E6E00B24F5B = { CreatedOnToolsVersion = 8.3.2; - LastSwiftMigration = 0940; + LastSwiftMigration = 1100; ProvisioningStyle = Automatic; }; 8C8419851A5A791300C5C6C4 = { @@ -3345,14 +3222,14 @@ }; 8C8419901A5A791300C5C6C4 = { CreatedOnToolsVersion = 6.1.1; - LastSwiftMigration = ""; + LastSwiftMigration = 1100; }; 8C8419C21A5A796000C5C6C4 = { CreatedOnToolsVersion = 6.1.1; }; 8C8419CC1A5A796000C5C6C4 = { CreatedOnToolsVersion = 6.1.1; - LastSwiftMigration = ""; + LastSwiftMigration = 1100; }; D3078A782010739700A4C5FD = { CreatedOnToolsVersion = 9.2; @@ -3363,10 +3240,9 @@ }; buildConfigurationList = 8C84197E1A5A78E100C5C6C4 /* Build configuration list for PBXProject "AVOS" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( - English, en, Base, ); @@ -3567,7 +3443,6 @@ 9A2F1B181CF6F6FA00BE52F2 /* LCIMCodedOutputStream.m in Sources */, 704F3BB51BE0D05C0033245C /* AVIMFileMessage.m in Sources */, 704F3BB61BE0D05C0033245C /* AVIMBlockHelper.m in Sources */, - 704F3BB71BE0D05C0033245C /* AVIMRuntimeHelper.m in Sources */, 704F3BB81BE0D05C0033245C /* AVIMErrorUtil.m in Sources */, 704F3BBB1BE0D05C0033245C /* AVIMWebSocketWrapper.m in Sources */, 9AE76C541C3F7CC600325902 /* AVIMCommandFormatter.m in Sources */, @@ -3578,7 +3453,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 83BE73091D8105AF008ED3CF /* EXTScope.m in Sources */, 70CA7F9E1BDE374C000A3B21 /* LCDatabase.m in Sources */, 70CA7F9F1BDE374C000A3B21 /* LCDatabaseAdditions.m in Sources */, 70CA7FA01BDE374C000A3B21 /* LCDatabasePool.m in Sources */, @@ -3595,7 +3469,6 @@ 70CA7FAF1BDE374C000A3B21 /* LCDatabaseCoordinator.m in Sources */, 70CA7FB01BDE374C000A3B21 /* LCDatabaseMigrator.m in Sources */, 70CA7FB21BDE374C000A3B21 /* LCKeyValueStore.m in Sources */, - 70CA7FB31BDE374C000A3B21 /* LCSSLChallenger.m in Sources */, 70CA7FB41BDE374C000A3B21 /* NSDictionary+LCHash.m in Sources */, 70CA7F721BDE3721000A3B21 /* AVACL.m in Sources */, 70CA7F731BDE3721000A3B21 /* AVRole.m in Sources */, @@ -3610,7 +3483,6 @@ 70CA7F7C1BDE3721000A3B21 /* AVCacheManager.m in Sources */, 70CA7F7D1BDE3721000A3B21 /* AVPersistenceUtils.m in Sources */, 70CA7F7E1BDE3721000A3B21 /* AVScheduler.m in Sources */, - 83B0E5891F28375900EE1A75 /* JRSwizzle.m in Sources */, 70CA7F7F1BDE3721000A3B21 /* AVCloud.m in Sources */, 70CA7F801BDE3721000A3B21 /* AVFile.m in Sources */, 70CA7F811BDE3721000A3B21 /* AVFileQuery.m in Sources */, @@ -3654,7 +3526,6 @@ 8320F87D1C1918C60024B45E /* AVFile.m in Sources */, 8320F87F1C1918C60024B45E /* LCDatabaseQueue.m in Sources */, 8320F8801C1918C60024B45E /* AVRequestManager.m in Sources */, - 83B0E58B1F28375900EE1A75 /* JRSwizzle.m in Sources */, 8320F8811C1918C60024B45E /* AVFileQuery.m in Sources */, 8320F8821C1918C60024B45E /* LCDatabaseAdditions.m in Sources */, 8320F8831C1918C60024B45E /* AVUtils.m in Sources */, @@ -3676,12 +3547,10 @@ 830EB9FD1C44D68400BA917F /* AVSaveOption.m in Sources */, 8320F89E1C1918C60024B45E /* AVOSCloud.m in Sources */, 8320F8A01C1918C60024B45E /* AVObjectUtils.m in Sources */, - 8320F8A11C1918C60024B45E /* LCSSLChallenger.m in Sources */, 8320F8A51C1918C60024B45E /* AVCloud.m in Sources */, 8320F8A61C1918C60024B45E /* AVObject.m in Sources */, 8320F8A91C1918C60024B45E /* LCFileTaskManager.m in Sources */, 8320F8AA1C1918C60024B45E /* AVSearchSortBuilder.m in Sources */, - 83BE730B1D8105AF008ED3CF /* EXTScope.m in Sources */, 8320F8AC1C1918C60024B45E /* LCNetworkStatistics.m in Sources */, 8320F8AD1C1918C60024B45E /* AVDuration.m in Sources */, 8320F8AF1C1918C60024B45E /* AVRole.m in Sources */, @@ -3754,7 +3623,6 @@ 83D8CE7B1C17DAF50094279D /* LCDatabaseAdditions.m in Sources */, 83D8CE7C1C17DAF50094279D /* AVUtils.m in Sources */, 83D8CE7E1C17DAF50094279D /* AVAnalyticsUtils.m in Sources */, - 83BE730A1D8105AF008ED3CF /* EXTScope.m in Sources */, 83D8CE831C17DAF50094279D /* AVSearchQuery.m in Sources */, 83FCB9DE1CEDC57C007D8712 /* LCURLSessionManager.m in Sources */, 83FCB9D41CEDC57C007D8712 /* LCURLResponseSerialization.m in Sources */, @@ -3772,7 +3640,6 @@ 83D8CE951C17DAF50094279D /* LCDatabasePool.m in Sources */, 83D8CE971C17DAF50094279D /* AVOSCloud.m in Sources */, 83D8CE991C17DAF50094279D /* AVObjectUtils.m in Sources */, - 83D8CE9A1C17DAF50094279D /* LCSSLChallenger.m in Sources */, 83D8CE9E1C17DAF50094279D /* AVCloud.m in Sources */, 83D8CE9F1C17DAF50094279D /* AVObject.m in Sources */, 83D8CEA01C17DAF50094279D /* AVAnalyticsActivity.m in Sources */, @@ -3782,7 +3649,6 @@ 83D8CEA61C17DAF50094279D /* AVDuration.m in Sources */, 83D8CEA81C17DAF50094279D /* AVRole.m in Sources */, 835092031EB1BDD0000DA884 /* AVSMS.m in Sources */, - 83B0E58A1F28375900EE1A75 /* JRSwizzle.m in Sources */, 83D8CEA91C17DAF50094279D /* AVPaasClient.m in Sources */, 8302AEDD1C192A0700E13F8A /* LCURLConnection.m in Sources */, 83D8CEAB1C17DAF50094279D /* AVErrorUtils.m in Sources */, @@ -3825,7 +3691,6 @@ 83DF02B31AF86032000E289C /* LCDatabaseAdditions.m in Sources */, 8C841B651A5A7A0000C5C6C4 /* AVUtils.m in Sources */, 8C841ABD1A5A7A0000C5C6C4 /* AVAnalyticsUtils.m in Sources */, - 83BE73081D8105AF008ED3CF /* EXTScope.m in Sources */, 8C841B371A5A7A0000C5C6C4 /* AVSearchQuery.m in Sources */, 83FCB9DB1CEDC57C007D8712 /* LCURLSessionManager.m in Sources */, 83FCB9D11CEDC57C007D8712 /* LCURLResponseSerialization.m in Sources */, @@ -3843,7 +3708,6 @@ 83DF02B51AF86032000E289C /* LCDatabasePool.m in Sources */, 8C841AC71A5A7A0000C5C6C4 /* AVOSCloud.m in Sources */, 8C841B1C1A5A7A0000C5C6C4 /* AVObjectUtils.m in Sources */, - 838DD7C31B42630400C95897 /* LCSSLChallenger.m in Sources */, 8C841ACF1A5A7A0000C5C6C4 /* AVCloud.m in Sources */, 8C841B191A5A7A0000C5C6C4 /* AVObject.m in Sources */, 8C841AB71A5A7A0000C5C6C4 /* AVAnalyticsActivity.m in Sources */, @@ -3853,7 +3717,6 @@ 8C841ABF1A5A7A0000C5C6C4 /* AVDuration.m in Sources */, 8C841AB11A5A7A0000C5C6C4 /* AVRole.m in Sources */, 835092011EB1BDD0000DA884 /* AVSMS.m in Sources */, - 83B0E5881F28375900EE1A75 /* JRSwizzle.m in Sources */, 8C841B331A5A7A0000C5C6C4 /* AVPaasClient.m in Sources */, 8302AEDA1C192A0700E13F8A /* LCURLConnection.m in Sources */, 8C841B5D1A5A7A0000C5C6C4 /* AVErrorUtils.m in Sources */, @@ -3893,6 +3756,7 @@ D30DF3F71FDE2CD200F932BC /* AVUserTestCase.swift in Sources */, D30DF4161FDE38EF00F932BC /* LCTestBase.swift in Sources */, D336C570212D02A2008D0E3E /* LCRouterTestCase.swift in Sources */, + D3FF8D35233E0B2A00017A45 /* AVInstallationTestCase.swift in Sources */, D3CC90CB2069E5BB0082EFD4 /* AVObjectTestCase.swift in Sources */, D3F8747B20F8B1690035C7D1 /* LCTestEnvironment.m in Sources */, D3472E1F2015CBC200AAD65F /* AVFileTestCase.swift in Sources */, @@ -3916,7 +3780,6 @@ 9AD27C411E1418DB002F9C7C /* LCIMAny.pbobjc.m in Sources */, 9A7C67DA1C3FDD1D00B08D4F /* AVIMDirectCommand+DirectCommandAdditions.m in Sources */, 834B4A9D1B94080500A7ADBC /* LCIMConversationQueryCacheStore.m in Sources */, - 8C841C411A5A84C600C5C6C4 /* AVIMRuntimeHelper.m in Sources */, 9AD27C591E1418DB002F9C7C /* LCIMStruct.pbobjc.m in Sources */, 9AD392431BFC395200D28074 /* AVIMConversationOutCommand.m in Sources */, 8C841C0D1A5A84C600C5C6C4 /* AVIMClient.m in Sources */, @@ -4366,7 +4229,6 @@ PRODUCT_NAME = AVOSCloud; SDKROOT = watchos; SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; WATCHOS_DEPLOYMENT_TARGET = 2.0; @@ -4394,7 +4256,7 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Distribution"; + CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; COPY_PHASE_STRIP = YES; CURRENT_PROJECT_VERSION = 3; @@ -4425,7 +4287,6 @@ PRODUCT_NAME = AVOSCloud; SDKROOT = watchos; SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -4484,7 +4345,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; INFOPLIST_FILE = "Resources/$(TARGET_NAME).info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.3; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MACH_O_TYPE = staticlib; MTL_ENABLE_DEBUG_INFO = YES; @@ -4542,7 +4403,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; INFOPLIST_FILE = "Resources/$(TARGET_NAME).info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.3; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MACH_O_TYPE = staticlib; MTL_ENABLE_DEBUG_INFO = NO; @@ -4617,7 +4478,7 @@ SWIFT_OBJC_BRIDGING_HEADER = "AVOSCloudLiveQueryTests/Swift/AVOSCloudLiveQuery-iOSTests-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -4678,7 +4539,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "AVOSCloudLiveQueryTests/Swift/AVOSCloudLiveQuery-iOSTests-Bridging-Header.h"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; VALIDATE_PRODUCT = YES; }; name = Release; @@ -4737,6 +4598,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 10.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MACH_O_TYPE = staticlib; + MACOSX_DEPLOYMENT_TARGET = 10.9; MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = cn.leancloud.AVOSCloudLiveQuery; PRODUCT_NAME = AVOSCloudLiveQuery; @@ -4796,6 +4658,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 10.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MACH_O_TYPE = staticlib; + MACOSX_DEPLOYMENT_TARGET = 10.9; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = cn.leancloud.AVOSCloudLiveQuery; PRODUCT_NAME = AVOSCloudLiveQuery; @@ -4866,7 +4729,6 @@ PRODUCT_NAME = AVOSCloud; SDKROOT = appletvos; SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; TVOS_DEPLOYMENT_TARGET = 9.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -4894,7 +4756,7 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Distribution"; + CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; COPY_PHASE_STRIP = YES; @@ -4926,7 +4788,6 @@ PRODUCT_NAME = AVOSCloud; SDKROOT = appletvos; SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; TVOS_DEPLOYMENT_TARGET = 9.0; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -4937,6 +4798,7 @@ 8C84197F1A5A78E100C5C6C4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; @@ -4969,7 +4831,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.8; + MACOSX_DEPLOYMENT_TARGET = 10.9; ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = ""; OTHER_LDFLAGS = ( @@ -4984,6 +4846,7 @@ 8C8419801A5A78E100C5C6C4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; @@ -5014,7 +4877,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.8; + MACOSX_DEPLOYMENT_TARGET = 10.9; OTHER_CFLAGS = ""; OTHER_LDFLAGS = ( "-lsqlite3", @@ -5047,7 +4910,7 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 3; @@ -5114,7 +4977,7 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; COPY_PHASE_STRIP = YES; CURRENT_PROJECT_VERSION = 3; @@ -5215,7 +5078,7 @@ SWIFT_OBJC_BRIDGING_HEADER = "AVOSCloudTests/Swift/AVOSCloud-iOSTests-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -5274,7 +5137,7 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = ""; SWIFT_OBJC_BRIDGING_HEADER = "AVOSCloudTests/Swift/AVOSCloud-iOSTests-Bridging-Header.h"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -5299,7 +5162,7 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 3; @@ -5366,7 +5229,7 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; COPY_PHASE_STRIP = YES; CURRENT_PROJECT_VERSION = 3; @@ -5466,7 +5329,7 @@ SWIFT_OBJC_BRIDGING_HEADER = "AVOSCloudIMTests/Swift/AVOSCloudIM-iOSTests-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -5524,7 +5387,7 @@ SDKROOT = iphoneos; SWIFT_OBJC_BRIDGING_HEADER = "AVOSCloudIMTests/Swift/AVOSCloudIM-iOSTests-Bridging-Header.h"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; VALIDATE_PRODUCT = YES; }; name = Release; diff --git a/AVOS/AVOS.xcodeproj/xcshareddata/xcschemes/AVOSCloud-iOS.xcscheme b/AVOS/AVOS.xcodeproj/xcshareddata/xcschemes/AVOSCloud-iOS.xcscheme index ea2e89ddf..f2a375aa2 100644 --- a/AVOS/AVOS.xcodeproj/xcshareddata/xcschemes/AVOSCloud-iOS.xcscheme +++ b/AVOS/AVOS.xcodeproj/xcshareddata/xcschemes/AVOSCloud-iOS.xcscheme @@ -1,6 +1,6 @@ + + + + @@ -44,17 +53,6 @@ - - - - - - - - - - - - + + + + @@ -39,17 +48,6 @@ - - - - - - - - - - - - - - - - + + + + @@ -39,17 +48,6 @@ - - - - - - - - - - - - + + + + @@ -39,17 +48,6 @@ - - - - - - - - - - - - - - - - - - - - _verbosePolicy = kAVVerboseAuto; }); - - return sharedInstance; -} - -+ (void)setSSLPinningEnabled:(BOOL)enabled -{ - if (LCInitialized) { - - [NSException raise:NSInternalInconsistencyException - format:@"SSL Pinning Enabled should be set before +[AVOSCloud setApplicationId:clientKey:]."]; - } - - LCSSLPinningEnabled = enabled; -} - -+ (BOOL)isSSLPinningEnabled -{ - return LCSSLPinningEnabled; + return instance; } + (void)setAllLogsEnabled:(BOOL)enabled { @@ -73,10 +45,11 @@ + (void)setAllLogsEnabled:(BOOL)enabled { } + (void)setVerbosePolicy:(AVVerbosePolicy)verbosePolicy { - _verbosePolicy = verbosePolicy; + [AVOSCloud sharedInstance]->_verbosePolicy = verbosePolicy; } -+ (void)logApplicationInfo { ++ (void)logApplicationInfo +{ const char *s = (const char *)AVOSCloud_Art_inc; printf("%s\n", s); printf("appid: %s\n", [[self getApplicationId] UTF8String]); @@ -88,80 +61,92 @@ + (void)logApplicationInfo { printf("----------------------------------------------------------\n"); } -+ (void)initializePaasClient { ++ (void)initializePaasClient +{ AVPaasClient *paasClient = [AVPaasClient sharedInstance]; - + paasClient.applicationId = [self getApplicationId]; paasClient.clientKey = [self getClientKey]; - + // always handle offline requests, include analytics collection [paasClient handleAllArchivedRequests]; } -+ (void)setApplicationId:(NSString *)applicationId clientKey:(NSString *)clientKey ++ (void)setApplicationId:(NSString *)applicationId + clientKey:(NSString *)clientKey + serverURLString:(NSString *)serverURLString { - [AVOSCloud sharedInstance]->_applicationId = applicationId; - [AVOSCloud sharedInstance]->_applicationKey = clientKey; - - if (_verbosePolicy == kAVVerboseShow) { - [self logApplicationInfo]; - } - - [self initializePaasClient]; - [LCRouter sharedInstance]; - - LCInitialized = YES; + [[LCRouter sharedInstance] setServerURLString:serverURLString]; + [AVOSCloud setApplicationId:applicationId clientKey:clientKey]; } -+ (BOOL)isTwoArrayEqual:(NSArray *)array withAnotherArray:(NSArray *)anotherArray ++ (void)setApplicationId:(NSString *)applicationId + clientKey:(NSString *)clientKey { - if (array.count != anotherArray.count) { - return NO; + AppDomain appDomain = [LCRouter appDomainForAppID:applicationId]; + if ([appDomain isEqualToString:AppDomainCN] || + [appDomain isEqualToString:AppDomainCE]) { + if (![LCRouter sharedInstance].serverURLString) { + [NSException raise:NSInternalInconsistencyException + format:@"Server URL not set."] ; + } } - NSSet *set = [NSSet setWithArray:array]; - NSMutableSet *set1 = [NSMutableSet setWithSet:set]; - NSSet *set2 = [NSSet setWithArray:anotherArray]; - [set1 unionSet:set2]; - - return set1.count == array.count; + [AVOSCloud sharedInstance]->_applicationId = applicationId; + [AVOSCloud sharedInstance]->_applicationKey = clientKey; + + [self initializePaasClient]; + + if ([AVOSCloud sharedInstance]->_verbosePolicy == kAVVerboseShow) { + [self logApplicationInfo]; + } } -+ (NSString *)getApplicationId -{ ++ (NSString *)getApplicationId { return [AVOSCloud sharedInstance]->_applicationId; } -+ (NSString *)getClientKey -{ ++ (NSString *)getClientKey { return [AVOSCloud sharedInstance]->_applicationKey; } -+ (void)setLastModifyEnabled:(BOOL)enabled{ ++ (void)setLastModifyEnabled:(BOOL)enabled { [AVPaasClient sharedInstance].isLastModifyEnabled=enabled; } /** * 获取是否开启LastModify支持 */ -+ (BOOL)getLastModifyEnabled{ ++ (BOOL)getLastModifyEnabled { return [AVPaasClient sharedInstance].isLastModifyEnabled; } -+(void)clearLastModifyCache { ++ (void)clearLastModifyCache { [[AVPaasClient sharedInstance] clearLastModifyCache]; } -+ (void)setServerURLString:(NSString * _Nullable)URLString forServiceModule:(AVServiceModule)serviceModule ++ (void)setServerURLString:(NSString *)URLString + forServiceModule:(AVServiceModule)serviceModule { NSString *key = nil; switch (serviceModule) { - case AVServiceModuleAPI: key = RouterKeyAppAPIServer; break; - case AVServiceModuleRTM: key = RouterKeyAppRTMRouterServer; break; - case AVServiceModulePush: key = RouterKeyAppPushServer; break; - case AVServiceModuleEngine: key = RouterKeyAppEngineServer; break; - case AVServiceModuleStatistics: key = RouterKeyAppStatsServer; break; - default: return; + case AVServiceModuleAPI: + key = RouterKeyAppAPIServer; + break; + case AVServiceModuleRTM: + key = RouterKeyAppRTMRouterServer; + break; + case AVServiceModulePush: + key = RouterKeyAppPushServer; + break; + case AVServiceModuleEngine: + key = RouterKeyAppEngineServer; + break; + case AVServiceModuleStatistics: + key = RouterKeyAppStatsServer; + break; + default: + return; } [[LCRouter sharedInstance] customAppServerURL:URLString key:key]; } @@ -213,7 +198,10 @@ + (void)setFileCacheExpiredDays:(NSInteger)days { [AVScheduler sharedInstance].fileCacheExpiredDays = days; } -+(void)verifySmsCode:(NSString *)code mobilePhoneNumber:(NSString *)phoneNumber callback:(AVBooleanResultBlock)callback { ++ (void)verifySmsCode:(NSString *)code + mobilePhoneNumber:(NSString *)phoneNumber + callback:(AVBooleanResultBlock)callback +{ NSParameterAssert(code); NSParameterAssert(phoneNumber); @@ -264,27 +252,12 @@ + (void)setTimeZoneForSecondsFromGMT:(NSInteger)seconds #pragma mark - Push Notification -+ (void)handleRemoteNotificationsWithDeviceToken:(NSData *)deviceToken -{ - [self handleRemoteNotificationsWithDeviceToken:deviceToken - teamId:nil - constructingInstallationWithBlock:nil]; -} - + (void)handleRemoteNotificationsWithDeviceToken:(NSData *)deviceToken teamId:(NSString *)teamId { - [self handleRemoteNotificationsWithDeviceToken:deviceToken - teamId:teamId - constructingInstallationWithBlock:nil]; -} - -+ (void)handleRemoteNotificationsWithDeviceToken:(NSData *)deviceToken - constructingInstallationWithBlock:(void (^)(AVInstallation *))block -{ - [self handleRemoteNotificationsWithDeviceToken:deviceToken - teamId:nil - constructingInstallationWithBlock:block]; + [AVOSCloud handleRemoteNotificationsWithDeviceToken:deviceToken + teamId:teamId + constructingInstallationWithBlock:nil]; } + (void)handleRemoteNotificationsWithDeviceToken:(NSData *)deviceToken @@ -292,21 +265,16 @@ + (void)handleRemoteNotificationsWithDeviceToken:(NSData *)deviceToken constructingInstallationWithBlock:(void (^)(AVInstallation *))block { AVInstallation *installation = [AVInstallation defaultInstallation]; - - @weakify(installation, weakInstallation); - [installation setDeviceTokenFromData:deviceToken teamId:teamId]; - if (block) { block(installation); } - [installation saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) { if (error) { - AVLoggerError(AVLoggerDomainIM, @"Installation saved failed, reason: %@.", error.localizedDescription); + AVLoggerError(AVLoggerDomainDefault, @"default installation save failed: %@", error); } else { - AVLoggerInfo(AVLoggerDomainIM, @"Installation saved OK, object id: %@.", weakInstallation.objectId); + AVLoggerInfo(AVLoggerDomainDefault, @"default installation save success"); } }]; } @@ -383,36 +351,4 @@ + (void)requestVoiceCodeWithPhoneNumber:(NSString *)phoneNumber }]; } -+ (void)registerForRemoteNotification { -#if AV_TARGET_OS_IOS - [self registerForRemoteNotificationTypes: - UIRemoteNotificationTypeBadge | - UIRemoteNotificationTypeAlert | - UIRemoteNotificationTypeSound categories:nil]; -#elif AV_TARGET_OS_OSX - [self registerForRemoteNotificationTypes: - NSRemoteNotificationTypeAlert | - NSRemoteNotificationTypeBadge | - NSRemoteNotificationTypeSound categories:nil]; -#endif -} - -+ (void)registerForRemoteNotificationTypes:(NSUInteger)types categories:(NSSet *)categories { -#if AV_TARGET_OS_IOS - UIApplication *application = [UIApplication sharedApplication]; - - if ([[UIDevice currentDevice].systemVersion floatValue] < 8.0) { - [application registerForRemoteNotificationTypes:types]; - } else { - UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:types categories:categories]; - - [application registerUserNotificationSettings:settings]; - [application registerForRemoteNotifications]; - } -#elif AV_TARGET_OS_OSX - NSApplication *application = [NSApplication sharedApplication]; - [application registerForRemoteNotificationTypes:types]; -#endif -} - @end diff --git a/AVOS/AVOSCloud/AVOSCloud_Internal.h b/AVOS/AVOSCloud/AVOSCloud_Internal.h deleted file mode 100644 index 068c38c80..000000000 --- a/AVOS/AVOSCloud/AVOSCloud_Internal.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// AVOSCloud_Internal.h -// paas -// -// Created by Travis on 14-2-11. -// Copyright (c) 2014年 AVOS. All rights reserved. -// - - -#import - -@interface AVOSCloud () - -+ (BOOL)isSSLPinningEnabled; - -@end diff --git a/AVOS/AVOSCloud/Analytics/AVAnalytics.m b/AVOS/AVOSCloud/Analytics/AVAnalytics.m index ebe09969c..5d19a0b1d 100644 --- a/AVOS/AVOSCloud/Analytics/AVAnalytics.m +++ b/AVOS/AVOSCloud/Analytics/AVAnalytics.m @@ -12,9 +12,6 @@ #import "AVAnalyticsUtils.h" #import "AVUtils.h" -#import "AVOSCloud_Internal.h" -//#import - static NSString * endPoint = @"statistics"; static NSString * appOpen = @"!AV!AppOpen"; diff --git a/AVOS/AVOSCloud/CloudCode/AVCloud.h b/AVOS/AVOSCloud/CloudCode/AVCloud.h index 24c3c74d3..a794ccde2 100644 --- a/AVOS/AVOSCloud/CloudCode/AVCloud.h +++ b/AVOS/AVOSCloud/CloudCode/AVCloud.h @@ -42,15 +42,6 @@ NS_ASSUME_NONNULL_BEGIN */ + (void)callFunctionInBackground:(NSString *)function withParameters:(nullable NSDictionary *)parameters block:(AVIdResultBlock)block; -/*! - Calls the given cloud function with the parameters provided asynchronously and runs the callback when it is done. - @param function The function name to call. - @param parameters The parameters to send to the function. - @param target The object to call the selector on. - @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(id) result error:(NSError *)error. result will be nil if error is set and vice versa. - */ -+ (void)callFunctionInBackground:(NSString *)function withParameters:(nullable NSDictionary *)parameters target:(id)target selector:(SEL)selector; - /*! Calls the given cloud function with the parameters passed in by RPC. @param function The function name to call. @@ -76,15 +67,6 @@ NS_ASSUME_NONNULL_BEGIN */ + (void)rpcFunctionInBackground:(NSString *)function withParameters:(nullable id)parameters block:(AVIdResultBlock)block; -/*! - Calls the given cloud function with the parameters provided by RPC asynchronously and runs the callback when it is done. - @param function The function name to call. - @param parameters The parameters to send to the function. - @param target The object to call the selector on. - @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(id) result error:(NSError *)error. result will be nil if error is set and vice versa. - */ -+ (void)rpcFunctionInBackground:(NSString *)function withParameters:(nullable id)parameters target:(id)target selector:(SEL)selector; - /** * Set call what production mode's cloud code * diff --git a/AVOS/AVOSCloud/CloudCode/AVCloud.m b/AVOS/AVOSCloud/CloudCode/AVCloud.m index f6db189ca..fadc1c195 100644 --- a/AVOS/AVOSCloud/CloudCode/AVCloud.m +++ b/AVOS/AVOSCloud/CloudCode/AVCloud.m @@ -14,7 +14,6 @@ #import "AVFile_Internal.h" #import "AVGeoPoint_Internal.h" #import "AVObjectUtils.h" -#import "AVOSCloud_Internal.h" #import "AVLogger.h" #import "AVUtils.h" @@ -86,13 +85,6 @@ + (void)callFunctionInBackground:(NSString *)function withParameters:(NSDictiona }); } -+ (void)callFunctionInBackground:(NSString *)function withParameters:(NSDictionary *)parameters target:(id)target selector:(SEL)selector -{ - [[self class] callFunctionInBackground:function withParameters:parameters block:^(id object, NSError *error) { - [AVUtils performSelectorIfCould:target selector:selector object:object object:error]; - }]; -} - + (id)rpcFunction:(NSString *)function withParameters:(id)parameters { return [self rpcFunction:function withParameters:parameters error:NULL]; } @@ -140,12 +132,6 @@ + (void)rpcFunctionInBackground:(NSString *)function withParameters:(id)paramete }]; } -+ (void)rpcFunctionInBackground:(NSString *)function withParameters:(id)parameters target:(id)target selector:(SEL)selector { - [self rpcFunctionInBackground:function withParameters:parameters block:^(id object, NSError *error) { - [AVUtils performSelectorIfCould:target selector:selector object:object object:error]; - }]; -} - #pragma mark - Data from LeanEngine /* response: Dictionary/Array or Simple Objects like String/Number(all from json) diff --git a/AVOS/AVOSCloud/Object/AVObject.h b/AVOS/AVOSCloud/Object/AVObject.h index 9bd43a0d2..6b093bf6e 100644 --- a/AVOS/AVOSCloud/Object/AVObject.h +++ b/AVOS/AVOSCloud/Object/AVObject.h @@ -286,21 +286,6 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)saveInBackgroundWithOption:(nullable AVSaveOption *)option eventually:(BOOL)eventually block:(AVBooleanResultBlock)block; -/*! - Saves the AVObject asynchronously and calls the given callback. - @param target The object to call selector on. - @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(NSNumber *)result error:(NSError *)error. error will be nil on success and set if there was an error. [result boolValue] will tell you whether the call succeeded or not. - */ -- (void)saveInBackgroundWithTarget:(id)target selector:(SEL)selector; - -/*! - * Saves the AVObject with option asynchronously and calls the given callback. - * @param option Option for current save. - * @param target The object to call selector on. - * @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(NSNumber *)result error:(NSError *)error. error will be nil on success and set if there was an error. [result boolValue] will tell you whether the call succeeded or not. - */ -- (void)saveInBackgroundWithOption:(nullable AVSaveOption *)option target:(id)target selector:(SEL)selector; - /*! @see saveEventually: */ @@ -358,16 +343,6 @@ NS_ASSUME_NONNULL_BEGIN + (void)saveAllInBackground:(NSArray *)objects block:(AVBooleanResultBlock)block; -/*! - Saves a collection of objects all at once asynchronously and calls a callback when done. - @param objects The array of objects to save. - @param target The object to call selector on. - @param selector The selector to call. It should have the following signature: (void)callbackWithError:(NSError *)error. error will be nil on success and set if there was an error. - */ -+ (void)saveAllInBackground:(NSArray *)objects - target:(id)target - selector:(SEL)selector; - #pragma mark - Refresh /*! @name Getting an Object from LeanCloud */ @@ -419,12 +394,6 @@ NS_ASSUME_NONNULL_BEGIN - (void)refreshInBackgroundWithKeys:(NSArray *)keys block:(AVObjectResultBlock)block; -/*! - Refreshes the AVObject asynchronously and calls the given callback. - @param target The target on which the selector will be called. - @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(AVObject *)refreshedObject error:(NSError *)error. error will be nil on success and set if there was an error. refreshedObject will be the AVObject with the refreshed data. - */ -- (void)refreshInBackgroundWithTarget:(id)target selector:(SEL)selector; #endif #pragma mark - Fetch @@ -506,27 +475,12 @@ NS_ASSUME_NONNULL_BEGIN - (void)fetchInBackgroundWithKeys:(nullable NSArray *)keys block:(AVObjectResultBlock)block; -/*! - Fetches the AVObject asynchronously and calls the given callback. - @param target The target on which the selector will be called. - @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(AVObject *)refreshedObject error:(NSError *)error. error will be nil on success and set if there was an error. refreshedObject will be the AVObject with the refreshed data. - */ -- (void)fetchInBackgroundWithTarget:(id)target selector:(SEL)selector; - /*! Fetches the AVObject's data asynchronously if isDataAvailable is false, then calls the callback block. @param block The block to execute. The block should have the following argument signature: (AVObject *object, NSError *error) */ - (void)fetchIfNeededInBackgroundWithBlock:(AVObjectResultBlock)block; -/*! - Fetches the AVObject's data asynchronously if isDataAvailable is false, then calls the callback. - @param target The target on which the selector will be called. - @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(AVObject *)fetchedObject error:(NSError *)error. error will be nil on success and set if there was an error. - */ -- (void)fetchIfNeededInBackgroundWithTarget:(id)target - selector:(SEL)selector; - /*! @name Getting Many Objects from LeanCloud */ /*! @@ -565,16 +519,6 @@ NS_ASSUME_NONNULL_BEGIN + (void)fetchAllInBackground:(NSArray *)objects block:(AVArrayResultBlock)block; -/*! - Fetches all of the AVObjects with the current data from the server asynchronously and calls the given callback. - @param objects The list of objects to fetch. - @param target The target on which the selector will be called. - @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(NSArray *)fetchedObjects error:(NSError *)error. error will be nil on success and set if there was an error. fetchedObjects will the array of AVObjects that were fetched. - */ -+ (void)fetchAllInBackground:(NSArray *)objects - target:(id)target - selector:(SEL)selector; - /*! Fetches all of the AVObjects with the current data from the server asynchronously and calls the given block. @param objects The list of objects to fetch. @@ -583,17 +527,6 @@ NS_ASSUME_NONNULL_BEGIN + (void)fetchAllIfNeededInBackground:(NSArray *)objects block:(AVArrayResultBlock)block; -/*! - Fetches all of the AVObjects with the current data from the server asynchronously and calls the given callback. - @param objects The list of objects to fetch. - @param target The target on which the selector will be called. - @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(NSArray *)fetchedObjects error:(NSError *)error. error will be nil on success and set if there was an error. fetchedObjects will the array of AVObjects - that were fetched. - */ -+ (void)fetchAllIfNeededInBackground:(NSArray *)objects - target:(id)target - selector:(SEL)selector; - #pragma mark - Delete /*! @name Removing an Object from LeanCloud */ @@ -628,14 +561,6 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)deleteInBackgroundWithBlock:(AVBooleanResultBlock)block; -/*! - Deletes the AVObject asynchronously and calls the given callback. - @param target The object to call selector on. - @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(NSNumber *)result error:(NSError *)error. error will be nil on success and set if there was an error. [result boolValue] will tell you whether the call succeeded or not. - */ -- (void)deleteInBackgroundWithTarget:(id)target - selector:(SEL)selector; - /*! Deletes this object from the server at some unspecified time in the future, even if LeanCloud is currently inaccessible. Use this when you may not have a solid network connection, and don't need to know when the delete completes. diff --git a/AVOS/AVOSCloud/Object/AVObject.m b/AVOS/AVOSCloud/Object/AVObject.m index 805727221..ad8016edc 100644 --- a/AVOS/AVOSCloud/Object/AVObject.m +++ b/AVOS/AVOSCloud/Object/AVObject.m @@ -24,8 +24,7 @@ #import #import "AVUser_Internal.h" -#import "SDMacros.h" -#import "EXTScope.h" +#import "AVInstallation_Internal.h" #define AV_BATCH_SAVE_SIZE 100 #define AV_BATCH_CONCURRENT_SIZE 20 @@ -310,7 +309,14 @@ - (void)updateValue:(id)value forKey:(NSString *)key { return; if ([AVUtils containsProperty:key inClass:[self class] containSuper:YES filterDynamic:YES]) { self._inSetter = YES; - [self setValue:value forKey:key]; + if ([self isKindOfClass:[AVInstallation class]] && + [key isEqualToString:@"channels"]) { + if ([value isKindOfClass:[NSArray class]]) { + [((AVInstallation *)self) updateChannels:(NSArray *)value]; + } + } else { + [self setValue:value forKey:key]; + } self._inSetter = NO; } else { [self internalSyncLock:^{ @@ -504,14 +510,20 @@ - (BOOL)addObject:(id)object v = [[NSArray alloc] init]; } if ([v isKindOfClass:[NSArray class]]) { - if (unique && [v containsObject:object]) { - return NO; - } NSMutableArray *array = [v mutableCopy]; - [array addObject:object]; - self._inSetter = YES; - [self setValue:array forKey:key]; - self._inSetter = NO; + if (unique && [array containsObject:object]) { + // no need update local data. + } else { + [array addObject:object]; + self._inSetter = YES; + if ([self isKindOfClass:[AVInstallation class]] && + [key isEqualToString:@"channels"]) { + [((AVInstallation *)self) updateChannels:array]; + } else { + [self setValue:array forKey:key]; + } + self._inSetter = NO; + } if (unique) { [self._requestManager addUniqueObjectRequestForKey:key object:object]; } else { @@ -581,15 +593,25 @@ - (void)removeObject:(id)object forKey:(NSString *)key if (array) { if (![array isKindOfClass:[NSMutableArray class]]) { array = [array mutableCopy]; - [self setValue:array forKey:key]; + if ([self isKindOfClass:[AVInstallation class]] && + [key isEqualToString:@"channels"]) { + [((AVInstallation *)self) updateChannels:array]; + } else { + [self setValue:array forKey:key]; + } } } else { array = [[NSMutableArray alloc] init]; - [self setValue:array forKey:key]; + if ([self isKindOfClass:[AVInstallation class]] && + [key isEqualToString:@"channels"]) { + [((AVInstallation *)self) updateChannels:array]; + } else { + [self setValue:array forKey:key]; + } } } } - if (![array containsObject:object] && !self.hasValidObjectId) + if (!self.hasValidObjectId) { return; } @@ -788,12 +810,8 @@ - (void)applySaveOption:(AVSaveOption *)option toRequests:(NSMutableArray *)requ if (!params.count) return; - @weakify(self); [requests enumerateObjectsWithOptions:NSEnumerationReverse - usingBlock:^(NSMutableDictionary * _Nonnull request, NSUInteger idx, BOOL * _Nonnull stop) - { - @strongify(self); - + usingBlock:^(NSMutableDictionary * _Nonnull request, NSUInteger idx, BOOL * _Nonnull stop) { if ([request_method(request) isEqualToString:@"PUT"] && [request_internal_id(request) isEqualToString:self.objectId]) { request[@"params"] = params; @@ -1120,23 +1138,6 @@ -(NSDictionary *)myParams return nil; } -- (void)saveInBackgroundWithTarget:(id)target selector:(SEL)selector -{ - @weakify(self); - [self saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) { - @strongify(self); - [AVUtils performSelectorIfCould:target selector:selector object:self object:error]; - }]; -} - -- (void)saveInBackgroundWithOption:(AVSaveOption *)option target:(id)target selector:(SEL)selector { - @weakify(self); - [self saveInBackgroundWithOption:option block:^(BOOL succeeded, NSError *error) { - @strongify(self); - [AVUtils performSelectorIfCould:target selector:selector object:self object:error]; - }]; -} - - (void)saveEventually { [self saveEventually:^(BOOL succeeded, NSError * _Nullable error) { @@ -1296,7 +1297,9 @@ + (BOOL)saveDescendantRequestsOfObjects:(NSArray *)objects error:(NSError **)err NSError *anError; if (![self postBatchRequests:subRequests forObjects:subObjects error:&anError]) { saveOK = NO; - *error = anError; + if (error) { + *error = anError; + } } } return saveOK; @@ -1308,7 +1311,9 @@ + (BOOL)saveAll:(NSArray *)objects error:(NSError **)error NSError *fileUploadError = nil; if (![self saveDescendantFileOfObjects:objects error:&fileUploadError]) { - *error = fileUploadError; + if (error) { + *error = fileUploadError; + } return NO; } @@ -1316,7 +1321,9 @@ + (BOOL)saveAll:(NSArray *)objects error:(NSError **)error NSError *requestPostError = nil; if (![self saveDescendantRequestsOfObjects:objects error:&requestPostError]) { - *error = requestPostError; + if (error) { + *error = requestPostError; + } return NO; } @@ -1340,15 +1347,6 @@ + (void)saveAllInBackground:(NSArray *)objects }); } -+ (void)saveAllInBackground:(NSArray *)objects - target:(id)target - selector:(SEL)selector -{ - [[self class] saveAllInBackground:objects block:^(BOOL succeeded, NSError *error) { - [AVUtils performSelectorIfCould:target selector:selector object:@(succeeded) object:error]; - }]; -} - - (BOOL)isDataAvailable { return self.objectId.length > 0 && self.createdAt != nil; @@ -1432,26 +1430,6 @@ - (BOOL)refreshWithBlock:(AVObjectResultBlock)block return YES; } -- (void)refreshInBackgroundWithTarget:(id)target selector:(SEL)selector -{ - NSString * path = [self myObjectPath]; - [[AVPaasClient sharedInstance] getObject:path withParameters:nil block:^(id object, NSError *error) { - if (error == nil) - { - [self removeLocalData]; - [AVObjectUtils copyDictionary:object toObject:self]; - } - else - { - - } - if (self == [AVUser currentUser]) { - [[self class] changeCurrentUser:(AVUser *)self save:YES]; - } - [AVUtils performSelectorIfCould:target selector:selector object:object object:error]; - }]; -} - #pragma mark - Fetch - (BOOL)fetch @@ -1567,13 +1545,6 @@ - (void)internalFetchInBackgroundWithKeys:(NSArray *)keys }]; } -- (void)fetchInBackgroundWithTarget:(id)target selector:(SEL)selector -{ - [self fetchInBackgroundWithBlock:^(AVObject *object, NSError *error) { - [AVUtils performSelectorIfCould:target selector:selector object:object object:error]; - }]; -} - - (void)fetchIfNeededInBackgroundWithBlock:(AVObjectResultBlock)block { if (![self isDataAvailable]) { @@ -1585,14 +1556,6 @@ - (void)fetchIfNeededInBackgroundWithBlock:(AVObjectResultBlock)block } } -- (void)fetchIfNeededInBackgroundWithTarget:(id)target - selector:(SEL)selector -{ - [self fetchIfNeededInBackgroundWithBlock:^(AVObject *object, NSError *error) { - [AVUtils performSelectorIfCould:target selector:selector object:object object:error]; - }]; -} - + (void)fetchAll:(NSArray *)objects { [[self class] fetchAll:objects error:NULL]; @@ -1677,15 +1640,6 @@ + (void)fetchAllInBackground:(NSArray *)objects }); } -+ (void)fetchAllInBackground:(NSArray *)objects - target:(id)target - selector:(SEL)selector -{ - [[self class] fetchAllInBackground:objects block:^(NSArray *objects, NSError *error) { - [AVUtils performSelectorIfCould:target selector:selector object:objects object:error]; - }]; -} - + (void)fetchAllIfNeededInBackground:(NSArray *)objects block:(AVArrayResultBlock)block { @@ -1696,15 +1650,6 @@ + (void)fetchAllIfNeededInBackground:(NSArray *)objects }); } -+ (void)fetchAllIfNeededInBackground:(NSArray *)objects - target:(id)target - selector:(SEL)selector -{ - [[self class] fetchAllIfNeededInBackground:objects block:^(NSArray *objects, NSError *error) { - [AVUtils performSelectorIfCould:target selector:selector object:objects object:error]; - }]; -} - #pragma mark - delete - (void)postDelete { @@ -1766,14 +1711,6 @@ - (void)internalDeleteWithEventually:(BOOL)eventually block:(AVBooleanResultBloc }]; } -- (void)deleteInBackgroundWithTarget:(id)target - selector:(SEL)selector -{ - [self deleteInBackgroundWithBlock:^(BOOL succeeded, NSError *error) { - [AVUtils performSelectorIfCould:target selector:selector object:@(succeeded) object:error]; - }]; -} - - (void)deleteEventually { [self deleteEventuallyWithBlock:^(id _Nullable object, NSError * _Nullable error) { /* Ignore result intentionally. */ diff --git a/AVOS/AVOSCloud/Object/AVRequestManager.m b/AVOS/AVOSCloud/Object/AVRequestManager.m index 1f354b13b..9bbbfff85 100644 --- a/AVOS/AVOSCloud/Object/AVRequestManager.m +++ b/AVOS/AVOSCloud/Object/AVRequestManager.m @@ -11,7 +11,6 @@ #import "AVObjectUtils.h" #import "AVObject_Internal.h" #import "AVACL_Internal.h" -#import "EXTScope.h" typedef enum { SET, @@ -97,16 +96,11 @@ -(instancetype)init { } - (void)synchronize:(void (^)(void))action { - if (!action) - return; - - [_lock lock]; - - @onExit { + if (action) { + [_lock lock]; + action(); [_lock unlock]; - }; - - action(); + } } -(NSMutableArray *)findArrayInDict:(NSMutableDictionary *)dict diff --git a/AVOS/AVOSCloud/Push/AVInstallation.h b/AVOS/AVOSCloud/Push/AVInstallation.h index d06af8479..b8c67ccab 100644 --- a/AVOS/AVOSCloud/Push/AVInstallation.h +++ b/AVOS/AVOSCloud/Push/AVInstallation.h @@ -4,101 +4,64 @@ // #import -#import "AVObject.h" #import "AVQuery.h" -NS_ASSUME_NONNULL_BEGIN - -/*! - A LeanCloud Framework Installation Object that is a local representation of an - installation persisted to the LeanCloud. This class is a subclass of a - AVObject, and retains the same functionality of a AVObject, but also extends - it with installation-specific fields and related immutability and validity - checks. - - A valid AVInstallation can only be instantiated via - [AVInstallation defaultInstallation] because the required identifier fields - are readonly. The timeZone and badge fields are also readonly properties which - are automatically updated to match the device's time zone and application badge - when the AVInstallation is saved, thus these fields might not reflect the - latest device state if the installation has not recently been saved. - - AVInstallation objects which have a valid deviceToken and are saved to - the LeanCloud can be used to target push notifications. - - This class is currently for iOS only. There is no AVInstallation for LeanCloud - applications running on OS X, because they cannot receive push notifications. - */ - +/// LeanCloud installation type. @interface AVInstallation : AVObject -/** @name Targeting Installations */ - -/*! - Creates a query for AVInstallation objects. The resulting query can only - be used for targeting a AVPush. Calling find methods on the resulting query - will raise an exception. - */ -+ (AVQuery *)query; +/// The badge for the installation. +@property (nonatomic, assign) NSInteger badge; -/** @name Accessing the Current Installation */ +/// The timeZone for the installation. +@property (nonatomic, copy, nullable) NSString *timeZone; -/** - Default Singleton Installation. +/// The device type for the installation. +@property (nonatomic, copy, nullable) NSString *deviceType; - @return Default Singleton Instance. - */ -+ (AVInstallation *)defaultInstallation; +/// The installation ID for the installation. +@property (nonatomic, copy, nullable) NSString *installationId; -// Deprecated -+ (AVInstallation *)currentInstallation -__deprecated_msg("use +[defaultInstallation] instead."); +/// The device profile for the installation. +@property (nonatomic, copy, nullable) NSString *deviceProfile; -/** @name Properties */ +/// The APNs topic, typically is the bundle ID for the App. +@property (nonatomic, copy, nullable) NSString *apnsTopic; -/// The device type for the AVInstallation. -@property (nonatomic, copy, readonly) NSString *deviceType; +/// The channels for the installation. +@property (nonatomic, strong, nullable) NSArray *channels; -/// The installationId for the AVInstallation. -@property (nonatomic, copy, readonly, nullable) NSString *installationId; +/// The hex string of the APNs device token. +@property (nonatomic, copy, readonly, nullable) NSString *deviceToken; -/// The device token for the AVInstallation. -@property (nonatomic, copy, nullable) NSString *deviceToken; +/// The team id of the apple developer account. +@property (nonatomic, copy, readonly, nullable) NSString *apnsTeamId; -/// The device profile for the AVInstallation. -@property (nonatomic, copy, nullable) NSString *deviceProfile; +NS_ASSUME_NONNULL_BEGIN -/// The badge for the AVInstallation. -@property (nonatomic, assign) NSInteger badge; +/// Query for installation ++ (AVQuery *)query; -/// The timeZone for the AVInstallation. -@property (nonatomic, copy, readonly) NSString *timeZone; +/// Default installation instance. ++ (instancetype)defaultInstallation; -/// The channels for the AVInstallation. -@property (nonatomic, strong, nullable) NSArray *channels; +/// For compatibility, same as the `defaultInstallation`. ++ (instancetype)currentInstallation; -/// The apns topic for universal push notification. -@property (nonatomic, copy, nullable) NSString *apnsTopic; +/// Create a new installation instance. ++ (instancetype)installation; -/// The apns teamId for universal push notification. -@property (nonatomic, copy, nullable) NSString *apnsTeamId; - -/*! - Sets the device token string property from an NSData-encoded token. - - @param deviceTokenData NSData-encoded device token. - */ -- (void)setDeviceTokenFromData:(NSData *)deviceTokenData; - -/** - Sets the device token string property from an NSData-encoded token, with a team ID. - - @param deviceTokenData NSData-encoded device token - @param teamId Team ID - */ +/// Set device token. +/// @param deviceTokenData The device token. +/// @param teamId The team id of the apple developer account. - (void)setDeviceTokenFromData:(NSData *)deviceTokenData - teamId:(NSString * _Nullable)teamId; + teamId:(NSString *)teamId; -@end +/// Set hex string of the device token. +/// @param deviceTokenString The hex string of the device token. +/// @param teamId The team id of the apple developer account. +- (void)setDeviceTokenHexString:(NSString *)deviceTokenString + teamId:(NSString *)teamId; NS_ASSUME_NONNULL_END + +@end diff --git a/AVOS/AVOSCloud/Push/AVInstallation.m b/AVOS/AVOSCloud/Push/AVInstallation.m index 0d54f696c..6bf59b816 100644 --- a/AVOS/AVOSCloud/Push/AVInstallation.m +++ b/AVOS/AVOSCloud/Push/AVInstallation.m @@ -3,11 +3,9 @@ // LeanCloud #import +#import "AVInstallation_Internal.h" #import "AVObject_Internal.h" -#import "AVQuery.h" -#import "AVInstallation.h" #import "AVPaasClient.h" -#import "AVInstallation_Internal.h" #import "AVUtils.h" #import "AVObjectUtils.h" #import "AVPersistenceUtils.h" @@ -16,59 +14,73 @@ @implementation AVInstallation -+ (AVQuery *)query ++ (NSString *)className { - AVQuery *query = [[AVQuery alloc] initWithClassName:@"_Installation"]; - return query; + return @"_Installation"; } -+(AVQuery *)installationQuery ++ (NSString *)endPoint { - AVQuery *query = [[AVQuery alloc] initWithClassName:[AVInstallation className]]; - return query; + return @"installations"; } -+(NSString *)installationTag ++ (instancetype)installation { - return @"Installation"; + return [[AVInstallation alloc] init]; } -+(AVInstallation *)installation ++ (AVQuery *)query { - AVInstallation * installation = [[AVInstallation alloc] init]; - return installation; + return [[AVQuery alloc] initWithClassName:[AVInstallation className]]; } -+ (AVInstallation *)defaultInstallation ++ (instancetype)defaultInstallation { - static AVInstallation *installation = nil; - + static AVInstallation *instance; static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - - installation = [[AVInstallation alloc] init]; - + instance = [AVInstallation installation]; NSString *path = [AVPersistenceUtils currentInstallationArchivePath]; - if ([AVPersistenceUtils fileExist:path]) { - NSMutableDictionary *installationDict = [NSMutableDictionary dictionaryWithDictionary:[AVPersistenceUtils getJSONFromPath:path]]; - if (installationDict) { - [AVObjectUtils copyDictionary:installationDict toObject:installation]; + if ([[NSFileManager defaultManager] fileExistsAtPath:path]) { + NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithDictionary: + [AVPersistenceUtils getJSONFromPath:path]]; + if (dictionary) { + [AVObjectUtils copyDictionary:dictionary + toObject:instance]; } } }); - - return installation; + return instance; +} + ++ (instancetype)currentInstallation +{ + return [AVInstallation defaultInstallation]; } -- (id)init ++ (NSString *)deviceType +{ +#if TARGET_OS_TV + return @"tvos"; +#elif TARGET_OS_WATCH + return @"watchos"; +#elif TARGET_OS_IOS + return @"ios"; +#elif TARGET_OS_OSX + return @"macos"; +#else + return nil; +#endif +} + +- (instancetype)init { self = [super init]; if (self) { - self.className = [AVInstallation className]; - self.deviceType = [AVInstallation deviceType]; - self.timeZone = [[NSTimeZone systemTimeZone] name]; - self.apnsTopic = [NSBundle mainBundle].bundleIdentifier; + self.className = [AVInstallation className]; + _deviceType = [AVInstallation deviceType]; + _timeZone = [[NSTimeZone systemTimeZone] name]; + _apnsTopic = [NSBundle mainBundle].bundleIdentifier; } return self; } @@ -76,227 +88,138 @@ - (id)init - (NSString *)hexadecimalStringFromData:(NSData *)data { NSUInteger dataLength = data.length; - if (dataLength == 0) { + if (!dataLength) { return nil; } const unsigned char *dataBuffer = data.bytes; - NSMutableString *hexString = [NSMutableString stringWithCapacity:(dataLength * 2)]; + NSMutableString *hexString = [NSMutableString stringWithCapacity:(dataLength * 2)]; for (int i = 0; i < dataLength; ++i) { [hexString appendFormat:@"%02.2hhx", dataBuffer[i]]; } - return [hexString copy]; -} - -- (void)setDeviceTokenFromData:(NSData *)deviceTokenData -{ - [self setDeviceTokenFromData:deviceTokenData - teamId:nil]; + return hexString; } - (void)setDeviceTokenFromData:(NSData *)deviceTokenData teamId:(NSString *)teamId { - NSString *newDeviceToken = [self hexadecimalStringFromData:deviceTokenData]; - if (!newDeviceToken) { + NSString *deviceTokenHexString = [self hexadecimalStringFromData:deviceTokenData]; + if (![deviceTokenHexString length]) { return; } - NSString *oldDeviceToken = self.deviceToken; - NSString *oldTeamId = self.apnsTeamId; - if (![oldDeviceToken isEqualToString:newDeviceToken] || ![teamId isEqualToString:oldTeamId]) { - self.deviceToken = newDeviceToken; - self.apnsTeamId = teamId; - [self._requestManager synchronize:^{ - [self updateInstallationDictionary:[self._requestManager setDict]]; - }]; - } + [self setDeviceTokenHexString:deviceTokenHexString + teamId:teamId]; } -+(NSString *)deviceType +- (void)setDeviceTokenHexString:(NSString *)deviceTokenString + teamId:(NSString *)teamId { -#if TARGET_OS_TV - return @"tvos"; -#elif TARGET_OS_WATCH - return @"watchos"; -#elif TARGET_OS_IOS - return @"ios"; -#elif AV_TARGET_OS_OSX - return @"osx"; -#else - return @"unknown"; -#endif + [self setDeviceToken:deviceTokenString]; + [self setApnsTeamId:teamId]; } -- (NSMutableDictionary *)installationDictionaryForCache { - NSMutableDictionary *data = [self postData]; - [data removeObjectForKey:@"__type"]; - [data removeObjectForKey:@"className"]; - return data; -} - -- (void)saveInstallationToLocalCache { - [AVPersistenceUtils saveJSON:[self installationDictionaryForCache] - toPath:[AVPersistenceUtils currentInstallationArchivePath]]; -} - -- (BOOL)isDirty { - if ([super isDirty]) { - return YES; - } else if ([AVInstallation defaultInstallation] == self) { - /* If cache expired, we deem that it is dirty. */ - if (!self.updatedAt || [self.updatedAt timeIntervalSinceNow] < - 60 * 60 * 24) { - return YES; +- (void)postProcessBatchRequests:(NSMutableArray *)requests +{ + NSString *batchPath = [[LCRouter sharedInstance] batchPathForPath:[AVInstallation endPoint]]; + for (NSMutableDictionary *request in [requests copy]) { + if ([request_path(request) hasPrefix:batchPath] && + ([request_method(request) isEqualToString:@"PUT"] || + [request_method(request) isEqualToString:@"POST"])) { + request[@"method"] = @"POST"; + request[@"path"] = batchPath; + NSMutableDictionary *body = request[@"body"]; + [body removeObjectForKey:keyPath(self, createdAt)]; + [body removeObjectForKey:keyPath(self, updatedAt)]; + if (self.deviceToken) { + body[keyPath(self, deviceToken)] = self.deviceToken; + } + if (self.apnsTeamId) { + body[keyPath(self, apnsTeamId)] = self.apnsTeamId; + } + if (self.objectId) { + body[keyPath(self, objectId)] = self.objectId; + } + if (self.deviceType) { + body[keyPath(self, deviceType)] = self.deviceType; + } + if (self.timeZone) { + body[keyPath(self, timeZone)] = self.timeZone; + } + if (self.apnsTopic) { + body[keyPath(self, apnsTopic)] = self.apnsTopic; + } } } - - return NO; } --(NSError *)preSave { - if ([self isDirty]) { - [self._requestManager synchronize:^{ - [self updateInstallationDictionary:[self._requestManager setDict]]; - }]; +- (NSError *)preSave +{ + if (![self.deviceToken length]) { + return LCError(9976, @"deviceToken not found.", nil); } - if (self.installationId==nil && self.deviceToken==nil) { - return LCError(kAVErrorInvalidDeviceToken, @"无法保存Installation数据, 请检查deviceToken是否在`application: didRegisterForRemoteNotificationsWithDeviceToken`方法中正常设置", nil); + if (![self.apnsTeamId length]) { + return LCError(9976, @"apnsTeamId not found.", nil); } - return nil; } --(void)postSave { - [super postSave]; - [self saveInstallationToLocalCache]; -} - --(NSMutableDictionary *)updateInstallationDictionary:(NSMutableDictionary * )data +- (void)postSave { - [data addEntriesFromDictionary:@{ - badgeTag: @(self.badge), - deviceTypeTag: [AVInstallation deviceType], - timeZoneTag: self.timeZone, - }]; - - if (self.objectId) { - [data setObject:self.objectId forKey:@"objectId"]; - } - if (self.channels) - { - [data setObject:self.channels forKey:channelsTag]; - } - if (self.installationId) - { - [data setObject:self.installationId forKey:installationIdTag]; - } - if (self.deviceToken) - { - [data setObject:self.deviceToken forKey:deviceTokenTag]; - } - if (self.deviceProfile) - { - [data setObject:self.deviceProfile forKey:deviceProfileTag]; - } - if (self.apnsTopic) { - [data setObject:self.apnsTopic forKey:topicTag]; - } - if (self.apnsTeamId) { - [data setObject:self.apnsTeamId forKey:@"apnsTeamId"]; + [super postSave]; + if (self == [AVInstallation defaultInstallation]) { + NSMutableDictionary *data = [self postData]; + [data removeObjectForKey:@"__type"]; + [data removeObjectForKey:@"className"]; + [AVPersistenceUtils saveJSON:data toPath:[AVPersistenceUtils currentInstallationArchivePath]]; } - - __block NSDictionary *localDataCopy = nil; - [self internalSyncLock:^{ - localDataCopy = self._localData.copy; - }]; - NSDictionary *updationData = [AVObjectUtils dictionaryFromObject:localDataCopy]; - - [data addEntriesFromDictionary:updationData]; - - return data; -} - -+(NSString *)className -{ - return @"_Installation"; -} - -+(NSString *)endPoint -{ - return @"installations"; } --(void)setBadge:(NSInteger)badge { +- (void)setBadge:(NSInteger)badge { _badge = badge; - [self addSetRequest:badgeTag object:@(self.badge)]; + [self addSetRequest:keyPath(self, badge) object:@(badge)]; } --(void)setChannels:(NSArray *)channels { - if ([_channels isEqual:channels]) { - return; - } +- (void)setChannels:(NSArray *)channels { _channels = channels; - [self addSetRequest:channelsTag object:self.channels]; + [self addSetRequest:keyPath(self, channels) object:channels]; } --(void)setDeviceToken:(NSString *)deviceToken { - if ([_deviceToken isEqualToString:deviceToken]) { - return; - } - _deviceToken = deviceToken; - [self addSetRequest:deviceTokenTag object:self.deviceToken]; +- (void)setDeviceToken:(NSString *)deviceToken { + _deviceToken = [deviceToken copy]; + [self addSetRequest:keyPath(self, deviceToken) object:_deviceToken]; } --(void)setDeviceProfile:(NSString *)deviceProfile { - if ([_deviceProfile isEqualToString:deviceProfile]) { - return; - } - _deviceProfile = deviceProfile; - [self addSetRequest:deviceProfileTag object:self.deviceProfile]; +- (void)setDeviceProfile:(NSString *)deviceProfile { + _deviceProfile = [deviceProfile copy]; + [self addSetRequest:keyPath(self, deviceProfile) object:_deviceProfile]; } -- (void)setApnsTopic:(NSString *)apnsTopic -{ - if (_apnsTopic && [_apnsTopic isEqualToString:apnsTopic]) { - - return; - } - - _apnsTopic = apnsTopic; - - [self addSetRequest:@"apnsTopic" object:apnsTopic]; +- (void)setApnsTopic:(NSString *)apnsTopic { + _apnsTopic = [apnsTopic copy]; + [self addSetRequest:keyPath(self, apnsTopic) object:_apnsTopic]; } -- (void)setApnsTeamId:(NSString *)apnsTeamId -{ - if (_apnsTeamId && [_apnsTeamId isEqualToString:apnsTeamId]) { - - return; - } - - _apnsTeamId = apnsTeamId; - - [self addSetRequest:@"apnsTeamId" object:apnsTeamId]; +- (void)setApnsTeamId:(NSString *)apnsTeamId { + _apnsTeamId = [apnsTeamId copy]; + [self addSetRequest:keyPath(self, apnsTeamId) object:_apnsTeamId]; } -- (void)postProcessBatchRequests:(NSMutableArray *)requests { - NSString *path = [[self class] endPoint]; - NSString *batchPath = [[LCRouter sharedInstance] batchPathForPath:path]; +- (void)setTimeZone:(NSString *)timeZone { + _timeZone = [timeZone copy]; + [self addSetRequest:keyPath(self, timeZone) object:_timeZone]; +} - for (NSMutableDictionary *request in [requests copy]) { - if ([request_path(request) hasPrefix:batchPath] && [request_method(request) isEqualToString:@"PUT"]) { - request[@"method"] = @"POST"; - request[@"path"] = batchPath; - request[@"body"][@"objectId"] = self.objectId; - request[@"body"][@"deviceType"] = self.deviceType; - request[@"body"][@"deviceToken"] = self.deviceToken; - } - } +- (void)setDeviceType:(NSString *)deviceType { + _deviceType = [deviceType copy]; + [self addSetRequest:keyPath(self, deviceType) object:_deviceType]; } -// MARK: - Deprecated +- (void)setInstallationId:(NSString *)installationId { + _installationId = [installationId copy]; + [self addSetRequest:keyPath(self, installationId) object:_installationId]; +} -+ (AVInstallation *)currentInstallation -{ - return [AVInstallation defaultInstallation]; +- (void)updateChannels:(NSArray *)channels { + _channels = channels; } @end diff --git a/AVOS/AVOSCloud/Push/AVInstallation_Internal.h b/AVOS/AVOSCloud/Push/AVInstallation_Internal.h index 2190b1dc4..e5c90df4a 100644 --- a/AVOS/AVOSCloud/Push/AVInstallation_Internal.h +++ b/AVOS/AVOSCloud/Push/AVInstallation_Internal.h @@ -10,15 +10,9 @@ @interface AVInstallation () -@property (nonatomic, copy) NSString *timeZone; -@property (nonatomic, copy) NSString *deviceType; - -+ (AVQuery *)installationQuery; -+ (AVInstallation *)installation; - -+ (NSString *)deviceType; - + (NSString *)className; + (NSString *)endPoint; +- (void)updateChannels:(NSArray *)channels; + @end diff --git a/AVOS/AVOSCloud/Push/AVPush.h b/AVOS/AVOSCloud/Push/AVPush.h index c2f6bfd2d..a77286f67 100644 --- a/AVOS/AVOSCloud/Push/AVPush.h +++ b/AVOS/AVOSCloud/Push/AVPush.h @@ -186,19 +186,6 @@ extern NSString *const kAVPushTargetPlatformWindowsPhone; withMessage:(NSString *)message block:(AVBooleanResultBlock)block; -/*! - Asynchronously send a push message to a channel. - @param channel The channel to send to. The channel name must start with - a letter and contain only letters, numbers, dashes, and underscores. - @param message The message to send. - @param target The object to call selector on. - @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(NSNumber *)result error:(NSError *)error. error will be nil on success and set if there was an error. [result boolValue] will tell you whether the call succeeded or not. - */ -+ (void)sendPushMessageToChannelInBackground:(NSString *)channel - withMessage:(NSString *)message - target:(id)target - selector:(SEL)selector; - /*! Send a push message to a query. @param query The query to send to. The query must be a AVInstallation query @@ -255,13 +242,6 @@ extern NSString *const kAVPushTargetPlatformWindowsPhone; */ - (void)sendPushInBackgroundWithBlock:(AVBooleanResultBlock)block; -/*! - Asynchronously send this push message and calls the given callback. - @param target The object to call selector on. - @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(NSNumber *)result error:(NSError *)error. error will be nil on success and set if there was an error. [result boolValue] will tell you whether the call succeeded or not. - */ -- (void)sendPushInBackgroundWithTarget:(id)target selector:(SEL)selector; - /*! Send a push message with arbitrary data to a channel. See the guide for information about the dictionary structure. @param channel The channel to send to. The channel name must start with @@ -294,19 +274,6 @@ extern NSString *const kAVPushTargetPlatformWindowsPhone; withData:(NSDictionary *)data block:(AVBooleanResultBlock)block; -/*! - Asynchronously send a push message with arbitrary data to a channel. See the guide for information about the dictionary structure. - @param channel The channel to send to. The channel name must start with - a letter and contain only letters, numbers, dashes, and underscores. - @param data The data to send. - @param target The object to call selector on. - @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(NSNumber *)result error:(NSError *)error. error will be nil on success and set if there was an error. [result boolValue] will tell you whether the call succeeded or not. - */ -+ (void)sendPushDataToChannelInBackground:(NSString *)channel - withData:(NSDictionary *)data - target:(id)target - selector:(SEL)selector; - /*! Send a push message with arbitrary data to a query. See the guide for information about the dictionary structure. @param query The query to send to. The query must be a AVInstallation query @@ -360,14 +327,6 @@ extern NSString *const kAVPushTargetPlatformWindowsPhone; */ + (void)getSubscribedChannelsInBackgroundWithBlock:(AVSetResultBlock)block; -/*! - Asynchronously get all the channels that this device is subscribed to. - @param target The object to call selector on. - @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(NSSet *)result error:(NSError *)error. error will be nil on success and set if there was an error. - */ -+ (void)getSubscribedChannelsInBackgroundWithTarget:(id)target - selector:(SEL)selector; - /*! Subscribes the device to a channel of push notifications. @param channel The channel to subscribe to. The channel name must start with @@ -393,17 +352,6 @@ extern NSString *const kAVPushTargetPlatformWindowsPhone; + (void)subscribeToChannelInBackground:(NSString *)channel block:(AVBooleanResultBlock)block; -/*! - Asynchronously subscribes the device to a channel of push notifications and calls the given callback. - @param channel The channel to subscribe to. The channel name must start with - a letter and contain only letters, numbers, dashes, and underscores. - @param target The object to call selector on. - @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(NSNumber *)result error:(NSError *)error. error will be nil on success and set if there was an error. [result boolValue] will tell you whether the call succeeded or not. - */ -+ (void)subscribeToChannelInBackground:(NSString *)channel - target:(id)target - selector:(SEL)selector; - /*! Unsubscribes the device to a channel of push notifications. @param channel The channel to unsubscribe from. @@ -427,16 +375,6 @@ extern NSString *const kAVPushTargetPlatformWindowsPhone; + (void)unsubscribeFromChannelInBackground:(NSString *)channel block:(AVBooleanResultBlock)block; -/*! - Asynchronously unsubscribes the device from a channel of push notifications and calls the given callback. - @param channel The channel to unsubscribe from. - @param target The object to call selector on. - @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(NSNumber *)result error:(NSError *)error. error will be nil on success and set if there was an error. [result boolValue] will tell you whether the call succeeded or not. - */ -+ (void)unsubscribeFromChannelInBackground:(NSString *)channel - target:(id)target - selector:(SEL)selector; - @end NS_ASSUME_NONNULL_END diff --git a/AVOS/AVOSCloud/Push/AVPush.m b/AVOS/AVOSCloud/Push/AVPush.m index 00ffb77b3..be793b875 100644 --- a/AVOS/AVOSCloud/Push/AVPush.m +++ b/AVOS/AVOSCloud/Push/AVPush.m @@ -218,19 +218,6 @@ + (void)sendPushMessageToChannelInBackground:(NSString *)channel [AVPush sendPushMessage:push wait:YES block:block error:nil]; } -+ (void)sendPushMessageToChannelInBackground:(NSString *)channel - withMessage:(NSString *)message - target:(id)target - selector:(SEL)selector -{ - AVPush * push = [AVPush push]; - [push setChannel:channel]; - [push setMessage:message]; - [AVPush sendPushMessage:push wait:YES block:^(BOOL succeeded, NSError *error) { - [AVUtils performSelectorIfCould:target selector:selector object:@(succeeded) object:error]; - } error:nil]; -} - + (BOOL)sendPushMessageToQuery:(AVQuery *)query withMessage:(NSString *)message error:(NSError **)theError @@ -346,13 +333,6 @@ - (void)sendPushInBackgroundWithBlock:(AVBooleanResultBlock)block }]; } -- (void)sendPushInBackgroundWithTarget:(id)target selector:(SEL)selector -{ - [self sendPushInBackgroundWithBlock:^(BOOL succeeded, NSError *error) { - [AVUtils performSelectorIfCould:target selector:selector object:@(succeeded) object:error]; - }]; -} - + (BOOL)sendPushDataToChannel:(NSString *)channel withData:(NSDictionary *)data error:(NSError **)error @@ -382,19 +362,6 @@ + (void)sendPushDataToChannelInBackground:(NSString *)channel [AVPush sendPushMessage:push wait:NO block:block error:nil]; } -+ (void)sendPushDataToChannelInBackground:(NSString *)channel - withData:(NSDictionary *)data - target:(id)target - selector:(SEL)selector -{ - AVPush * push = [AVPush push]; - [push setChannel:channel]; - [push setData:data]; - [AVPush sendPushMessage:push wait:NO block:^(BOOL succeeded, NSError *error) { - [AVUtils performSelectorIfCould:target selector:selector object:@(succeeded) object:error]; - } error:nil]; -} - + (BOOL)sendPushDataToQuery:(AVQuery *)query withData:(NSDictionary *)data error:(NSError **)error @@ -441,14 +408,6 @@ + (void)getSubscribedChannelsInBackgroundWithBlock:(AVSetResultBlock)block } wait:NO error:nil]; } -+ (void)getSubscribedChannelsInBackgroundWithTarget:(id)target - selector:(SEL)selector -{ - [AVPush getSubscribedChannelsWithBlock:^(NSSet *channels, NSError *error) { - [AVUtils performSelectorIfCould:target selector:selector object:channels object:error]; - } wait:NO error:nil]; -} - + (NSSet *)getSubscribedChannelsWithBlock:(AVSetResultBlock)block wait:(BOOL)wait error:(NSError **)theError @@ -458,7 +417,7 @@ + (NSSet *)getSubscribedChannelsWithBlock:(AVSetResultBlock)block NSError __block *blockError = nil; __block NSSet * resultSet = nil; - AVQuery * query = [AVInstallation installationQuery]; + AVQuery * query = [AVInstallation query]; [query whereKey:deviceTokenTag equalTo:[AVInstallation defaultInstallation].deviceToken]; [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) { if (objects.count > 0) @@ -509,15 +468,6 @@ + (void)subscribeToChannelInBackground:(NSString *)channel [installation saveInBackgroundWithBlock:block]; } -+ (void)subscribeToChannelInBackground:(NSString *)channel - target:(id)target - selector:(SEL)selector -{ - AVInstallation * installation = [AVInstallation defaultInstallation]; - [installation addUniqueObject:channel forKey:channelsTag]; - [installation saveInBackgroundWithTarget:target selector:selector]; -} - + (BOOL)unsubscribeFromChannel:(NSString *)channel error:(NSError **)error { AVInstallation * installation = [AVInstallation defaultInstallation]; @@ -541,13 +491,4 @@ + (void)unsubscribeFromChannelInBackground:(NSString *)channel [installation saveInBackgroundWithBlock:block]; } -+ (void)unsubscribeFromChannelInBackground:(NSString *)channel - target:(id)target - selector:(SEL)selector -{ - AVInstallation * installation = [AVInstallation defaultInstallation]; - [installation removeObject:channel forKey:channelsTag]; - [installation saveInBackgroundWithTarget:target selector:selector]; -} - @end diff --git a/AVOS/AVOSCloud/Query/AVQuery.h b/AVOS/AVOSCloud/Query/AVQuery.h index 00a182d7a..7e56349c3 100644 --- a/AVOS/AVOSCloud/Query/AVQuery.h +++ b/AVOS/AVOSCloud/Query/AVQuery.h @@ -458,19 +458,6 @@ typedef NS_ENUM(NSInteger, AVQueryDistanceUnit) { - (void)getObjectInBackgroundWithId:(NSString *)objectId block:(AVObjectResultBlock)block; -/*! - Gets a AVObject asynchronously. - - This mutates the AVQuery - - @param objectId The id of the object being requested. - @param target The target for the callback selector. - @param selector The selector for the callback. It should have the following signature: (void)callbackWithResult:(AVObject *)result error:(NSError *)error. result will be nil if error is set and vice versa. - */ -- (void)getObjectInBackgroundWithId:(NSString *)objectId - target:(id)target - selector:(SEL)selector; - #pragma mark - #pragma mark Getting Users @@ -528,14 +515,6 @@ typedef NS_ENUM(NSInteger, AVQueryDistanceUnit) { */ - (void)findObjectsInBackgroundWithBlock:(AVArrayResultBlock)block; -/*! - Finds objects asynchronously and calls the given callback with the results. - @param target The object to call the selector on. - @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(NSArray *)result error:(NSError *)error. result will be nil if error is set and vice versa. - */ -- (void)findObjectsInBackgroundWithTarget:(id)target selector:(SEL)selector; - - /*! Remove objects asynchronously and calls the given block with the results. @param block The block to execute. The block should have the following argument signature:(NSArray *objects, NSError *error) @@ -579,16 +558,6 @@ typedef NS_ENUM(NSInteger, AVQueryDistanceUnit) { */ - (void)getFirstObjectInBackgroundWithBlock:(AVObjectResultBlock)block; -/*! - Gets an object asynchronously and calls the given callback with the results. - - This mutates the AVQuery. - - @param target The object to call the selector on. - @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(AVObject *)result error:(NSError *)error. result will be nil if error is set OR no object was found matching the query. error will be nil if result is set OR if the query succeeded, but found no results. - */ -- (void)getFirstObjectInBackgroundWithTarget:(id)target selector:(SEL)selector; - #pragma mark - #pragma mark Count methods @@ -620,12 +589,6 @@ typedef NS_ENUM(NSInteger, AVQueryDistanceUnit) { */ - (void)countObjectsInBackgroundWithBlock:(AVIntegerResultBlock)block; -/*! - Counts objects asynchronously and calls the given callback with the count. - @param target The object to call the selector on. - @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(NSNumber *)result error:(NSError *)error. */ -- (void)countObjectsInBackgroundWithTarget:(id)target selector:(SEL)selector; - #pragma mark - #pragma mark Cancel methods diff --git a/AVOS/AVOSCloud/Query/AVQuery.m b/AVOS/AVOSCloud/Query/AVQuery.m index cb5aa928d..3a5208b23 100644 --- a/AVOS/AVOSCloud/Query/AVQuery.m +++ b/AVOS/AVOSCloud/Query/AVQuery.m @@ -11,7 +11,6 @@ #import "AVUser_Internal.h" #import "AVGeoPoint_Internal.h" #import "AVCacheManager.h" -#import "AVInstallation_Internal.h" #import "AVErrorUtils.h" #import "AVObjectUtils.h" #import "AVQuery_Internal.h" @@ -383,19 +382,33 @@ - (void)whereKey:(NSString *)key matchesRegex:(NSString *)regex modifiers:(NSStr [self addWhereItem:dict forKey:key]; } +/** + * Converts a string into a regex that matches it. + * Surrounding with \Q .. \E does this, we just need to escape \E's in + * the text separately. + */ +static NSString * quote(NSString *string) +{ + NSString *replacedString = [string stringByReplacingOccurrencesOfString:@"\\E" withString:@"\\E\\\\E\\Q"]; + if (replacedString) { + replacedString = [[@"\\Q" stringByAppendingString:replacedString] stringByAppendingString:@"\\E"]; + } + return replacedString; +} + - (void)whereKey:(NSString *)key containsString:(NSString *)substring { - [self whereKey:key matchesRegex:[NSString stringWithFormat:@".*%@.*",substring]]; + [self whereKey:key matchesRegex:[NSString stringWithFormat:@".*%@.*", quote(substring)]]; } - (void)whereKey:(NSString *)key hasPrefix:(NSString *)prefix { - [self whereKey:key matchesRegex:[NSString stringWithFormat:@"^%@.*",prefix]]; + [self whereKey:key matchesRegex:[NSString stringWithFormat:@"^%@.*", quote(prefix)]]; } - (void)whereKey:(NSString *)key hasSuffix:(NSString *)suffix { - [self whereKey:key matchesRegex:[NSString stringWithFormat:@".*%@$",suffix]]; + [self whereKey:key matchesRegex:[NSString stringWithFormat:@".*%@$", quote(suffix)]]; } + (AVQuery *)orQueryWithSubqueries:(NSArray *)queries @@ -635,24 +648,6 @@ - (void)internalGetObjectInBackgroundWithId:(NSString *)objectId }]; } -/*! - Gets a AVObject asynchronously. - - This mutates the AVQuery - - @param objectId The id of the object being requested. - @param target The target for the callback selector. - @param selector The selector for the callback. It should have the following signature: (void)callbackWithResult:(AVObject *)result error:(NSError *)error. result will be nil if error is set and vice versa. - */ -- (void)getObjectInBackgroundWithId:(NSString *)objectId - target:(id)target - selector:(SEL)selector -{ - [self getObjectInBackgroundWithId:objectId block:^(AVObject *object, NSError *error) { - [AVUtils performSelectorIfCould:target selector:selector object:object object:error]; - }]; -} - #pragma mark - #pragma mark Getting Users @@ -798,18 +793,6 @@ - (NSMutableArray *)processResults:(NSArray *)results className:(NSString *)clas - (void)processEnd:(BOOL)end { } -/*! - Finds objects asynchronously and calls the given callback with the results. - @param target The object to call the selector on. - @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(NSArray *)result error:(NSError *)error. result will be nil if error is set and vice versa. - */ -- (void)findObjectsInBackgroundWithTarget:(id)target - selector:(SEL)selector -{ - [self findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) { - [AVUtils performSelectorIfCould:target selector:selector object:objects object:error]; - }]; -} - (void)deleteAllInBackgroundWithBlock:(AVBooleanResultBlock)block { [self findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) { @@ -912,21 +895,6 @@ - (AVObject *)getFirstObjectWithBlock:(AVObjectResultBlock)resultBlock return theResultObject; } -/*! - Gets an object asynchronously and calls the given callback with the results. - - This mutates the AVQuery. - - @param target The object to call the selector on. - @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(AVObject *)result error:(NSError *)error. result will be nil if error is set OR no object was found matching the query. error will be nil if result is set OR if the query succeeded, but found no results. - */ -- (void)getFirstObjectInBackgroundWithTarget:(id)target selector:(SEL)selector -{ - [self getFirstObjectInBackgroundWithBlock:^(AVObject *object, NSError *error) { - [AVUtils performSelectorIfCould:target selector:selector object:object object:error]; - }]; -} - #pragma mark - #pragma mark Count methods @@ -999,17 +967,6 @@ - (NSInteger)countObjectsWithBlock:(AVIntegerResultBlock)block return theResultCount; } -/*! - Counts objects asynchronously and calls the given callback with the count. - @param target The object to call the selector on. - @param selector The selector to call. It should have the following signature: (void)callbackWithResult:(NSNumber *)result error:(NSError *)error. */ -- (void)countObjectsInBackgroundWithTarget:(id)target selector:(SEL)selector -{ - [self countObjectsInBackgroundWithBlock:^(NSInteger number, NSError *error) { - [AVUtils performSelectorIfCould:target selector:selector object:@(number) object:error]; - }]; -} - #pragma mark - #pragma mark Cancel methods diff --git a/AVOS/AVOSCloud/Request/AVPaasClient.h b/AVOS/AVOSCloud/Request/AVPaasClient.h index 24b0c98f6..78c4dc00a 100644 --- a/AVOS/AVOSCloud/Request/AVPaasClient.h +++ b/AVOS/AVOSCloud/Request/AVPaasClient.h @@ -9,15 +9,10 @@ #import #import "AVConstants.h" #import "AVACL.h" -#import "AVInstallation.h" #import "AVOSCloud.h" #import "UserAgent.h" -#if AV_IOS_ONLY -#define USER_AGENT [NSString stringWithFormat:@"AVOS Cloud iOS-%@ SDK", SDK_VERSION] -#else -#define USER_AGENT [NSString stringWithFormat:@"AVOS Cloud OSX-%@ SDK", SDK_VERSION] -#endif +static NSString *const USER_AGENT = @"LeanCloud-Objc-SDK/" SDK_VERSION; FOUNDATION_EXPORT NSString *const LCHeaderFieldNameId; FOUNDATION_EXPORT NSString *const LCHeaderFieldNameKey; diff --git a/AVOS/AVOSCloud/Request/AVPaasClient.m b/AVOS/AVOSCloud/Request/AVPaasClient.m index c1cc771e3..e08957f62 100644 --- a/AVOS/AVOSCloud/Request/AVPaasClient.m +++ b/AVOS/AVOSCloud/Request/AVPaasClient.m @@ -21,9 +21,6 @@ #import "AVObjectUtils.h" #import "LCNetworkStatistics.h" #import "LCRouter_Internal.h" -#import "SDMacros.h" -#import "AVOSCloud_Internal.h" -#import "LCSSLChallenger.h" #import "AVConstants.h" static NSString * const kLC_code = @"code"; @@ -38,21 +35,17 @@ NSString *const LCHeaderFieldNameProduction = @"X-LC-Prod"; #define LC_REST_REQUEST_LOG_FORMAT \ - @"\n\n" \ - @"------ BEGIN LeanCloud REST Request -------\n" \ + @"\n------ BEGIN LeanCloud REST Request -------\n" \ @"path: %@\n" \ @"curl: %@\n" \ - @"------ END --------------------------------\n" \ - @"\n" + @"------ END --------------------------------" #define LC_REST_RESPONSE_LOG_FORMAT \ - @"\n\n" \ - @"------ BEGIN LeanCloud REST Response ------\n" \ + @"\n------ BEGIN LeanCloud REST Response ------\n" \ @"path: %@\n" \ @"cost: %.3fms\n" \ @"response: %@\n" \ - @"------ END --------------------------------\n" \ - @"\n" + @"------ END --------------------------------" @implementation NSMutableString (URLRequestFormatter) @@ -64,46 +57,35 @@ - (void)appendCommandLineArgument:(NSString *)arg { @implementation NSURLRequest (curl) -- (NSString *)cURLCommand{ - NSMutableString *command = [NSMutableString stringWithString:@"curl -i -k"]; +- (NSString *)cURLCommand +{ + NSMutableString *command = [NSMutableString stringWithString:@"curl -v \\\n"]; - [command appendCommandLineArgument:[NSString stringWithFormat:@"-X %@", [self HTTPMethod]]]; - - if ([[[self HTTPMethod] uppercaseString] isEqualToString:@"GET"]) - [command appendCommandLineArgument:@"-G"]; - - NSData *data = [self HTTPBody]; - if ([data length] > 0) { - NSString *HTTPBodyString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; - [command appendCommandLineArgument:[NSString stringWithFormat:@"-d '%@'", HTTPBodyString]]; - } + [command appendCommandLineArgument:[NSString stringWithFormat:@"-X %@ \\\n", [self HTTPMethod]]]; NSString *acceptEncodingHeader = [[self allHTTPHeaderFields] valueForKey:@"Accept-Encoding"]; if (acceptEncodingHeader && [acceptEncodingHeader rangeOfString:@"gzip"].location != NSNotFound) { - [command appendCommandLineArgument:@"--compressed"]; + [command appendCommandLineArgument:@"--compressed \\\n"]; } if ([self URL]) { NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:[self URL]]; for (NSHTTPCookie *cookie in cookies) { - [command appendCommandLineArgument:[NSString stringWithFormat:@"--cookie \"%@=%@\"", [cookie name], [cookie value]]]; + [command appendCommandLineArgument:[NSString stringWithFormat:@"--cookie \"%@=%@\" \\\n", [cookie name], [cookie value]]]; } } NSMutableDictionary *headers = [[self allHTTPHeaderFields] mutableCopy]; - - /* Remove signature for security. */ - [headers removeObjectForKey:@"X-LC-Sign"]; for (NSString * field in headers) { - [command appendCommandLineArgument:[NSString stringWithFormat:@"-H %@", [NSString stringWithFormat:@"'%@: %@'", field, [[self valueForHTTPHeaderField:field] stringByReplacingOccurrencesOfString:@"\'" withString:@"\\\'"]]]]; + [command appendCommandLineArgument:[NSString stringWithFormat:@"-H %@ \\\n", [NSString stringWithFormat:@"'%@: %@'", field, [[self valueForHTTPHeaderField:field] stringByReplacingOccurrencesOfString:@"\'" withString:@"\\\'"]]]]; } if ([self URL].query.length > 0) { NSString *query = [self URL].query; NSArray *components = [query componentsSeparatedByString:@"&"]; for (NSString *component in components) { - [command appendCommandLineArgument:[NSString stringWithFormat:@"--data-urlencode \'%@\'", component.stringByRemovingPercentEncoding]]; + [command appendCommandLineArgument:[NSString stringWithFormat:@"--data-urlencode \'%@\' \\\n", component.stringByRemovingPercentEncoding]]; } } @@ -116,6 +98,12 @@ - (NSString *)cURLCommand{ basicUrl = absoluteString; } + NSData *data = [self HTTPBody]; + if ([data length] > 0) { + NSString *HTTPBodyString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; + [command appendCommandLineArgument:[NSString stringWithFormat:@"-d '%@' \\\n", HTTPBodyString]]; + } + [command appendCommandLineArgument:[NSString stringWithFormat:@"\"%@\"", basicUrl]]; return [NSString stringWithString:command]; @@ -148,7 +136,7 @@ +(AVPaasClient *)sharedInstance dispatch_once(&once, ^{ sharedInstance = [[self alloc] init]; sharedInstance.productionMode = YES; - sharedInstance.timeoutInterval = kAVDefaultNetworkTimeoutInterval; + sharedInstance.timeoutInterval = 60.0; sharedInstance.applicationIdField = LCHeaderFieldNameId; sharedInstance.applicationKeyField = LCHeaderFieldNameKey; @@ -172,18 +160,6 @@ - (instancetype)init { LCURLSessionManager *manager = [[LCURLSessionManager alloc] initWithSessionConfiguration:configuration]; manager.completionQueue = _completionQueue; - if ([AVOSCloud isSSLPinningEnabled]) { - - [manager setSessionDidReceiveAuthenticationChallengeBlock: - ^NSURLSessionAuthChallengeDisposition(NSURLSession * _Nonnull session, - NSURLAuthenticationChallenge * _Nonnull challenge, - NSURLCredential *__autoreleasing _Nullable * _Nullable credential) - { - [[LCSSLChallenger sharedInstance] acceptChallenge:challenge]; - return NSURLSessionAuthChallengeUseCredential; - }]; - } - /* Remove all null value of result. */ LCJSONResponseSerializer *responseSerializer = (LCJSONResponseSerializer *)manager.responseSerializer; responseSerializer.removesKeysWithNullValues = YES; @@ -543,13 +519,9 @@ - (void)performRequest:(NSURLRequest *)request saveResult:(BOOL)saveResult block } } - @weakify(self); - [self performRequest:mutableRequest success:^(NSHTTPURLResponse *response, id responseObject) { - @strongify(self); - if (block) { block(responseObject, nil); @@ -569,15 +541,11 @@ - (void)performRequest:(NSURLRequest *)request saveResult:(BOOL)saveResult block } failure:^(NSHTTPURLResponse *response, id responseObject, NSError *error) { - @strongify(self); - NSInteger statusCode = response.statusCode; if (statusCode == 304) { // 304 is not error [[AVCacheManager sharedInstance] getWithKey:URLString maxCacheAge:3600 * 24 * 30 block:^(id object, NSError *error) { - @strongify(self); - if (error) { if (retryTimes < 3) { [self.lastModify removeObjectForKey:[URLString AVMD5String]]; @@ -792,10 +760,7 @@ - (void)handleArchivedRequestAtPath:(NSString *)path block:(AVIdResultBlock)bloc [self.runningArchivedRequests addObject:path]; } - @weakify(self); [self performRequest:request saveResult:NO block:^(id object, NSError *error) { - @strongify(self); - if (!error) { [fileManager removeItemAtPath:path error:NULL]; } else { diff --git a/AVOS/AVOSCloud/Router/LCRouter.h b/AVOS/AVOSCloud/Router/LCRouter.h index 8109a6f9f..a0191306e 100644 --- a/AVOS/AVOSCloud/Router/LCRouter.h +++ b/AVOS/AVOSCloud/Router/LCRouter.h @@ -18,27 +18,6 @@ FOUNDATION_EXPORT RouterCacheKey RouterCacheKeyRTM; + (instancetype)sharedInstance; -/** - Custom API version. - - @param APIVersion Format eg. '1.1'. - */ -+ (void)setAPIVersion:(NSString *)APIVersion; - -/** - Custom RTM router API path. - - @param RTMRouterPath Format eg. '/v1/route'. - */ -+ (void)setRTMRouterPath:(NSString *)RTMRouterPath; - -/** - Custom router cache directory path. - - @param directoryPath Path. - */ -+ (void)setRouterCacheDirectoryPath:(NSString *)directoryPath; - /** Clean disk cache. diff --git a/AVOS/AVOSCloud/Router/LCRouter.m b/AVOS/AVOSCloud/Router/LCRouter.m index 6bab0ba6c..2aa3d136d 100644 --- a/AVOS/AVOSCloud/Router/LCRouter.m +++ b/AVOS/AVOSCloud/Router/LCRouter.m @@ -85,16 +85,9 @@ - (instancetype)init // MARK: - API Version -static NSString * LCAPIVersion = @"1.1"; - + (NSString *)APIVersion { - return LCAPIVersion; -} - -+ (void)setAPIVersion:(NSString *)APIVersion -{ - LCAPIVersion = APIVersion; + return @"1.1"; } static NSString * pathWithVersion(NSString *path) @@ -111,33 +104,16 @@ + (void)setAPIVersion:(NSString *)APIVersion // MARK: - RTM Router Path -static NSString * LCRTMRouterPath = @"/v1/route"; - + (NSString *)RTMRouterPath { - return LCRTMRouterPath; -} - -+ (void)setRTMRouterPath:(NSString *)RTMRouterPath -{ - LCRTMRouterPath = RTMRouterPath; + return @"/v1/route"; } // MARK: - Disk Cache -static NSString * LCRouterCacheDirectoryPath = nil; - -+ (void)setRouterCacheDirectoryPath:(NSString *)directoryPath -{ - LCRouterCacheDirectoryPath = directoryPath; -} - + (NSString *)routerCacheDirectoryPath { - if (!LCRouterCacheDirectoryPath) { - LCRouterCacheDirectoryPath = [AVPersistenceUtils homeDirectoryLibraryCachesLeanCloudCachesRouter]; - } - return LCRouterCacheDirectoryPath; + return [AVPersistenceUtils homeDirectoryLibraryCachesLeanCloudCachesRouter]; } static void cachingRouterData(NSDictionary *routerDataMap, RouterCacheKey key) @@ -237,11 +213,11 @@ - (NSString *)appURLForPath:(NSString *)path appID:(NSString *)appID RouterKey serverKey = serverKeyForPath(path); - NSString *(^constructedURL)(NSString *) = ^NSString *(NSString *Host) { + NSString *(^constructedURL)(NSString *) = ^NSString *(NSString *host) { if ([serverKey isEqualToString:RouterKeyAppRTMRouterServer]) { - return absoluteURLStringWithHostAndPath(Host, path); + return absoluteURLStringWithHostAndPath(host, path); } else { - return absoluteURLStringWithHostAndPath(Host, pathWithVersion(path)); + return absoluteURLStringWithHostAndPath(host, pathWithVersion(path)); } }; @@ -252,7 +228,11 @@ - (NSString *)appURLForPath:(NSString *)path appID:(NSString *)appID } }); - ({ /// get server URL from memory cache + if ([self.serverURLString length]) { + return constructedURL(self.serverURLString); + } + + if ([appID hasSuffix:AppIDSuffixUS]) { NSDictionary *appRouterDataTuple = nil; [self->_lock lock]; appRouterDataTuple = [NSDictionary lc__decodingDictionary:self->_appRouterMap key:appID]; @@ -264,30 +244,38 @@ - (NSString *)appURLForPath:(NSString *)path appID:(NSString *)appID NSString *serverURL = [NSString lc__decodingDictionary:dataDic key:serverKey]; if ([serverURL length]) { return constructedURL(serverURL); + } else { + NSString *fallbackServerURL = [self appRouterFallbackURLWithKey:serverKey appID:appID]; + return constructedURL(fallbackServerURL); } - }); + } - /// fallback server URL - NSString *fallbackServerURL = [self appRouterFallbackURLWithKey:serverKey appID:appID]; - return constructedURL(fallbackServerURL); + return nil; } -- (NSString *)appRouterFallbackURLWithKey:(NSString *)key appID:(NSString *)appID ++ (NSString *)appDomainForAppID:(NSString *)appID { - NSParameterAssert(key); - NSParameterAssert(appID); - /// fallback server URL - NSString *appDomain = nil; - if ([appID rangeOfString:@"-"].location == NSNotFound || [appID hasSuffix:AppIDSuffixCN]) { + NSString *appDomain; + if ([appID hasSuffix:AppIDSuffixCN]) { appDomain = AppDomainCN; } else if ([appID hasSuffix:AppIDSuffixCE]) { appDomain = AppDomainCE; } else if ([appID hasSuffix:AppIDSuffixUS]) { appDomain = AppDomainUS; } else { - [NSException raise:NSInternalInconsistencyException format:@"application id invalid."]; + appDomain = AppDomainCN; } - return [NSString stringWithFormat:@"%@.%@.%@", [appID substringToIndex:8].lowercaseString, self->_keyToModule[key], appDomain]; + return appDomain; +} + +- (NSString *)appRouterFallbackURLWithKey:(NSString *)key appID:(NSString *)appID +{ + NSParameterAssert(key); + NSParameterAssert(appID); + return [NSString stringWithFormat:@"%@.%@.%@", + [[appID substringToIndex:8] lowercaseString], + self->_keyToModule[key], + [LCRouter appDomainForAppID:appID]]; } /// for compatibility, keep it. @@ -360,6 +348,10 @@ - (void)getRTMURLWithAppID:(NSString *)appID callback:(void (^)(NSDictionary *di /// get RTM router URL & try update app router NSString *RTMRouterURL = [self RTMRouterURLForAppID:appID]; + if (!RTMRouterURL) { + callback(nil, LCError(9973, @"RTM Router URL not found.", nil)); + return; + } ({ /// add callback to map BOOL addCallbacksToArray = false; diff --git a/AVOS/AVOSCloud/Router/LCRouter_Internal.h b/AVOS/AVOSCloud/Router/LCRouter_Internal.h index 9dc1ccacc..500247010 100644 --- a/AVOS/AVOSCloud/Router/LCRouter_Internal.h +++ b/AVOS/AVOSCloud/Router/LCRouter_Internal.h @@ -8,7 +8,7 @@ #import "LCRouter.h" -static NSString *const AppRouterURLString = @"https://app-router.leancloud.cn/2/route"; +static NSString *const AppRouterURLString = @"https://app-router.com/2/route"; typedef NSString * const AppIDSuffix NS_TYPED_EXTENSIBLE_ENUM; static AppIDSuffix AppIDSuffixCN = @"-gzGzoHsz"; @@ -42,9 +42,12 @@ static RouterKey RouterKeyRTMServer = @"server"; @interface LCRouter () @property (atomic, assign) BOOL isUpdatingAppRouter; +@property (nonatomic, strong) NSString *serverURLString; /// internal ++ (NSString *)appDomainForAppID:(NSString *)appID; + - (NSString *)appURLForPath:(NSString *)path appID:(NSString *)appID; - (void)getRTMURLWithAppID:(NSString *)appID callback:(void (^)(NSDictionary *dictionary, NSError *error))callback; diff --git a/AVOS/AVOSCloud/Statistics/LCNetworkStatistics.m b/AVOS/AVOSCloud/Statistics/LCNetworkStatistics.m index 1497ab52b..756e256a7 100644 --- a/AVOS/AVOSCloud/Statistics/LCNetworkStatistics.m +++ b/AVOS/AVOSCloud/Statistics/LCNetworkStatistics.m @@ -12,7 +12,6 @@ #import "AVPaasClient.h" #import "AVUtils.h" #import -#import "EXTScope.h" #define LC_INTERVAL_HALF_AN_HOUR 30 * 60 @@ -34,13 +33,6 @@ @interface LCNetworkStatistics () @end -#define LOCK_CACHED_STATISTIC_DICT() \ - [self.cachedStatisticDictLock lock]; \ - \ - @onExit { \ - [self.cachedStatisticDictLock unlock]; \ - } - @implementation LCNetworkStatistics + (instancetype)sharedInstance { @@ -65,75 +57,63 @@ - (instancetype)init { } - (NSMutableDictionary *)statisticsInfo { - LOCK_CACHED_STATISTIC_DICT(); - - if (self.cachedStatisticDict) { - return self.cachedStatisticDict; - } - NSMutableDictionary *dict = nil; - - LCKeyValueStore *store = [LCKeyValueStore sharedInstance]; - - NSData *data = [store dataForKey:LCNetworkStatisticsInfoKey]; - - if (data) { - dict = [NSKeyedUnarchiver unarchiveObjectWithData:data]; + [self.cachedStatisticDictLock lock]; + if (self.cachedStatisticDict) { + dict = self.cachedStatisticDict; } else { - dict = [NSMutableDictionary dictionary]; + LCKeyValueStore *store = [LCKeyValueStore sharedInstance]; + NSData *data = [store dataForKey:LCNetworkStatisticsInfoKey]; + if (data) { + dict = [NSKeyedUnarchiver unarchiveObjectWithData:data]; + } else { + dict = [NSMutableDictionary dictionary]; + } } - + [self.cachedStatisticDictLock unlock]; return dict; } - (void)saveStatisticsDict:(NSDictionary *)statisticsDict { - LOCK_CACHED_STATISTIC_DICT(); - + [self.cachedStatisticDictLock lock]; self.cachedStatisticDict = [statisticsDict mutableCopy]; + [self.cachedStatisticDictLock unlock]; } - (void)writeCachedStatisticsDict { - LOCK_CACHED_STATISTIC_DICT(); - - if (!self.cachedStatisticDict) return; - - LCKeyValueStore *store = [LCKeyValueStore sharedInstance]; - - NSData *data = [NSKeyedArchiver archivedDataWithRootObject:self.cachedStatisticDict]; - - [store setData:data forKey:LCNetworkStatisticsInfoKey]; + [self.cachedStatisticDictLock lock]; + if (self.cachedStatisticDict) { + LCKeyValueStore *store = [LCKeyValueStore sharedInstance]; + NSData *data = [NSKeyedArchiver archivedDataWithRootObject:self.cachedStatisticDict]; + [store setData:data forKey:LCNetworkStatisticsInfoKey]; + } + [self.cachedStatisticDictLock unlock]; } - (void)addIncrementalAttribute:(NSInteger)amount forKey:(NSString *)key { - LOCK_CACHED_STATISTIC_DICT(); - + [self.cachedStatisticDictLock lock]; NSMutableDictionary *statisticsInfo = [self statisticsInfo]; - NSNumber *value = statisticsInfo[key]; - if (value) { statisticsInfo[key] = @([value integerValue] + amount); } else { statisticsInfo[key] = @(amount); } - [self saveStatisticsDict:statisticsInfo]; + [self.cachedStatisticDictLock unlock]; } - (void)addAverageAttribute:(double)amount forKey:(NSString *)key { - LOCK_CACHED_STATISTIC_DICT(); - + [self.cachedStatisticDictLock lock]; NSMutableDictionary *statisticsInfo = [self statisticsInfo]; - NSNumber *value = statisticsInfo[key]; - if (value) { statisticsInfo[key] = @(([value doubleValue] + amount) / 2.0); } else { statisticsInfo[key] = @(amount); } - [self saveStatisticsDict:statisticsInfo]; + [self.cachedStatisticDictLock unlock]; } - (void)uploadStatisticsInfo:(NSDictionary *)statisticsInfo @@ -176,19 +156,16 @@ - (void)uploadStatisticsInfo:(NSDictionary *)statisticsInfo } - (void)statisticsInfoDidUpload { - LOCK_CACHED_STATISTIC_DICT(); - + [self.cachedStatisticDictLock lock]; // Reset network statistics data LCKeyValueStore *store = [LCKeyValueStore sharedInstance]; [store deleteKey:LCNetworkStatisticsInfoKey]; - // Clean cached statistic dict [self.cachedStatisticDict removeAllObjects]; - // Increase check interval to save CPU time LCNetworkStatisticsCheckInterval = LC_INTERVAL_HALF_AN_HOUR; - [self updateLastUpdateAt]; + [self.cachedStatisticDictLock unlock]; } - (void)updateLastUpdateAt { diff --git a/AVOS/AVOSCloud/Status/AVStatus.m b/AVOS/AVOSCloud/Status/AVStatus.m index 410063de8..655654e89 100644 --- a/AVOS/AVOSCloud/Status/AVStatus.m +++ b/AVOS/AVOSCloud/Status/AVStatus.m @@ -12,7 +12,6 @@ #import "AVObjectUtils.h" #import "AVObject_Internal.h" #import "AVQuery_Internal.h" -#import "SDMacros.h" #import "AVUtils.h" #import "AVUser_Internal.h" @@ -429,12 +428,9 @@ -(void)sendInBackgroundWithBlock:(AVBooleanResultBlock)block{ AVPaasClient *client = [AVPaasClient sharedInstance]; NSURLRequest *request = [client requestWithPath:@"statuses" method:@"POST" headers:nil parameters:body]; - @weakify(self); - [client performRequest:request success:^(NSHTTPURLResponse *response, id responseObject) { - @strongify(self); if ([responseObject isKindOfClass:[NSDictionary class]]) { NSString *objectId = responseObject[@"objectId"]; diff --git a/AVOS/AVOSCloud/ThirdParty/JRSwizzle/JRSwizzle.h b/AVOS/AVOSCloud/ThirdParty/JRSwizzle/JRSwizzle.h deleted file mode 100755 index fc270747e..000000000 --- a/AVOS/AVOSCloud/ThirdParty/JRSwizzle/JRSwizzle.h +++ /dev/null @@ -1,48 +0,0 @@ -// JRSwizzle.h semver:1.1.0 -// Copyright (c) 2007-2016 Jonathan 'Wolf' Rentzsch: http://rentzsch.com -// Some rights reserved: http://opensource.org/licenses/mit -// https://github.com/rentzsch/jrswizzle - -#import - -@interface NSObject (JRSwizzle) - -+ (BOOL)lc_swizzleMethod:(SEL)origSel_ withMethod:(SEL)altSel_ error:(NSError**)error_; -+ (BOOL)lc_swizzleClassMethod:(SEL)origSel_ withClassMethod:(SEL)altSel_ error:(NSError**)error_; - - -/** - ``` - __block NSInvocation *invocation = nil; - invocation = [self lc_swizzleMethod:@selector(initWithCoder:) withBlock:^(id obj, NSCoder *coder) { - NSLog(@"before %@, coder %@", obj, coder); - - [invocation setArgument:&coder atIndex:2]; - [invocation invokeWithTarget:obj]; - - id ret = nil; - [invocation getReturnValue:&ret]; - - NSLog(@"after %@, coder %@", obj, coder); - - return ret; - } error:nil]; - ``` - */ -+ (NSInvocation*)lc_swizzleMethod:(SEL)origSel withBlock:(id)block error:(NSError**)error; - -/** - ``` - __block NSInvocation *classInvocation = nil; - classInvocation = [self lc_swizzleClassMethod:@selector(test) withBlock:^() { - NSLog(@"before"); - - [classInvocation invoke]; - - NSLog(@"after"); - } error:nil]; - ``` - */ -+ (NSInvocation*)lc_swizzleClassMethod:(SEL)origSel withBlock:(id)block error:(NSError**)error; - -@end diff --git a/AVOS/AVOSCloud/ThirdParty/JRSwizzle/JRSwizzle.m b/AVOS/AVOSCloud/ThirdParty/JRSwizzle/JRSwizzle.m deleted file mode 100755 index c4410fe64..000000000 --- a/AVOS/AVOSCloud/ThirdParty/JRSwizzle/JRSwizzle.m +++ /dev/null @@ -1,166 +0,0 @@ -// JRSwizzle.m semver:1.1.0 -// Copyright (c) 2007-2016 Jonathan 'Wolf' Rentzsch: http://rentzsch.com -// Some rights reserved: http://opensource.org/licenses/mit -// https://github.com/rentzsch/jrswizzle - -#import "JRSwizzle.h" - -#if TARGET_OS_IPHONE - #import - #import -#else - #import -#endif - -#define SetNSErrorFor(FUNC, ERROR_VAR, FORMAT,...) \ - if (ERROR_VAR) { \ - NSString *errStr = [NSString stringWithFormat:@"%s: " FORMAT,FUNC,##__VA_ARGS__]; \ - *ERROR_VAR = [NSError errorWithDomain:@"NSCocoaErrorDomain" \ - code:-1 \ - userInfo:[NSDictionary dictionaryWithObject:errStr forKey:NSLocalizedDescriptionKey]]; \ - } -#define SetNSError(ERROR_VAR, FORMAT,...) SetNSErrorFor(__func__, ERROR_VAR, FORMAT, ##__VA_ARGS__) - -#if OBJC_API_VERSION >= 2 -#define GetClass(obj) object_getClass(obj) -#else -#define GetClass(obj) (obj ? obj->isa : Nil) -#endif - -@implementation NSObject (JRSwizzle) - -+ (BOOL)lc_swizzleMethod:(SEL)origSel_ withMethod:(SEL)altSel_ error:(NSError**)error_ { -#if OBJC_API_VERSION >= 2 - Method origMethod = class_getInstanceMethod(self, origSel_); - if (!origMethod) { -#if TARGET_OS_IPHONE - SetNSError(error_, @"original method %@ not found for class %@", NSStringFromSelector(origSel_), [self class]); -#else - SetNSError(error_, @"original method %@ not found for class %@", NSStringFromSelector(origSel_), [self className]); -#endif - return NO; - } - - Method altMethod = class_getInstanceMethod(self, altSel_); - if (!altMethod) { -#if TARGET_OS_IPHONE - SetNSError(error_, @"alternate method %@ not found for class %@", NSStringFromSelector(altSel_), [self class]); -#else - SetNSError(error_, @"alternate method %@ not found for class %@", NSStringFromSelector(altSel_), [self className]); -#endif - return NO; - } - - class_addMethod(self, - origSel_, - class_getMethodImplementation(self, origSel_), - method_getTypeEncoding(origMethod)); - class_addMethod(self, - altSel_, - class_getMethodImplementation(self, altSel_), - method_getTypeEncoding(altMethod)); - - method_exchangeImplementations(class_getInstanceMethod(self, origSel_), class_getInstanceMethod(self, altSel_)); - return YES; -#else - // Scan for non-inherited methods. - Method directOriginalMethod = NULL, directAlternateMethod = NULL; - - void *iterator = NULL; - struct objc_method_list *mlist = class_nextMethodList(self, &iterator); - while (mlist) { - int method_index = 0; - for (; method_index < mlist->method_count; method_index++) { - if (mlist->method_list[method_index].method_name == origSel_) { - assert(!directOriginalMethod); - directOriginalMethod = &mlist->method_list[method_index]; - } - if (mlist->method_list[method_index].method_name == altSel_) { - assert(!directAlternateMethod); - directAlternateMethod = &mlist->method_list[method_index]; - } - } - mlist = class_nextMethodList(self, &iterator); - } - - // If either method is inherited, copy it up to the target class to make it non-inherited. - if (!directOriginalMethod || !directAlternateMethod) { - Method inheritedOriginalMethod = NULL, inheritedAlternateMethod = NULL; - if (!directOriginalMethod) { - inheritedOriginalMethod = class_getInstanceMethod(self, origSel_); - if (!inheritedOriginalMethod) { -#if TARGET_OS_IPHONE - SetNSError(error_, @"original method %@ not found for class %@", NSStringFromSelector(origSel_), [self class]); -#else - SetNSError(error_, @"original method %@ not found for class %@", NSStringFromSelector(origSel_), [self className]); -#endif - return NO; - } - } - if (!directAlternateMethod) { - inheritedAlternateMethod = class_getInstanceMethod(self, altSel_); - if (!inheritedAlternateMethod) { -#if TARGET_OS_IPHONE - SetNSError(error_, @"alternate method %@ not found for class %@", NSStringFromSelector(altSel_), [self class]); -#else - SetNSError(error_, @"alternate method %@ not found for class %@", NSStringFromSelector(altSel_), [self className]); -#endif - return NO; - } - } - - int hoisted_method_count = !directOriginalMethod && !directAlternateMethod ? 2 : 1; - struct objc_method_list *hoisted_method_list = malloc(sizeof(struct objc_method_list) + (sizeof(struct objc_method)*(hoisted_method_count-1))); - hoisted_method_list->obsolete = NULL; // soothe valgrind - apparently ObjC runtime accesses this value and it shows as uninitialized in valgrind - hoisted_method_list->method_count = hoisted_method_count; - Method hoisted_method = hoisted_method_list->method_list; - - if (!directOriginalMethod) { - bcopy(inheritedOriginalMethod, hoisted_method, sizeof(struct objc_method)); - directOriginalMethod = hoisted_method++; - } - if (!directAlternateMethod) { - bcopy(inheritedAlternateMethod, hoisted_method, sizeof(struct objc_method)); - directAlternateMethod = hoisted_method; - } - class_addMethods(self, hoisted_method_list); - } - - // Swizzle. - IMP temp = directOriginalMethod->method_imp; - directOriginalMethod->method_imp = directAlternateMethod->method_imp; - directAlternateMethod->method_imp = temp; - - return YES; -#endif -} - -+ (BOOL)lc_swizzleClassMethod:(SEL)origSel_ withClassMethod:(SEL)altSel_ error:(NSError**)error_ { - return [GetClass((id)self) lc_swizzleMethod:origSel_ withMethod:altSel_ error:error_]; -} - -+ (NSInvocation*)lc_swizzleMethod:(SEL)origSel withBlock:(id)block error:(NSError**)error { - IMP blockIMP = imp_implementationWithBlock(block); - NSString *blockSelectorString = [NSString stringWithFormat:@"_jr_block_%@_%p", NSStringFromSelector(origSel), block]; - SEL blockSel = sel_registerName([blockSelectorString cStringUsingEncoding:NSUTF8StringEncoding]); - Method origSelMethod = class_getInstanceMethod(self, origSel); - const char* origSelMethodArgs = method_getTypeEncoding(origSelMethod); - class_addMethod(self, blockSel, blockIMP, origSelMethodArgs); - - NSMethodSignature *origSig = [NSMethodSignature signatureWithObjCTypes:origSelMethodArgs]; - NSInvocation *origInvocation = [NSInvocation invocationWithMethodSignature:origSig]; - origInvocation.selector = blockSel; - - [self lc_swizzleMethod:origSel withMethod:blockSel error:nil]; - - return origInvocation; -} - -+ (NSInvocation*)lc_swizzleClassMethod:(SEL)origSel withBlock:(id)block error:(NSError**)error { - NSInvocation *invocation = [GetClass((id)self) lc_swizzleMethod:origSel withBlock:block error:error]; - invocation.target = self; - - return invocation; -} - -@end diff --git a/AVOS/AVOSCloud/ThirdParty/SDMacros/SDMacros.h b/AVOS/AVOSCloud/ThirdParty/SDMacros/SDMacros.h deleted file mode 100755 index 195a88d11..000000000 --- a/AVOS/AVOSCloud/ThirdParty/SDMacros/SDMacros.h +++ /dev/null @@ -1,168 +0,0 @@ -// -// SDMacros.h -// -// Created by Brandon Sneed on 7/11/13. -// Copyright (c) 2013 SetDirection. All rights reserved. -// -// -// DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE -// Version 2, December 2004 -// -// Everyone is permitted to copy and distribute verbatim or modified -// copies of this source code, and changing it is allowed as long -// as the name is changed. -// -// DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE -// TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -// -// 0. You just DO WHAT THE FUCK YOU WANT TO. - -/** - The __deprecated__ macro saves a little bit of typing around marking classes and methods as deprecated. - It also provides a compile-time warning which can be used to direct developers elsewhere. - - Example 1: Methods - - @interface SDLocationManager: CLLocationManager - + (SDLocationManager *)instance; - - (void)startUpdatingLocation __deprecated__("Use the withDelegate versions of this method"); - - (void)stopUpdatingHeading __deprecated__("Use the withDelegate versions of this method"); - @end - - Example 2: Object interface - - __deprecated__("Use CLGeocoder instead.") - @interface SDGeocoder : NSObject - - (id)initWithQuery:(NSString *)queryString apiKey:(NSString *)apiKey; - @end - - Example 3: Formal protocol - - __deprecated__("Use CLGeocoder instead.") - @protocol SDGeocoderDelegate - - (void)geocoder:(SDGeocoder *)geocoder didFailWithError:(NSError *)error; - - (void)geocoder:(SDGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark; - @end - */ - -#define __deprecated__(s) __attribute__((deprecated(s))) - -/** - @weakify, @unsafeify and @strongify are loosely based on EXTobjc's implementation with some subtle - differences. The main change here has been to reduce the amount of macro-foo to something more - understandable. The calling pattern has also changed. EXTobjc's @weakify for example accepts a - variable argument list, which it will in turn generate weak shadow vars for all the items in the arg - list. - - This version makes the weak designation a little more implicit by only accepting 1 variable per call. - A second version of this macro (with the same name) allows it to be used outside of the context of a - block. This can be useful when dealing with delegates, datasources, IBOutlets, etc that are marked - as weak or strong. - */ - -/** - @weakify(existingStrongVar) - - Creates a weak shadow variable called _existingStrongVar_weak which can be later made strong again - with #strongify. - - This is typically used to weakly reference variables in a block, but then ensure that - the variables stay alive during the actual execution of the block (if they were live upon - entry) - - Example: - - @weakify(self); - [object doSomethingInBlock:^{ - @strongify(self); - [self doSomething]; - }]; - - @weakify(existingStrongVar, myWeakVar) - - Creates a weak shadow variable of existingStrongVar and gives it the name myWeakVar. This is useful - outside of blocks where a weak reference might be needed. - - */ - -#define weakify(...) \ - try {} @finally {} \ - macro_dispatcher(weakify, __VA_ARGS__)(__VA_ARGS__) - -/** - Like #weakify, but uses __unsafe_unretained instead. - */ - -#define unsafeify(...) \ - try {} @finally {} \ - macro_dispatcher(unsafeify, __VA_ARGS__)(__VA_ARGS__) - -/** - @strongify(existingWeakVar) - - Redefines existingWeakVar to a strong variable of the same type. This is typically used to redefine - a weak self reference inside a block. - - Example: - - @weakify(self); - [object doSomethingInBlock:^{ - @strongify(self); - [self doSomething]; - }]; - - @strongify(existingWeakVar, myStrongVar) - - Creates a strong shadow variable of existingWeakVar and gives it the name myStrongVar. This is useful - outside of blocks where a strong reference might be needed. - - Example: - - @strongify(self.delegate, myDelegate); - if (myDelegate && [myDelegate respondsToSelector:@selector(someSelector)]) - [myDelegate someSelector]; - - */ - -#define strongify(...) \ - try {} @finally {} \ - macro_dispatcher(strongify, __VA_ARGS__)(__VA_ARGS__) - - -/****** It's probably best not to call macros below this line directly. *******/ - -// Support bits for macro dispatching based on parameter count. - -#define va_num_args(...) va_num_args_impl(__VA_ARGS__, 5,4,3,2,1) -#define va_num_args_impl(_1,_2,_3,_4,_5,N,...) N - -#define macro_dispatcher(func, ...) macro_dispatcher_(func, va_num_args(__VA_ARGS__)) -#define macro_dispatcher_(func, nargs) macro_dispatcher__(func, nargs) -#define macro_dispatcher__(func, nargs) func ## nargs - -// Support macros for @strongify. - -#define strongify1(v) \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wshadow\"") \ - __strong __typeof(v) v = v ## _weak_ \ - _Pragma("clang diagnostic pop") - -#define strongify2(v_in, v_out) \ - __strong __typeof(v_in) v_out = v_in \ - -// Support macros for @weakify. - -#define weakify1(v) \ - __weak __typeof(v) v ## _weak_ = v \ - -#define weakify2(v_in, v_out) \ - __weak __typeof(v_in) v_out = v_in \ - -// Support macros for @unsafeify. - -#define unsafeify1(v) \ - __unsafe_unretained __typeof(v) v ## _weak_ = v \ - -#define unsafeify2(v_in, v_out) \ - __unsafe_unretained __typeof(v_in) v_out = v_in \ diff --git a/AVOS/AVOSCloud/ThirdParty/libextobjc/EXTScope.h b/AVOS/AVOSCloud/ThirdParty/libextobjc/EXTScope.h deleted file mode 100644 index fffc99e2c..000000000 --- a/AVOS/AVOSCloud/ThirdParty/libextobjc/EXTScope.h +++ /dev/null @@ -1,61 +0,0 @@ -// -// EXTScope.h -// extobjc -// -// Created by Justin Spahr-Summers on 2011-05-04. -// Copyright (C) 2012 Justin Spahr-Summers. -// Released under the MIT license. -// - -#import "metamacros.h" - -/** - * \@onExit defines some code to be executed when the current scope exits. The - * code must be enclosed in braces and terminated with a semicolon, and will be - * executed regardless of how the scope is exited, including from exceptions, - * \c goto, \c return, \c break, and \c continue. - * - * Provided code will go into a block to be executed later. Keep this in mind as - * it pertains to memory management, restrictions on assignment, etc. Because - * the code is used within a block, \c return is a legal (though perhaps - * confusing) way to exit the cleanup block early. - * - * Multiple \@onExit statements in the same scope are executed in reverse - * lexical order. This helps when pairing resource acquisition with \@onExit - * statements, as it guarantees teardown in the opposite order of acquisition. - * - * @note This statement cannot be used within scopes defined without braces - * (like a one line \c if). In practice, this is not an issue, since \@onExit is - * a useless construct in such a case anyways. - */ -#define onExit \ - ext_keywordify \ - __strong ext_cleanupBlock_t metamacro_concat(ext_exitBlock_, __LINE__) __attribute__((cleanup(lc_executeCleanupBlock), unused)) = ^ - -/*** implementation details follow ***/ -typedef void (^ext_cleanupBlock_t)(void); - -#if defined(__cplusplus) -extern "C" { -#endif - void lc_executeCleanupBlock (__strong ext_cleanupBlock_t *block); -#if defined(__cplusplus) -} -#endif - -// Details about the choice of backing keyword: -// -// The use of @try/@catch/@finally can cause the compiler to suppress -// return-type warnings. -// The use of @autoreleasepool {} is not optimized away by the compiler, -// resulting in superfluous creation of autorelease pools. -// -// Since neither option is perfect, and with no other alternatives, the -// compromise is to use @autorelease in DEBUG builds to maintain compiler -// analysis, and to use @try/@catch otherwise to avoid insertion of unnecessary -// autorelease pools. -#if defined(DEBUG) && !defined(NDEBUG) -#define ext_keywordify autoreleasepool {} -#else -#define ext_keywordify try {} @catch (...) {} -#endif diff --git a/AVOS/AVOSCloud/ThirdParty/libextobjc/EXTScope.m b/AVOS/AVOSCloud/ThirdParty/libextobjc/EXTScope.m deleted file mode 100644 index 12d8c8c2e..000000000 --- a/AVOS/AVOSCloud/ThirdParty/libextobjc/EXTScope.m +++ /dev/null @@ -1,15 +0,0 @@ -// -// EXTScope.m -// extobjc -// -// Created by Justin Spahr-Summers on 2011-05-04. -// Copyright (C) 2012 Justin Spahr-Summers. -// Released under the MIT license. -// - -#import "EXTScope.h" - -void lc_executeCleanupBlock (__strong ext_cleanupBlock_t *block) { - (*block)(); -} - diff --git a/AVOS/AVOSCloud/ThirdParty/libextobjc/metamacros.h b/AVOS/AVOSCloud/ThirdParty/libextobjc/metamacros.h deleted file mode 100644 index dd90d99bb..000000000 --- a/AVOS/AVOSCloud/ThirdParty/libextobjc/metamacros.h +++ /dev/null @@ -1,667 +0,0 @@ -/** - * Macros for metaprogramming - * ExtendedC - * - * Copyright (C) 2012 Justin Spahr-Summers - * Released under the MIT license - */ - -#ifndef EXTC_METAMACROS_H -#define EXTC_METAMACROS_H - - -/** - * Executes one or more expressions (which may have a void type, such as a call - * to a function that returns no value) and always returns true. - */ -#define metamacro_exprify(...) \ - ((__VA_ARGS__), true) - -/** - * Returns a string representation of VALUE after full macro expansion. - */ -#define metamacro_stringify(VALUE) \ - metamacro_stringify_(VALUE) - -/** - * Returns A and B concatenated after full macro expansion. - */ -#define metamacro_concat(A, B) \ - metamacro_concat_(A, B) - -/** - * Returns the Nth variadic argument (starting from zero). At least - * N + 1 variadic arguments must be given. N must be between zero and twenty, - * inclusive. - */ -#define metamacro_at(N, ...) \ - metamacro_concat(metamacro_at, N)(__VA_ARGS__) - -/** - * Returns the number of arguments (up to twenty) provided to the macro. At - * least one argument must be provided. - * - * Inspired by P99: http://p99.gforge.inria.fr - */ -#define metamacro_argcount(...) \ - metamacro_at(20, __VA_ARGS__, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1) - -/** - * Identical to #metamacro_foreach_cxt, except that no CONTEXT argument is - * given. Only the index and current argument will thus be passed to MACRO. - */ -#define metamacro_foreach(MACRO, SEP, ...) \ - metamacro_foreach_cxt(metamacro_foreach_iter, SEP, MACRO, __VA_ARGS__) - -/** - * For each consecutive variadic argument (up to twenty), MACRO is passed the - * zero-based index of the current argument, CONTEXT, and then the argument - * itself. The results of adjoining invocations of MACRO are then separated by - * SEP. - * - * Inspired by P99: http://p99.gforge.inria.fr - */ -#define metamacro_foreach_cxt(MACRO, SEP, CONTEXT, ...) \ - metamacro_concat(metamacro_foreach_cxt, metamacro_argcount(__VA_ARGS__))(MACRO, SEP, CONTEXT, __VA_ARGS__) - -/** - * Identical to #metamacro_foreach_cxt. This can be used when the former would - * fail due to recursive macro expansion. - */ -#define metamacro_foreach_cxt_recursive(MACRO, SEP, CONTEXT, ...) \ - metamacro_concat(metamacro_foreach_cxt_recursive, metamacro_argcount(__VA_ARGS__))(MACRO, SEP, CONTEXT, __VA_ARGS__) - -/** - * In consecutive order, appends each variadic argument (up to twenty) onto - * BASE. The resulting concatenations are then separated by SEP. - * - * This is primarily useful to manipulate a list of macro invocations into instead - * invoking a different, possibly related macro. - */ -#define metamacro_foreach_concat(BASE, SEP, ...) \ - metamacro_foreach_cxt(metamacro_foreach_concat_iter, SEP, BASE, __VA_ARGS__) - -/** - * Iterates COUNT times, each time invoking MACRO with the current index - * (starting at zero) and CONTEXT. The results of adjoining invocations of MACRO - * are then separated by SEP. - * - * COUNT must be an integer between zero and twenty, inclusive. - */ -#define metamacro_for_cxt(COUNT, MACRO, SEP, CONTEXT) \ - metamacro_concat(metamacro_for_cxt, COUNT)(MACRO, SEP, CONTEXT) - -/** - * Returns the first argument given. At least one argument must be provided. - * - * This is useful when implementing a variadic macro, where you may have only - * one variadic argument, but no way to retrieve it (for example, because \c ... - * always needs to match at least one argument). - * - * @code - -#define varmacro(...) \ - metamacro_head(__VA_ARGS__) - - * @endcode - */ -#define metamacro_head(...) \ - metamacro_head_(__VA_ARGS__, 0) - -/** - * Returns every argument except the first. At least two arguments must be - * provided. - */ -#define metamacro_tail(...) \ - metamacro_tail_(__VA_ARGS__) - -/** - * Returns the first N (up to twenty) variadic arguments as a new argument list. - * At least N variadic arguments must be provided. - */ -#define metamacro_take(N, ...) \ - metamacro_concat(metamacro_take, N)(__VA_ARGS__) - -/** - * Removes the first N (up to twenty) variadic arguments from the given argument - * list. At least N variadic arguments must be provided. - */ -#define metamacro_drop(N, ...) \ - metamacro_concat(metamacro_drop, N)(__VA_ARGS__) - -/** - * Decrements VAL, which must be a number between zero and twenty, inclusive. - * - * This is primarily useful when dealing with indexes and counts in - * metaprogramming. - */ -#define metamacro_dec(VAL) \ - metamacro_at(VAL, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19) - -/** - * Increments VAL, which must be a number between zero and twenty, inclusive. - * - * This is primarily useful when dealing with indexes and counts in - * metaprogramming. - */ -#define metamacro_inc(VAL) \ - metamacro_at(VAL, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21) - -/** - * If A is equal to B, the next argument list is expanded; otherwise, the - * argument list after that is expanded. A and B must be numbers between zero - * and twenty, inclusive. Additionally, B must be greater than or equal to A. - * - * @code - -// expands to true -metamacro_if_eq(0, 0)(true)(false) - -// expands to false -metamacro_if_eq(0, 1)(true)(false) - - * @endcode - * - * This is primarily useful when dealing with indexes and counts in - * metaprogramming. - */ -#define metamacro_if_eq(A, B) \ - metamacro_concat(metamacro_if_eq, A)(B) - -/** - * Identical to #metamacro_if_eq. This can be used when the former would fail - * due to recursive macro expansion. - */ -#define metamacro_if_eq_recursive(A, B) \ - metamacro_concat(metamacro_if_eq_recursive, A)(B) - -/** - * Returns 1 if N is an even number, or 0 otherwise. N must be between zero and - * twenty, inclusive. - * - * For the purposes of this test, zero is considered even. - */ -#define metamacro_is_even(N) \ - metamacro_at(N, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1) - -/** - * Returns the logical NOT of B, which must be the number zero or one. - */ -#define metamacro_not(B) \ - metamacro_at(B, 1, 0) - -// IMPLEMENTATION DETAILS FOLLOW! -// Do not write code that depends on anything below this line. -#define metamacro_stringify_(VALUE) # VALUE -#define metamacro_concat_(A, B) A ## B -#define metamacro_foreach_iter(INDEX, MACRO, ARG) MACRO(INDEX, ARG) -#define metamacro_head_(FIRST, ...) FIRST -#define metamacro_tail_(FIRST, ...) __VA_ARGS__ -#define metamacro_consume_(...) -#define metamacro_expand_(...) __VA_ARGS__ - -// implemented from scratch so that metamacro_concat() doesn't end up nesting -#define metamacro_foreach_concat_iter(INDEX, BASE, ARG) metamacro_foreach_concat_iter_(BASE, ARG) -#define metamacro_foreach_concat_iter_(BASE, ARG) BASE ## ARG - -// metamacro_at expansions -#define metamacro_at0(...) metamacro_head(__VA_ARGS__) -#define metamacro_at1(_0, ...) metamacro_head(__VA_ARGS__) -#define metamacro_at2(_0, _1, ...) metamacro_head(__VA_ARGS__) -#define metamacro_at3(_0, _1, _2, ...) metamacro_head(__VA_ARGS__) -#define metamacro_at4(_0, _1, _2, _3, ...) metamacro_head(__VA_ARGS__) -#define metamacro_at5(_0, _1, _2, _3, _4, ...) metamacro_head(__VA_ARGS__) -#define metamacro_at6(_0, _1, _2, _3, _4, _5, ...) metamacro_head(__VA_ARGS__) -#define metamacro_at7(_0, _1, _2, _3, _4, _5, _6, ...) metamacro_head(__VA_ARGS__) -#define metamacro_at8(_0, _1, _2, _3, _4, _5, _6, _7, ...) metamacro_head(__VA_ARGS__) -#define metamacro_at9(_0, _1, _2, _3, _4, _5, _6, _7, _8, ...) metamacro_head(__VA_ARGS__) -#define metamacro_at10(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, ...) metamacro_head(__VA_ARGS__) -#define metamacro_at11(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, ...) metamacro_head(__VA_ARGS__) -#define metamacro_at12(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, ...) metamacro_head(__VA_ARGS__) -#define metamacro_at13(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, ...) metamacro_head(__VA_ARGS__) -#define metamacro_at14(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, ...) metamacro_head(__VA_ARGS__) -#define metamacro_at15(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, ...) metamacro_head(__VA_ARGS__) -#define metamacro_at16(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, ...) metamacro_head(__VA_ARGS__) -#define metamacro_at17(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, ...) metamacro_head(__VA_ARGS__) -#define metamacro_at18(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, ...) metamacro_head(__VA_ARGS__) -#define metamacro_at19(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, ...) metamacro_head(__VA_ARGS__) -#define metamacro_at20(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, ...) metamacro_head(__VA_ARGS__) - -// metamacro_foreach_cxt expansions -#define metamacro_foreach_cxt0(MACRO, SEP, CONTEXT) -#define metamacro_foreach_cxt1(MACRO, SEP, CONTEXT, _0) MACRO(0, CONTEXT, _0) - -#define metamacro_foreach_cxt2(MACRO, SEP, CONTEXT, _0, _1) \ - metamacro_foreach_cxt1(MACRO, SEP, CONTEXT, _0) \ - SEP \ - MACRO(1, CONTEXT, _1) - -#define metamacro_foreach_cxt3(MACRO, SEP, CONTEXT, _0, _1, _2) \ - metamacro_foreach_cxt2(MACRO, SEP, CONTEXT, _0, _1) \ - SEP \ - MACRO(2, CONTEXT, _2) - -#define metamacro_foreach_cxt4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \ - metamacro_foreach_cxt3(MACRO, SEP, CONTEXT, _0, _1, _2) \ - SEP \ - MACRO(3, CONTEXT, _3) - -#define metamacro_foreach_cxt5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \ - metamacro_foreach_cxt4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \ - SEP \ - MACRO(4, CONTEXT, _4) - -#define metamacro_foreach_cxt6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \ - metamacro_foreach_cxt5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \ - SEP \ - MACRO(5, CONTEXT, _5) - -#define metamacro_foreach_cxt7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \ - metamacro_foreach_cxt6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \ - SEP \ - MACRO(6, CONTEXT, _6) - -#define metamacro_foreach_cxt8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \ - metamacro_foreach_cxt7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \ - SEP \ - MACRO(7, CONTEXT, _7) - -#define metamacro_foreach_cxt9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \ - metamacro_foreach_cxt8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \ - SEP \ - MACRO(8, CONTEXT, _8) - -#define metamacro_foreach_cxt10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ - metamacro_foreach_cxt9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \ - SEP \ - MACRO(9, CONTEXT, _9) - -#define metamacro_foreach_cxt11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ - metamacro_foreach_cxt10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ - SEP \ - MACRO(10, CONTEXT, _10) - -#define metamacro_foreach_cxt12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \ - metamacro_foreach_cxt11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ - SEP \ - MACRO(11, CONTEXT, _11) - -#define metamacro_foreach_cxt13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \ - metamacro_foreach_cxt12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \ - SEP \ - MACRO(12, CONTEXT, _12) - -#define metamacro_foreach_cxt14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \ - metamacro_foreach_cxt13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \ - SEP \ - MACRO(13, CONTEXT, _13) - -#define metamacro_foreach_cxt15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \ - metamacro_foreach_cxt14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \ - SEP \ - MACRO(14, CONTEXT, _14) - -#define metamacro_foreach_cxt16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \ - metamacro_foreach_cxt15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \ - SEP \ - MACRO(15, CONTEXT, _15) - -#define metamacro_foreach_cxt17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \ - metamacro_foreach_cxt16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \ - SEP \ - MACRO(16, CONTEXT, _16) - -#define metamacro_foreach_cxt18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \ - metamacro_foreach_cxt17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \ - SEP \ - MACRO(17, CONTEXT, _17) - -#define metamacro_foreach_cxt19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \ - metamacro_foreach_cxt18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \ - SEP \ - MACRO(18, CONTEXT, _18) - -#define metamacro_foreach_cxt20(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19) \ - metamacro_foreach_cxt19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \ - SEP \ - MACRO(19, CONTEXT, _19) - -// metamacro_foreach_cxt_recursive expansions -#define metamacro_foreach_cxt_recursive0(MACRO, SEP, CONTEXT) -#define metamacro_foreach_cxt_recursive1(MACRO, SEP, CONTEXT, _0) MACRO(0, CONTEXT, _0) - -#define metamacro_foreach_cxt_recursive2(MACRO, SEP, CONTEXT, _0, _1) \ - metamacro_foreach_cxt_recursive1(MACRO, SEP, CONTEXT, _0) \ - SEP \ - MACRO(1, CONTEXT, _1) - -#define metamacro_foreach_cxt_recursive3(MACRO, SEP, CONTEXT, _0, _1, _2) \ - metamacro_foreach_cxt_recursive2(MACRO, SEP, CONTEXT, _0, _1) \ - SEP \ - MACRO(2, CONTEXT, _2) - -#define metamacro_foreach_cxt_recursive4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \ - metamacro_foreach_cxt_recursive3(MACRO, SEP, CONTEXT, _0, _1, _2) \ - SEP \ - MACRO(3, CONTEXT, _3) - -#define metamacro_foreach_cxt_recursive5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \ - metamacro_foreach_cxt_recursive4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \ - SEP \ - MACRO(4, CONTEXT, _4) - -#define metamacro_foreach_cxt_recursive6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \ - metamacro_foreach_cxt_recursive5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \ - SEP \ - MACRO(5, CONTEXT, _5) - -#define metamacro_foreach_cxt_recursive7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \ - metamacro_foreach_cxt_recursive6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \ - SEP \ - MACRO(6, CONTEXT, _6) - -#define metamacro_foreach_cxt_recursive8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \ - metamacro_foreach_cxt_recursive7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \ - SEP \ - MACRO(7, CONTEXT, _7) - -#define metamacro_foreach_cxt_recursive9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \ - metamacro_foreach_cxt_recursive8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \ - SEP \ - MACRO(8, CONTEXT, _8) - -#define metamacro_foreach_cxt_recursive10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ - metamacro_foreach_cxt_recursive9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \ - SEP \ - MACRO(9, CONTEXT, _9) - -#define metamacro_foreach_cxt_recursive11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ - metamacro_foreach_cxt_recursive10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ - SEP \ - MACRO(10, CONTEXT, _10) - -#define metamacro_foreach_cxt_recursive12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \ - metamacro_foreach_cxt_recursive11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ - SEP \ - MACRO(11, CONTEXT, _11) - -#define metamacro_foreach_cxt_recursive13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \ - metamacro_foreach_cxt_recursive12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \ - SEP \ - MACRO(12, CONTEXT, _12) - -#define metamacro_foreach_cxt_recursive14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \ - metamacro_foreach_cxt_recursive13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \ - SEP \ - MACRO(13, CONTEXT, _13) - -#define metamacro_foreach_cxt_recursive15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \ - metamacro_foreach_cxt_recursive14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \ - SEP \ - MACRO(14, CONTEXT, _14) - -#define metamacro_foreach_cxt_recursive16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \ - metamacro_foreach_cxt_recursive15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \ - SEP \ - MACRO(15, CONTEXT, _15) - -#define metamacro_foreach_cxt_recursive17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \ - metamacro_foreach_cxt_recursive16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \ - SEP \ - MACRO(16, CONTEXT, _16) - -#define metamacro_foreach_cxt_recursive18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \ - metamacro_foreach_cxt_recursive17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \ - SEP \ - MACRO(17, CONTEXT, _17) - -#define metamacro_foreach_cxt_recursive19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \ - metamacro_foreach_cxt_recursive18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \ - SEP \ - MACRO(18, CONTEXT, _18) - -#define metamacro_foreach_cxt_recursive20(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19) \ - metamacro_foreach_cxt_recursive19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \ - SEP \ - MACRO(19, CONTEXT, _19) - -// metamacro_for_cxt expansions -#define metamacro_for_cxt0(MACRO, SEP, CONTEXT) -#define metamacro_for_cxt1(MACRO, SEP, CONTEXT) MACRO(0, CONTEXT) - -#define metamacro_for_cxt2(MACRO, SEP, CONTEXT) \ - metamacro_for_cxt1(MACRO, SEP, CONTEXT) \ - SEP \ - MACRO(1, CONTEXT) - -#define metamacro_for_cxt3(MACRO, SEP, CONTEXT) \ - metamacro_for_cxt2(MACRO, SEP, CONTEXT) \ - SEP \ - MACRO(2, CONTEXT) - -#define metamacro_for_cxt4(MACRO, SEP, CONTEXT) \ - metamacro_for_cxt3(MACRO, SEP, CONTEXT) \ - SEP \ - MACRO(3, CONTEXT) - -#define metamacro_for_cxt5(MACRO, SEP, CONTEXT) \ - metamacro_for_cxt4(MACRO, SEP, CONTEXT) \ - SEP \ - MACRO(4, CONTEXT) - -#define metamacro_for_cxt6(MACRO, SEP, CONTEXT) \ - metamacro_for_cxt5(MACRO, SEP, CONTEXT) \ - SEP \ - MACRO(5, CONTEXT) - -#define metamacro_for_cxt7(MACRO, SEP, CONTEXT) \ - metamacro_for_cxt6(MACRO, SEP, CONTEXT) \ - SEP \ - MACRO(6, CONTEXT) - -#define metamacro_for_cxt8(MACRO, SEP, CONTEXT) \ - metamacro_for_cxt7(MACRO, SEP, CONTEXT) \ - SEP \ - MACRO(7, CONTEXT) - -#define metamacro_for_cxt9(MACRO, SEP, CONTEXT) \ - metamacro_for_cxt8(MACRO, SEP, CONTEXT) \ - SEP \ - MACRO(8, CONTEXT) - -#define metamacro_for_cxt10(MACRO, SEP, CONTEXT) \ - metamacro_for_cxt9(MACRO, SEP, CONTEXT) \ - SEP \ - MACRO(9, CONTEXT) - -#define metamacro_for_cxt11(MACRO, SEP, CONTEXT) \ - metamacro_for_cxt10(MACRO, SEP, CONTEXT) \ - SEP \ - MACRO(10, CONTEXT) - -#define metamacro_for_cxt12(MACRO, SEP, CONTEXT) \ - metamacro_for_cxt11(MACRO, SEP, CONTEXT) \ - SEP \ - MACRO(11, CONTEXT) - -#define metamacro_for_cxt13(MACRO, SEP, CONTEXT) \ - metamacro_for_cxt12(MACRO, SEP, CONTEXT) \ - SEP \ - MACRO(12, CONTEXT) - -#define metamacro_for_cxt14(MACRO, SEP, CONTEXT) \ - metamacro_for_cxt13(MACRO, SEP, CONTEXT) \ - SEP \ - MACRO(13, CONTEXT) - -#define metamacro_for_cxt15(MACRO, SEP, CONTEXT) \ - metamacro_for_cxt14(MACRO, SEP, CONTEXT) \ - SEP \ - MACRO(14, CONTEXT) - -#define metamacro_for_cxt16(MACRO, SEP, CONTEXT) \ - metamacro_for_cxt15(MACRO, SEP, CONTEXT) \ - SEP \ - MACRO(15, CONTEXT) - -#define metamacro_for_cxt17(MACRO, SEP, CONTEXT) \ - metamacro_for_cxt16(MACRO, SEP, CONTEXT) \ - SEP \ - MACRO(16, CONTEXT) - -#define metamacro_for_cxt18(MACRO, SEP, CONTEXT) \ - metamacro_for_cxt17(MACRO, SEP, CONTEXT) \ - SEP \ - MACRO(17, CONTEXT) - -#define metamacro_for_cxt19(MACRO, SEP, CONTEXT) \ - metamacro_for_cxt18(MACRO, SEP, CONTEXT) \ - SEP \ - MACRO(18, CONTEXT) - -#define metamacro_for_cxt20(MACRO, SEP, CONTEXT) \ - metamacro_for_cxt19(MACRO, SEP, CONTEXT) \ - SEP \ - MACRO(19, CONTEXT) - -// metamacro_if_eq expansions -#define metamacro_if_eq0(VALUE) \ - metamacro_concat(metamacro_if_eq0_, VALUE) - -#define metamacro_if_eq0_0(...) __VA_ARGS__ metamacro_consume_ -#define metamacro_if_eq0_1(...) metamacro_expand_ -#define metamacro_if_eq0_2(...) metamacro_expand_ -#define metamacro_if_eq0_3(...) metamacro_expand_ -#define metamacro_if_eq0_4(...) metamacro_expand_ -#define metamacro_if_eq0_5(...) metamacro_expand_ -#define metamacro_if_eq0_6(...) metamacro_expand_ -#define metamacro_if_eq0_7(...) metamacro_expand_ -#define metamacro_if_eq0_8(...) metamacro_expand_ -#define metamacro_if_eq0_9(...) metamacro_expand_ -#define metamacro_if_eq0_10(...) metamacro_expand_ -#define metamacro_if_eq0_11(...) metamacro_expand_ -#define metamacro_if_eq0_12(...) metamacro_expand_ -#define metamacro_if_eq0_13(...) metamacro_expand_ -#define metamacro_if_eq0_14(...) metamacro_expand_ -#define metamacro_if_eq0_15(...) metamacro_expand_ -#define metamacro_if_eq0_16(...) metamacro_expand_ -#define metamacro_if_eq0_17(...) metamacro_expand_ -#define metamacro_if_eq0_18(...) metamacro_expand_ -#define metamacro_if_eq0_19(...) metamacro_expand_ -#define metamacro_if_eq0_20(...) metamacro_expand_ - -#define metamacro_if_eq1(VALUE) metamacro_if_eq0(metamacro_dec(VALUE)) -#define metamacro_if_eq2(VALUE) metamacro_if_eq1(metamacro_dec(VALUE)) -#define metamacro_if_eq3(VALUE) metamacro_if_eq2(metamacro_dec(VALUE)) -#define metamacro_if_eq4(VALUE) metamacro_if_eq3(metamacro_dec(VALUE)) -#define metamacro_if_eq5(VALUE) metamacro_if_eq4(metamacro_dec(VALUE)) -#define metamacro_if_eq6(VALUE) metamacro_if_eq5(metamacro_dec(VALUE)) -#define metamacro_if_eq7(VALUE) metamacro_if_eq6(metamacro_dec(VALUE)) -#define metamacro_if_eq8(VALUE) metamacro_if_eq7(metamacro_dec(VALUE)) -#define metamacro_if_eq9(VALUE) metamacro_if_eq8(metamacro_dec(VALUE)) -#define metamacro_if_eq10(VALUE) metamacro_if_eq9(metamacro_dec(VALUE)) -#define metamacro_if_eq11(VALUE) metamacro_if_eq10(metamacro_dec(VALUE)) -#define metamacro_if_eq12(VALUE) metamacro_if_eq11(metamacro_dec(VALUE)) -#define metamacro_if_eq13(VALUE) metamacro_if_eq12(metamacro_dec(VALUE)) -#define metamacro_if_eq14(VALUE) metamacro_if_eq13(metamacro_dec(VALUE)) -#define metamacro_if_eq15(VALUE) metamacro_if_eq14(metamacro_dec(VALUE)) -#define metamacro_if_eq16(VALUE) metamacro_if_eq15(metamacro_dec(VALUE)) -#define metamacro_if_eq17(VALUE) metamacro_if_eq16(metamacro_dec(VALUE)) -#define metamacro_if_eq18(VALUE) metamacro_if_eq17(metamacro_dec(VALUE)) -#define metamacro_if_eq19(VALUE) metamacro_if_eq18(metamacro_dec(VALUE)) -#define metamacro_if_eq20(VALUE) metamacro_if_eq19(metamacro_dec(VALUE)) - -// metamacro_if_eq_recursive expansions -#define metamacro_if_eq_recursive0(VALUE) \ - metamacro_concat(metamacro_if_eq_recursive0_, VALUE) - -#define metamacro_if_eq_recursive0_0(...) __VA_ARGS__ metamacro_consume_ -#define metamacro_if_eq_recursive0_1(...) metamacro_expand_ -#define metamacro_if_eq_recursive0_2(...) metamacro_expand_ -#define metamacro_if_eq_recursive0_3(...) metamacro_expand_ -#define metamacro_if_eq_recursive0_4(...) metamacro_expand_ -#define metamacro_if_eq_recursive0_5(...) metamacro_expand_ -#define metamacro_if_eq_recursive0_6(...) metamacro_expand_ -#define metamacro_if_eq_recursive0_7(...) metamacro_expand_ -#define metamacro_if_eq_recursive0_8(...) metamacro_expand_ -#define metamacro_if_eq_recursive0_9(...) metamacro_expand_ -#define metamacro_if_eq_recursive0_10(...) metamacro_expand_ -#define metamacro_if_eq_recursive0_11(...) metamacro_expand_ -#define metamacro_if_eq_recursive0_12(...) metamacro_expand_ -#define metamacro_if_eq_recursive0_13(...) metamacro_expand_ -#define metamacro_if_eq_recursive0_14(...) metamacro_expand_ -#define metamacro_if_eq_recursive0_15(...) metamacro_expand_ -#define metamacro_if_eq_recursive0_16(...) metamacro_expand_ -#define metamacro_if_eq_recursive0_17(...) metamacro_expand_ -#define metamacro_if_eq_recursive0_18(...) metamacro_expand_ -#define metamacro_if_eq_recursive0_19(...) metamacro_expand_ -#define metamacro_if_eq_recursive0_20(...) metamacro_expand_ - -#define metamacro_if_eq_recursive1(VALUE) metamacro_if_eq_recursive0(metamacro_dec(VALUE)) -#define metamacro_if_eq_recursive2(VALUE) metamacro_if_eq_recursive1(metamacro_dec(VALUE)) -#define metamacro_if_eq_recursive3(VALUE) metamacro_if_eq_recursive2(metamacro_dec(VALUE)) -#define metamacro_if_eq_recursive4(VALUE) metamacro_if_eq_recursive3(metamacro_dec(VALUE)) -#define metamacro_if_eq_recursive5(VALUE) metamacro_if_eq_recursive4(metamacro_dec(VALUE)) -#define metamacro_if_eq_recursive6(VALUE) metamacro_if_eq_recursive5(metamacro_dec(VALUE)) -#define metamacro_if_eq_recursive7(VALUE) metamacro_if_eq_recursive6(metamacro_dec(VALUE)) -#define metamacro_if_eq_recursive8(VALUE) metamacro_if_eq_recursive7(metamacro_dec(VALUE)) -#define metamacro_if_eq_recursive9(VALUE) metamacro_if_eq_recursive8(metamacro_dec(VALUE)) -#define metamacro_if_eq_recursive10(VALUE) metamacro_if_eq_recursive9(metamacro_dec(VALUE)) -#define metamacro_if_eq_recursive11(VALUE) metamacro_if_eq_recursive10(metamacro_dec(VALUE)) -#define metamacro_if_eq_recursive12(VALUE) metamacro_if_eq_recursive11(metamacro_dec(VALUE)) -#define metamacro_if_eq_recursive13(VALUE) metamacro_if_eq_recursive12(metamacro_dec(VALUE)) -#define metamacro_if_eq_recursive14(VALUE) metamacro_if_eq_recursive13(metamacro_dec(VALUE)) -#define metamacro_if_eq_recursive15(VALUE) metamacro_if_eq_recursive14(metamacro_dec(VALUE)) -#define metamacro_if_eq_recursive16(VALUE) metamacro_if_eq_recursive15(metamacro_dec(VALUE)) -#define metamacro_if_eq_recursive17(VALUE) metamacro_if_eq_recursive16(metamacro_dec(VALUE)) -#define metamacro_if_eq_recursive18(VALUE) metamacro_if_eq_recursive17(metamacro_dec(VALUE)) -#define metamacro_if_eq_recursive19(VALUE) metamacro_if_eq_recursive18(metamacro_dec(VALUE)) -#define metamacro_if_eq_recursive20(VALUE) metamacro_if_eq_recursive19(metamacro_dec(VALUE)) - -// metamacro_take expansions -#define metamacro_take0(...) -#define metamacro_take1(...) metamacro_head(__VA_ARGS__) -#define metamacro_take2(...) metamacro_head(__VA_ARGS__), metamacro_take1(metamacro_tail(__VA_ARGS__)) -#define metamacro_take3(...) metamacro_head(__VA_ARGS__), metamacro_take2(metamacro_tail(__VA_ARGS__)) -#define metamacro_take4(...) metamacro_head(__VA_ARGS__), metamacro_take3(metamacro_tail(__VA_ARGS__)) -#define metamacro_take5(...) metamacro_head(__VA_ARGS__), metamacro_take4(metamacro_tail(__VA_ARGS__)) -#define metamacro_take6(...) metamacro_head(__VA_ARGS__), metamacro_take5(metamacro_tail(__VA_ARGS__)) -#define metamacro_take7(...) metamacro_head(__VA_ARGS__), metamacro_take6(metamacro_tail(__VA_ARGS__)) -#define metamacro_take8(...) metamacro_head(__VA_ARGS__), metamacro_take7(metamacro_tail(__VA_ARGS__)) -#define metamacro_take9(...) metamacro_head(__VA_ARGS__), metamacro_take8(metamacro_tail(__VA_ARGS__)) -#define metamacro_take10(...) metamacro_head(__VA_ARGS__), metamacro_take9(metamacro_tail(__VA_ARGS__)) -#define metamacro_take11(...) metamacro_head(__VA_ARGS__), metamacro_take10(metamacro_tail(__VA_ARGS__)) -#define metamacro_take12(...) metamacro_head(__VA_ARGS__), metamacro_take11(metamacro_tail(__VA_ARGS__)) -#define metamacro_take13(...) metamacro_head(__VA_ARGS__), metamacro_take12(metamacro_tail(__VA_ARGS__)) -#define metamacro_take14(...) metamacro_head(__VA_ARGS__), metamacro_take13(metamacro_tail(__VA_ARGS__)) -#define metamacro_take15(...) metamacro_head(__VA_ARGS__), metamacro_take14(metamacro_tail(__VA_ARGS__)) -#define metamacro_take16(...) metamacro_head(__VA_ARGS__), metamacro_take15(metamacro_tail(__VA_ARGS__)) -#define metamacro_take17(...) metamacro_head(__VA_ARGS__), metamacro_take16(metamacro_tail(__VA_ARGS__)) -#define metamacro_take18(...) metamacro_head(__VA_ARGS__), metamacro_take17(metamacro_tail(__VA_ARGS__)) -#define metamacro_take19(...) metamacro_head(__VA_ARGS__), metamacro_take18(metamacro_tail(__VA_ARGS__)) -#define metamacro_take20(...) metamacro_head(__VA_ARGS__), metamacro_take19(metamacro_tail(__VA_ARGS__)) - -// metamacro_drop expansions -#define metamacro_drop0(...) __VA_ARGS__ -#define metamacro_drop1(...) metamacro_tail(__VA_ARGS__) -#define metamacro_drop2(...) metamacro_drop1(metamacro_tail(__VA_ARGS__)) -#define metamacro_drop3(...) metamacro_drop2(metamacro_tail(__VA_ARGS__)) -#define metamacro_drop4(...) metamacro_drop3(metamacro_tail(__VA_ARGS__)) -#define metamacro_drop5(...) metamacro_drop4(metamacro_tail(__VA_ARGS__)) -#define metamacro_drop6(...) metamacro_drop5(metamacro_tail(__VA_ARGS__)) -#define metamacro_drop7(...) metamacro_drop6(metamacro_tail(__VA_ARGS__)) -#define metamacro_drop8(...) metamacro_drop7(metamacro_tail(__VA_ARGS__)) -#define metamacro_drop9(...) metamacro_drop8(metamacro_tail(__VA_ARGS__)) -#define metamacro_drop10(...) metamacro_drop9(metamacro_tail(__VA_ARGS__)) -#define metamacro_drop11(...) metamacro_drop10(metamacro_tail(__VA_ARGS__)) -#define metamacro_drop12(...) metamacro_drop11(metamacro_tail(__VA_ARGS__)) -#define metamacro_drop13(...) metamacro_drop12(metamacro_tail(__VA_ARGS__)) -#define metamacro_drop14(...) metamacro_drop13(metamacro_tail(__VA_ARGS__)) -#define metamacro_drop15(...) metamacro_drop14(metamacro_tail(__VA_ARGS__)) -#define metamacro_drop16(...) metamacro_drop15(metamacro_tail(__VA_ARGS__)) -#define metamacro_drop17(...) metamacro_drop16(metamacro_tail(__VA_ARGS__)) -#define metamacro_drop18(...) metamacro_drop17(metamacro_tail(__VA_ARGS__)) -#define metamacro_drop19(...) metamacro_drop18(metamacro_tail(__VA_ARGS__)) -#define metamacro_drop20(...) metamacro_drop19(metamacro_tail(__VA_ARGS__)) - -#endif diff --git a/AVOS/AVOSCloud/User/AVAnonymousUtils.h b/AVOS/AVOSCloud/User/AVAnonymousUtils.h index 5b9ea0e67..416e36916 100644 --- a/AVOS/AVOSCloud/User/AVAnonymousUtils.h +++ b/AVOS/AVOSCloud/User/AVAnonymousUtils.h @@ -41,13 +41,6 @@ __deprecated_msg("Deprecated. use AVUser instead.") */ + (void)logInWithBlock:(AVUserResultBlock)block __deprecated_msg("Deprecated. use +[AVUser loginAnonymouslyWithCallback:] instead."); -/*! - Creates an anonymous user. The selector for the callback should look like: (AVUser *)user error:(NSError *)error - @param target Target object for the selector. - @param selector The selector that will be called when the asynchronous request is complete. - */ -+ (void)logInWithTarget:(id)target selector:(SEL)selector __deprecated_msg("Deprecated. use +[AVUser loginAnonymouslyWithCallback:] instead."); - /*! @name Determining Whether a AVUser is Anonymous */ /*! diff --git a/AVOS/AVOSCloud/User/AVAnonymousUtils.m b/AVOS/AVOSCloud/User/AVAnonymousUtils.m index f25e9f352..96aad0e49 100644 --- a/AVOS/AVOSCloud/User/AVAnonymousUtils.m +++ b/AVOS/AVOSCloud/User/AVAnonymousUtils.m @@ -47,13 +47,6 @@ + (void)logInWithBlock:(AVUserResultBlock)block }]; } -+ (void)logInWithTarget:(id)target selector:(SEL)selector -{ - [AVAnonymousUtils logInWithBlock:^(AVUser *user, NSError *error) { - [AVUtils performSelectorIfCould:target selector:selector object:user object:error]; - }]; -} - + (BOOL)isLinkedWithUser:(AVUser *)user { if ([[user linkedServiceNames] containsObject:@"anonymous"]) diff --git a/AVOS/AVOSCloud/User/AVUser.h b/AVOS/AVOSCloud/User/AVUser.h index 03627dfd3..23aa650c5 100644 --- a/AVOS/AVOSCloud/User/AVUser.h +++ b/AVOS/AVOSCloud/User/AVUser.h @@ -573,23 +573,6 @@ __deprecated_msg("deprecated, use -[disassociateWithPlatformId:callback:] instea */ - (void)signUpInBackground AV_DEPRECATED("2.6.10"); -/*! - Signs up the user asynchronously. Make sure that password and username are set. This will also enforce that the username isn't already taken. - @param target Target object for the selector. - @param selector The selector that will be called when the asynchrounous request is complete. It should have the following signature: `(void)callbackWithResult:(NSNumber *)result error:(NSError **)error`. error will be nil on success and set if there was an error. `[result boolValue]` will tell you whether the call succeeded or not. - */ -- (void)signUpInBackgroundWithTarget:(id)target selector:(SEL)selector AV_DEPRECATED("2.6.10"); - -/*! - update user's password - @param oldPassword old password - @param newPassword new password - @param target Target object for the selector. - @param selector The selector that will be called when the asynchrounous request is complete. It should have the following signature: `(void)callbackWithResult:(id)object error:(NSError *)error`. error will be nil on success and set if there was an error. - @warning the user must have logged in, and provide both oldPassword and newPassword, otherwise can't update password successfully. - */ -- (void)updatePassword:(NSString *)oldPassword newPassword:(NSString *)newPassword withTarget:(id)target selector:(SEL)selector AV_DEPRECATED("2.6.10"); - /*! Makes a request to login a user with specified credentials. Returns an instance of the successfully logged in AVUser. This will also cache the user locally so @@ -611,38 +594,15 @@ __deprecated_msg("deprecated, use -[disassociateWithPlatformId:callback:] instea + (void)logInWithUsernameInBackground:(NSString *)username password:(NSString *)password AV_DEPRECATED("2.6.10"); -/*! - Makes an asynchronous request to login a user with specified credentials. - Returns an instance of the successfully logged in AVUser. This will also cache - the user locally so that calls to userFromCurrentUser will use the latest logged in user. - The selector for the callback should look like: myCallback:(AVUser *)user error:(NSError **)error - @param username The username of the user. - @param password The password of the user. - @param target Target object for the selector. - @param selector The selector that will be called when the asynchrounous request is complete. - */ -+ (void)logInWithUsernameInBackground:(NSString *)username - password:(NSString *)password - target:(id)target - selector:(SEL)selector AV_DEPRECATED("2.6.10"); - + (nullable instancetype)logInWithMobilePhoneNumber:(NSString *)phoneNumber password:(NSString *)password AV_DEPRECATED("2.6.10"); + (void)logInWithMobilePhoneNumberInBackground:(NSString *)phoneNumber password:(NSString *)password AV_DEPRECATED("2.6.10"); -+ (void)logInWithMobilePhoneNumberInBackground:(NSString *)phoneNumber - password:(NSString *)password - target:(id)target - selector:(SEL)selector AV_DEPRECATED("2.6.10"); + (nullable instancetype)logInWithMobilePhoneNumber:(NSString *)phoneNumber smsCode:(NSString *)code AV_DEPRECATED("2.6.10"); + (void)logInWithMobilePhoneNumberInBackground:(NSString *)phoneNumber smsCode:(NSString *)code AV_DEPRECATED("2.6.10"); -+ (void)logInWithMobilePhoneNumberInBackground:(NSString *)phoneNumber - smsCode:(NSString *)code - target:(id)target - selector:(SEL)selector AV_DEPRECATED("2.6.10"); /*! Send a password reset request for a specified email. If a user account exists with that email, @@ -660,18 +620,6 @@ __deprecated_msg("deprecated, use -[disassociateWithPlatformId:callback:] instea */ + (void)requestPasswordResetForEmailInBackground:(NSString *)email AV_DEPRECATED("2.6.10"); -/*! - Send a password reset request asynchronously for a specified email and sets an error object. - If a user account exists with that email, an email will be sent to that address with instructions - on how to reset their password. - @param email Email of the account to send a reset password request. - @param target Target object for the selector. - @param selector The selector that will be called when the asynchronous request is complete. It should have the following signature: (void)callbackWithResult:(NSNumber *)result error:(NSError **)error. error will be nil on success and set if there was an error. [result boolValue] will tell you whether the call succeeded or not. - */ -+ (void)requestPasswordResetForEmailInBackground:(NSString *)email - target:(id)target - selector:(SEL)selector AV_DEPRECATED("2.6.10"); - /*! Whether the user is an authenticated object for the device. An authenticated AVUser is one that is obtained via a signUp or logIn method. An authenticated object is required in order to save (with altered values) or delete it. diff --git a/AVOS/AVOSCloud/User/AVUser.m b/AVOS/AVOSCloud/User/AVUser.m index 14d372186..b038175b6 100644 --- a/AVOS/AVOSCloud/User/AVUser.m +++ b/AVOS/AVOSCloud/User/AVUser.m @@ -281,19 +281,6 @@ +(void)verifyMobilePhone:(NSString *)code withBlock:(AVBooleanResultBlock)block } -- (void)signUpInBackgroundWithTarget:(id)target selector:(SEL)selector -{ - [self signUpInBackgroundWithBlock:^(BOOL succeeded, NSError *error) { - [AVUtils performSelectorIfCould:target selector:selector object:@(succeeded) object:error]; - }]; -} - -- (void)updatePassword:(NSString *)oldPassword newPassword:(NSString *)newPassword withTarget:(id)target selector:(SEL)selector { - [self updatePassword:oldPassword newPassword:newPassword block:^(id object, NSError *error) { - [AVUtils performSelectorIfCould:target selector:selector object:object object:error]; - }]; -} - - (void)updatePassword:(NSString *)oldPassword newPassword:(NSString *)newPassword block:(AVIdResultBlock)block { if (self.isAuthDataExistInMemory && oldPassword && newPassword) { NSString *path = [NSString stringWithFormat:@"users/%@/updatePassword", self.objectId]; @@ -396,18 +383,6 @@ + (void)logInWithUsernameInBackground:(NSString *)username [[self class] logInWithUsername:username email:nil password:password block:nil waitUntilDone:YES error:nil]; } -+ (void)logInWithUsernameInBackground:(NSString *)username - password:(NSString *)password - target:(id)target - selector:(SEL)selector -{ - [[self class] logInWithUsernameInBackground:username - password:password - block:^(AVUser *user, NSError *error) { - [AVUtils performSelectorIfCould:target selector:selector object:user object:error]; - }]; -} - + (void)logInWithUsernameInBackground:(NSString *)username password:(NSString *)password block:(AVUserResultBlock)block @@ -495,18 +470,6 @@ + (void)logInWithMobilePhoneNumberInBackground:(NSString *)phoneNumber [self logInWithMobilePhoneNumber:phoneNumber password:password block:nil waitUntilDone:YES error:nil]; } -+ (void)logInWithMobilePhoneNumberInBackground:(NSString *)phoneNumber - password:(NSString *)password - target:(id)target - selector:(SEL)selector -{ - [self logInWithMobilePhoneNumberInBackground:phoneNumber - password:password - block:^(AVUser *user, NSError *error) { - [AVUtils performSelectorIfCould:target selector:selector object:user object:error]; - }]; -} - + (void)logInWithMobilePhoneNumberInBackground:(NSString *)phoneNumber password:(NSString *)password block:(AVUserResultBlock)block @@ -644,18 +607,6 @@ + (void)logInWithMobilePhoneNumberInBackground:(NSString *)phoneNumber [self logInWithMobilePhoneNumber:phoneNumber smsCode:code block:nil waitUntilDone:YES error:nil]; } -+ (void)logInWithMobilePhoneNumberInBackground:(NSString *)phoneNumber - smsCode:(NSString *)code - target:(id)target - selector:(SEL)selector -{ - [self logInWithMobilePhoneNumberInBackground:phoneNumber - smsCode:code - block:^(AVUser *user, NSError *error) { - [AVUtils performSelectorIfCould:target selector:selector object:user object:error]; - }]; -} - + (void)logInWithMobilePhoneNumberInBackground:(NSString *)phoneNumber smsCode:(NSString *)code block:(AVUserResultBlock)block @@ -726,17 +677,6 @@ + (void)signUpOrLoginWithMobilePhoneNumberInBackground:(NSString *)phoneNumber [self signUpOrLoginWithMobilePhoneNumber:phoneNumber smsCode:code block:nil waitUntilDone:YES error:nil]; } -+ (void)signUpOrLoginWithMobilePhoneNumberInBackground:(NSString *)phoneNumber - smsCode:(NSString *)code - target:(id)target - selector:(SEL)selector { - [self signUpOrLoginWithMobilePhoneNumberInBackground:phoneNumber - smsCode:code - block:^(AVUser *user, NSError *error) { - [AVUtils performSelectorIfCould:target selector:selector object:user object:error]; - }]; -} - + (void)signUpOrLoginWithMobilePhoneNumberInBackground:(NSString *)phoneNumber smsCode:(NSString *)code block:(AVUserResultBlock)block { @@ -849,15 +789,6 @@ + (void)requestPasswordResetForEmailInBackground:(NSString *)email }]; } -+ (void)requestPasswordResetForEmailInBackground:(NSString *)email - target:(id)target - selector:(SEL)selector -{ - [[self class] requestPasswordResetForEmailInBackground:email block:^(BOOL succeeded, NSError *error) { - [AVUtils performSelectorIfCould:target selector:selector object:@(succeeded) object:error]; - }]; -} - + (void)requestPasswordResetForEmailInBackground:(NSString *)email block:(AVBooleanResultBlock)block { [self internalRequestPasswordResetForEmailInBackground:email block:^(BOOL succeeded, NSError *error) { @@ -1111,7 +1042,7 @@ - (void)disassociateWithPlatformId:(NSString *)platformId LCErrorInternal(reason); }); - callback(nil, aError); + callback(false, aError); }); return; @@ -1129,7 +1060,7 @@ - (void)disassociateWithPlatformId:(NSString *)platformId dispatch_async(dispatch_get_main_queue(), ^{ - callback(nil, error); + callback(false, error); }); return; @@ -1141,7 +1072,7 @@ - (void)disassociateWithPlatformId:(NSString *)platformId dispatch_async(dispatch_get_main_queue(), ^{ - callback(nil, ({ + callback(false, ({ NSString *reason = @"response invalid."; LCErrorInternal(reason); })); @@ -1165,7 +1096,7 @@ - (void)disassociateWithPlatformId:(NSString *)platformId dispatch_async(dispatch_get_main_queue(), ^{ - callback(self, nil); + callback(true, nil); }); }]; } diff --git a/AVOS/AVOSCloud/UserAgent.h b/AVOS/AVOSCloud/UserAgent.h index 45df59e4f..021c32bf8 100644 --- a/AVOS/AVOSCloud/UserAgent.h +++ b/AVOS/AVOSCloud/UserAgent.h @@ -1 +1 @@ -#define SDK_VERSION @"v11.6.7" +#define SDK_VERSION @"12.0.0-beta.1" diff --git a/AVOS/AVOSCloud/Utils/AVUtils.h b/AVOS/AVOSCloud/Utils/AVUtils.h index 0873d5584..b66e4ac8d 100644 --- a/AVOS/AVOSCloud/Utils/AVUtils.h +++ b/AVOS/AVOSCloud/Utils/AVUtils.h @@ -11,27 +11,13 @@ #import "AVOSCloud.h" #import "AVHelpers.h" +// ref: https://github.com/keitaito/KeyPathMacroTestApp #define keyPath(base, path) ({ __unused typeof(base.path) _; @#path; }) #define ivarName(base, path) ({ __unused typeof(base->path) _; @#path; }) FOUNDATION_EXPORT NSInteger LCTimeZoneForSecondsFromGMT; NSDate * LCDateFromString(NSString *dateString); -/** - * Check the equality of two security key. - */ -BOOL LCSecKeyIsEqual(SecKeyRef key1, SecKeyRef key2); - -/** - * Get public key of given certificate. - */ -SecKeyRef LCGetPublicKeyFromCertificate(SecCertificateRef cert); - -/** - * Make certificate from base64 string. - */ -SecCertificateRef LCGetCertificateFromBase64String(NSString *base64); - #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) #import #else @@ -67,11 +53,6 @@ SecCertificateRef LCGetCertificateFromBase64String(NSString *base64); + (NSString *)jsonStringFromArray:(NSArray *)array; -+ (void)performSelectorIfCould:(id)target - selector:(SEL)selector - object:(id)arg1 - object:(id)arg2; - + (NSString *)generateUUID; + (NSString *)generateCompactUUID; + (NSString *)deviceUUID; diff --git a/AVOS/AVOSCloud/Utils/AVUtils.m b/AVOS/AVOSCloud/Utils/AVUtils.m index b929d1c6b..5a44a65ed 100644 --- a/AVOS/AVOSCloud/Utils/AVUtils.m +++ b/AVOS/AVOSCloud/Utils/AVUtils.m @@ -17,8 +17,6 @@ #import "AVRole_Internal.h" #import "AVFile.h" #import "AVFile_Internal.h" -#import "AVInstallation.h" -#import "AVInstallation_Internal.h" #import "AVObjectUtils.h" #import "AVPaasClient.h" @@ -145,59 +143,6 @@ static int b62_encode(char* out, const void *data, int length) return (int)(out-start); } -#if !TARGET_OS_IOS && !TARGET_OS_WATCH && !TARGET_OS_TV -static NSData * LCSecKeyGetData(SecKeyRef key) { - CFDataRef data = NULL; - - __Require_noErr_Quiet(SecItemExport(key, kSecFormatUnknown, kSecItemPemArmour, NULL, &data), _out); - - return (__bridge_transfer NSData *)data; - -_out: - if (data) { - CFRelease(data); - } - - return nil; -} -#endif - -BOOL LCSecKeyIsEqual(SecKeyRef key1, SecKeyRef key2) { -#if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV - return [(__bridge id)key1 isEqual:(__bridge id)key2]; -#else - return [LCSecKeyGetData(key1) isEqual:LCSecKeyGetData(key2)]; -#endif -} - -SecKeyRef LCGetPublicKeyFromCertificate(SecCertificateRef cert) { - SecKeyRef result = NULL; - SecCertificateRef certs[] = {cert}; - CFArrayRef certArr = CFArrayCreate(NULL, (const void **)certs, 1, NULL); - - SecPolicyRef policy = SecPolicyCreateBasicX509(); - - SecTrustRef trust; - __Require_noErr_Quiet(SecTrustCreateWithCertificates(certArr, policy, &trust), _out); - __Require_noErr_Quiet(SecTrustEvaluate(trust, NULL), _out); - - result = SecTrustCopyPublicKey(trust); - -_out: - if (policy) CFRelease(policy); - if (certArr) CFRelease(certArr); - if (trust) CFRelease(trust); - - return result; -} - -SecCertificateRef LCGetCertificateFromBase64String(NSString *base64) { - NSData *certData = [NSData AVdataFromBase64String:base64]; - SecCertificateRef cert = SecCertificateCreateWithData(NULL, (__bridge CFDataRef)(certData)); - - return cert; -} - @implementation AVUtils + (void)initialize { @@ -359,20 +304,6 @@ +(NSString *)jsonStringFromArray:(NSArray *)array return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; } -+(void)performSelectorIfCould:(id)target - selector:(SEL)selector - object:(id)arg1 - object:(id)arg2 -{ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Warc-performSelector-leaks" - if ([target respondsToSelector:selector]) - { - [target performSelector:selector withObject:arg1 withObject:arg2]; - } -#pragma clang diagnostic pop -} - + (NSString *)generateUUID { CFUUIDRef theUUID = CFUUIDCreate(NULL); @@ -919,15 +850,15 @@ + (NSData *)AVAESKeyForPassword:(NSString *)password{ //Derive NSData *salt = [NSData dataWithBytes:saltBuff length:kCCKeySizeAES128]; - int result = CCKeyDerivationPBKDF(kCCPBKDF2, // algorithm算法 - password.UTF8String, // password密码 - password.length, // passwordLength密码的长度 - salt.bytes, // salt内容 - salt.length, // saltLen长度 - kCCPRFHmacAlgSHA1, // PRF - kAVPBKDFRounds, // rounds循环次数 - derivedKey.mutableBytes, // derivedKey - derivedKey.length); // derivedKeyLen derive:出自 + __unused int result = CCKeyDerivationPBKDF(kCCPBKDF2, // algorithm算法 + password.UTF8String, // password密码 + password.length, // passwordLength密码的长度 + salt.bytes, // salt内容 + salt.length, // saltLen长度 + kCCPRFHmacAlgSHA1, // PRF + kAVPBKDFRounds, // rounds循环次数 + derivedKey.mutableBytes, // derivedKey + derivedKey.length); // derivedKeyLen derive:出自 NSAssert(result == kCCSuccess, @"Unable to create AES key for spassword: %d", result); diff --git a/AVOS/AVOSCloud/Utils/LCSSLChallenger.h b/AVOS/AVOSCloud/Utils/LCSSLChallenger.h deleted file mode 100644 index 7eb3263ec..000000000 --- a/AVOS/AVOSCloud/Utils/LCSSLChallenger.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// LCSSLChallenger.h -// AVOS -// -// Created by Tang Tianyong on 6/30/15. -// Copyright (c) 2015 LeanCloud Inc. All rights reserved. -// - -#import - -#define LC_SSL_PINNING_ENABLED 1 - -@interface LCSSLChallenger : NSObject - -+ (instancetype)sharedInstance; - -- (void)acceptChallenge:(NSURLAuthenticationChallenge *)challenge; - -@end diff --git a/AVOS/AVOSCloud/Utils/LCSSLChallenger.m b/AVOS/AVOSCloud/Utils/LCSSLChallenger.m deleted file mode 100644 index e4e9e49de..000000000 --- a/AVOS/AVOSCloud/Utils/LCSSLChallenger.m +++ /dev/null @@ -1,208 +0,0 @@ -// -// LCSSLChallenger.m -// AVOS -// -// Created by Tang Tianyong on 6/30/15. -// Copyright (c) 2015 LeanCloud Inc. All rights reserved. -// - -#import "LCSSLChallenger.h" -#import "AVHelpers.h" -#import "AVUtils.h" -#import -#import - -static NSString * const kLCDomainSuffix_leancloud_cn = @"leancloud.cn"; - -static NSString * const kLCCertificate_DomainSuffix_leancloud_cn = @"MIIFDzCCA/egAwIBAgIQECg10GmSYWMKtzx/By5NMTANBgkqhkiG9w0BAQsFADBEMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEdMBsGA1UEAxMUR2VvVHJ1c3QgU1NMIENBIC0gRzMwHhcNMTQxMTI4MDAwMDAwWhcNMTYwOTI0MjM1OTU5WjCBjDELMAkGA1UEBhMCQ04xEDAOBgNVBAgTB0JlaWppbmcxEDAOBgNVBAcUB0JlaWppbmcxMjAwBgNVBAoUKU1laSBXZWkgU2h1IFFpYW4gKCBCZWlqaW5nICkgSVQgQ28uLCBMdGQuMQwwCgYDVQQLFANPUFMxFzAVBgNVBAMUDioubGVhbmNsb3VkLmNuMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzHX5I4zHZcHerO3x0l5pScvqKE8MlK/6hzrDONDsBuMnfkAPRpkPPGB6HfaAAGjyStsi5hZrPgOA3r+6lActiapjnRnfTSo57tJyF/5XexLOdzU45fhNO41mJYiSlGAK0L+EUQSlnSClxixPDIwkkpbF8XYrrpPnZeSCzm62Jk38Lx6GUheZH3UzmC5JPmcqBgmAidmi36wFk7UWT2c6fmmDA+DWJBxdt5+/MhLG7OcFEP0YeiSDXwirnSlQphMswIn1d+XprX/BHqnvlQgnTPZeIrYraVmTlA2qjOWZLKlZExhLaSnOqT/XLQN9q0fAHrKswhrBAzOycvvbt/9HswIDAQABo4IBsjCCAa4wJwYDVR0RBCAwHoIOKi5sZWFuY2xvdWQuY26CDGxlYW5jbG91ZC5jbjAJBgNVHRMEAjAAMA4GA1UdDwEB/wQEAwIFoDArBgNVHR8EJDAiMCCgHqAchhpodHRwOi8vZ24uc3ltY2IuY29tL2duLmNybDCBoQYDVR0gBIGZMIGWMIGTBgpghkgBhvhFAQc2MIGEMD8GCCsGAQUFBwIBFjNodHRwczovL3d3dy5nZW90cnVzdC5jb20vcmVzb3VyY2VzL3JlcG9zaXRvcnkvbGVnYWwwQQYIKwYBBQUHAgIwNQwzaHR0cHM6Ly93d3cuZ2VvdHJ1c3QuY29tL3Jlc291cmNlcy9yZXBvc2l0b3J5L2xlZ2FsMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAfBgNVHSMEGDAWgBTSb/eW9IU/cjwwfSPahXibo3xafDBXBggrBgEFBQcBAQRLMEkwHwYIKwYBBQUHMAGGE2h0dHA6Ly9nbi5zeW1jZC5jb20wJgYIKwYBBQUHMAKGGmh0dHA6Ly9nbi5zeW1jYi5jb20vZ24uY3J0MA0GCSqGSIb3DQEBCwUAA4IBAQDdrrEg1t+LtyE5Roy5dhe7yM0tb5pcy+hEP1ZXncwv4SMldTWPejuomwF5vt2lX0FEhzrd1k9Ndk5LJq5x5SrCHos1kTO/MxkRvg7eUkErOYM0AK3j3I37xZv/rRN4UOJVKh1i4e88hgrAXhxLLQn96d8zzMJbpRYiBz3cW6I8w+bR5BtwVpgzJU5Z3gLDDJLVqwSDUjNpFrlmBor0kh7izPc5WAg5xkZ5ovQgp5Mwc1l9FByIqNZvY/pfGZBkEzeSP73rfccWg3Y7vz+mORgHDpSxAqmyna2hXn8aiEl3FW1v0w1PgJAskNmxt8zNAg38Jpuv7I1sDNjX/tyC1je0"; - -static NSString * const kLCDomainSuffix_lncld_net = @"lncld.net"; - -static NSString * const kLCCertificate_DomainSuffix_lncld_net = @"MIIFpzCCBI+gAwIBAgIRAPK8zg+g1SZe/3JFlLGHw68wDQYJKoZIhvcNAQELBQAwgZAxCzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAOBgNVBAcTB1NhbGZvcmQxGjAYBgNVBAoTEUNPTU9ETyBDQSBMaW1pdGVkMTYwNAYDVQQDEy1DT01PRE8gUlNBIERvbWFpbiBWYWxpZGF0aW9uIFNlY3VyZSBTZXJ2ZXIgQ0EwHhcNMTcwMjIyMDAwMDAwWhcNMTkwMjIxMjM1OTU5WjBhMSEwHwYDVQQLExhEb21haW4gQ29udHJvbCBWYWxpZGF0ZWQxITAfBgNVBAsTGFBvc2l0aXZlU1NMIE11bHRpLURvbWFpbjEZMBcGA1UEAxMQYXBpLmxlYW5jbG91ZC5jbjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK87NYGsrbi2YWzL8nDGRDiGlF1E5Ge12Mu2cJ5QKISGZaMv5obQTsDMlsph60QCkd3m7Q3EwBg7HVZD0UeLIXXalUePwgTkomDdUeEX1gD3xW0Jve7Wj+pFf1mq9Cf8sqSzc5Vh3AkU+wTEGScHt3P1fDLZQqgsrMCYNeAFAhPJ8yvK/gWcRlzJo0AYOdb/0WNNSZoBoMTmDdo+463mP6A2tX0O1hb3gY/oDfBpzETyBgB9YK4TmrbahalqzefHywl6iLKIq3c7sNThRHKoO1e057m2Kt+TwiCf8JiM5lCCqTGeIKzCyucst9OCM8l3MWDwzxSMi4W6DqHBZhsnjvkCAwEAAaOCAigwggIkMB8GA1UdIwQYMBaAFJCvajqUWgvYkOoSVnPfQ7Q6KNrnMB0GA1UdDgQWBBTqy0r3zgdlsyr9JboIQ05zIkGZHTAOBgNVHQ8BAf8EBAMCBaAwDAYDVR0TAQH/BAIwADAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwTwYDVR0gBEgwRjA6BgsrBgEEAbIxAQICBzArMCkGCCsGAQUFBwIBFh1odHRwczovL3NlY3VyZS5jb21vZG8uY29tL0NQUzAIBgZngQwBAgEwVAYDVR0fBE0wSzBJoEegRYZDaHR0cDovL2NybC5jb21vZG9jYS5jb20vQ09NT0RPUlNBRG9tYWluVmFsaWRhdGlvblNlY3VyZVNlcnZlckNBLmNybDCBhQYIKwYBBQUHAQEEeTB3ME8GCCsGAQUFBzAChkNodHRwOi8vY3J0LmNvbW9kb2NhLmNvbS9DT01PRE9SU0FEb21haW5WYWxpZGF0aW9uU2VjdXJlU2VydmVyQ0EuY3J0MCQGCCsGAQUFBzABhhhodHRwOi8vb2NzcC5jb21vZG9jYS5jb20wdgYDVR0RBG8wbYIQYXBpLmxlYW5jbG91ZC5jboIPKi5hcGkubG5jbGQubmV0ghIqLmVuZ2luZS5sbmNsZC5uZXSCECoucHVzaC5sbmNsZC5uZXSCDyoucnRtLmxuY2xkLm5ldIIRKi5zdGF0cy5sbmNsZC5uZXQwDQYJKoZIhvcNAQELBQADggEBADYw3GKsC/xA9U1J6nJ6jZQcvT+8HJqEEJSO5si+nh72dN3WyLkl4vbCt37zQEX+OlAYqdKnqKTXS+b4XStneSMdvVwbJoZwZ3sv7QNVLbQefMoQ5P5LcpZ7cag+bXcgy5zG1g4GN+bWARmqEflm1p4B/IZ9WWXMRCYot8iCj/PL/DpLCIMxVoLnqcmd5JtlL62uwthu4dE79qQTAoQ3bYRTjeqnDMpvexddonC2O8KijXPIm1azD0qKvRTshiljWGLqw0h/5KgTpgvDN/eGTFqBu6Pr4AL97THRUdgbgBTjkaSf1tGSX9tTYSl8eEtuoPCbW7QcHuiF/HHkK4j0wAQ="; - -static id publicKeyForCertificate(NSData *certificate) { - id allowedPublicKey = nil; - SecCertificateRef allowedCertificate; - SecCertificateRef allowedCertificates[1]; - CFArrayRef tempCertificates = nil; - SecPolicyRef policy = nil; - SecTrustRef allowedTrust = nil; - SecTrustResultType result; - - allowedCertificate = SecCertificateCreateWithData(NULL, (__bridge CFDataRef)certificate); - __Require_Quiet(allowedCertificate != NULL, _out); - - allowedCertificates[0] = allowedCertificate; - tempCertificates = CFArrayCreate(NULL, (const void **)allowedCertificates, 1, NULL); - - policy = SecPolicyCreateBasicX509(); - __Require_noErr_Quiet(SecTrustCreateWithCertificates(tempCertificates, policy, &allowedTrust), _out); - __Require_noErr_Quiet(SecTrustEvaluate(allowedTrust, &result), _out); - - allowedPublicKey = (__bridge_transfer id)SecTrustCopyPublicKey(allowedTrust); - -_out: - if (allowedTrust) { - CFRelease(allowedTrust); - } - - if (policy) { - CFRelease(policy); - } - - if (tempCertificates) { - CFRelease(tempCertificates); - } - - if (allowedCertificate) { - CFRelease(allowedCertificate); - } - - return allowedPublicKey; -} - -static NSArray * publicKeysForServerTrust(SecTrustRef serverTrust) { - SecPolicyRef policy = SecPolicyCreateBasicX509(); - CFIndex certificateCount = SecTrustGetCertificateCount(serverTrust); - NSMutableArray *trustChain = [NSMutableArray arrayWithCapacity:(NSUInteger)certificateCount]; - for (CFIndex i = 0; i < certificateCount; i++) { - SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, i); - - SecCertificateRef someCertificates[] = {certificate}; - CFArrayRef certificates = CFArrayCreate(NULL, (const void **)someCertificates, 1, NULL); - - SecTrustRef trust; - __Require_noErr_Quiet(SecTrustCreateWithCertificates(certificates, policy, &trust), _out); - - SecTrustResultType result; - __Require_noErr_Quiet(SecTrustEvaluate(trust, &result), _out); - - [trustChain addObject:(__bridge_transfer id)SecTrustCopyPublicKey(trust)]; - - _out: - if (trust) { - CFRelease(trust); - } - - if (certificates) { - CFRelease(certificates); - } - - continue; - } - CFRelease(policy); - - return [NSArray arrayWithArray:trustChain]; -} - -#if !TARGET_OS_IOS && !TARGET_OS_WATCH && !TARGET_OS_TV -static NSData * LCSecKeyGetData(SecKeyRef key) { - CFDataRef data = NULL; - - __Require_noErr_Quiet(SecItemExport(key, kSecFormatUnknown, kSecItemPemArmour, NULL, &data), _out); - - return (__bridge_transfer NSData *)data; - -_out: - if (data) { - CFRelease(data); - } - - return nil; -} -#endif - -static BOOL LCSecKeyIsEqualToKey(SecKeyRef key1, SecKeyRef key2) { -#if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV - return [(__bridge id)key1 isEqual:(__bridge id)key2]; -#else - return [LCSecKeyGetData(key1) isEqual:LCSecKeyGetData(key2)]; -#endif -} - -@implementation LCSSLChallenger { - - id _publicKey_DomainSuffix_leancloud_cn; - - id _publicKey_DomainSuffix_lncld_net; -} - -+ (instancetype)sharedInstance -{ - static LCSSLChallenger *instance = nil; - static dispatch_once_t onceToken; - - dispatch_once(&onceToken, ^{ - instance = [[LCSSLChallenger alloc] init]; - }); - - return instance; -} - -- (instancetype)init -{ - self = [super init]; - - if (self) { - - NSData *certData = nil; - - certData = [NSData AVdataFromBase64String:kLCCertificate_DomainSuffix_leancloud_cn]; - _publicKey_DomainSuffix_leancloud_cn = publicKeyForCertificate(certData); - - certData = [NSData AVdataFromBase64String:kLCCertificate_DomainSuffix_lncld_net]; - _publicKey_DomainSuffix_lncld_net = publicKeyForCertificate(certData); - } - - return self; -} - -- (BOOL)shouldTrustServerTrust:(SecTrustRef)serverTrust - pinnedPublicKey:(id)pinnedPublicKey -{ - NSArray *publicKeys = publicKeysForServerTrust(serverTrust); - - for (id publicKey in publicKeys) { - - if (LCSecKeyIsEqualToKey((__bridge SecKeyRef)publicKey, (__bridge SecKeyRef)pinnedPublicKey)) { - - return true; - } - } - - return false; -} - -- (void)acceptChallenge:(NSURLAuthenticationChallenge *)challenge -{ - NSString *host = challenge.protectionSpace.host; - - SecTrustRef secTrustRef = challenge.protectionSpace.serverTrust; - - void(^validateWithPublicKey_block)(id) = ^(id pinnedPublicKey) { - - if ([self shouldTrustServerTrust:secTrustRef pinnedPublicKey:pinnedPublicKey]) { - - NSURLCredential *credential = [NSURLCredential credentialForTrust:secTrustRef]; - - [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge]; - - } else { - - AVLoggerError(AVLoggerDomainNetwork, @"Request to Host: '%@' is rejected because SSL validation did fail.", host); - - [[challenge sender] cancelAuthenticationChallenge:challenge]; - } - }; - - if ([host hasSuffix:kLCDomainSuffix_leancloud_cn]) { - - validateWithPublicKey_block(_publicKey_DomainSuffix_leancloud_cn); - - } else if ([host hasSuffix:kLCDomainSuffix_lncld_net]) { - - validateWithPublicKey_block(_publicKey_DomainSuffix_lncld_net); - } -} - -@end diff --git a/AVOS/AVOSCloud/Utils/LCURLConnection.m b/AVOS/AVOSCloud/Utils/LCURLConnection.m index 2f5a0b69c..d429b01a5 100644 --- a/AVOS/AVOSCloud/Utils/LCURLConnection.m +++ b/AVOS/AVOSCloud/Utils/LCURLConnection.m @@ -10,29 +10,39 @@ @implementation LCURLConnection -+ (NSData *)sendSynchronousRequest:(NSURLRequest *)request returningResponse:(NSURLResponse *__autoreleasing *)response error:(NSError *__autoreleasing *)error { -#if !TARGET_OS_WATCH - return [NSURLConnection sendSynchronousRequest:request returningResponse:response error:error]; -#else - __block NSData *data = nil; - dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); ++ (NSData *)sendSynchronousRequest:(NSURLRequest *)request + returningResponse:(NSURLResponse *__autoreleasing *)response + error:(NSError *__autoreleasing *)error +{ + if (@available(iOS 7.0, macOS 10.9, tvOS 9.0, watchOS 2.0, *)) { + __block NSData *data = nil; + dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); - [[[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData *taskData, NSURLResponse *taskResponse, NSError *taskError) { - data = taskData; + [[[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData *taskData, NSURLResponse *taskResponse, NSError *taskError) { + data = taskData; - if (response) - *response = taskResponse; + if (response) + *response = taskResponse; - if (error) - *error = taskError; + if (error) + *error = taskError; - dispatch_semaphore_signal(semaphore); - }] resume]; + dispatch_semaphore_signal(semaphore); + }] resume]; - dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER); + dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER); - return data; + return data; + } else { +#if TARGET_OS_WATCH + return nil; +#else +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + return [NSURLConnection sendSynchronousRequest:request returningResponse:response error:error]; +#pragma clang diagnostic pop #endif + } } @end diff --git a/AVOS/AVOSCloudIM/Client/AVIMClient.m b/AVOS/AVOSCloudIM/Client/AVIMClient.m index 8decfe063..be8b371e4 100644 --- a/AVOS/AVOSCloudIM/Client/AVIMClient.m +++ b/AVOS/AVOSCloudIM/Client/AVIMClient.m @@ -147,7 +147,7 @@ - (void)doInitializationWithClientId:(NSString *)clientId self->_clientId = ({ if (!clientId || clientId.length > kClientIdLengthLimit || clientId.length == 0) { [NSException raise:NSInvalidArgumentException - format:@"clientId invalid or length not in range [1 %lu].", kClientIdLengthLimit]; + format:@"clientId invalid or length not in range [1 %lu].", (unsigned long)kClientIdLengthLimit]; } clientId.copy; }); @@ -372,7 +372,7 @@ - (void)openWithOption:(AVIMClientOpenOption)openOption sessionCommand.n = signature.nonce; } sessionCommand.deviceToken = client->_pushManager.deviceToken ?: AVUtils.deviceUUID; - sessionCommand.ua = @"ios/" SDK_VERSION; + sessionCommand.ua = USER_AGENT; LCIMProtobufCommandWrapper *commandWrapper = [LCIMProtobufCommandWrapper new]; commandWrapper.outCommand = outCommand; @@ -461,7 +461,7 @@ - (void)resumeWithSessionToken:(NSString *)sessionToken callback:(void (^)(BOOL sessionCommand.configBitmap = self->_sessionConfigBitmap; } sessionCommand.deviceToken = self->_pushManager.deviceToken ?: AVUtils.deviceUUID; - sessionCommand.ua = @"ios" @"/" SDK_VERSION; + sessionCommand.ua = USER_AGENT; } if (self->_lastPatchTimestamp) { sessionCommand.lastPatchTime = self->_lastPatchTimestamp; @@ -1619,7 +1619,7 @@ - (void)createConversationWithName:(NSString * _Nullable)name for (NSString *item in clientIds) { if (item.length > kClientIdLengthLimit || item.length == 0) { [self invokeInUserInteractQueue:^{ - callback(nil, LCErrorInternal([NSString stringWithFormat:@"client id's length should in range [1 %lu].", kClientIdLengthLimit])); + callback(nil, LCErrorInternal([NSString stringWithFormat:@"client id's length should in range [1 %lu].", (unsigned long)kClientIdLengthLimit])); }]; return; } @@ -1874,7 +1874,7 @@ - (void)queryOnlineClientsInClients:(NSArray *)clients NSUInteger clientsCountMax = 20; if (clients.count > clientsCountMax) { [self invokeInUserInteractQueue:^{ - callback(nil, LCErrorInternal([NSString stringWithFormat:@"clients count beyond max %lu", clientsCountMax])); + callback(nil, LCErrorInternal([NSString stringWithFormat:@"clients count beyond max %lu", (unsigned long)clientsCountMax])); }]; return; } diff --git a/AVOS/AVOSCloudIM/Conversation/AVIMConversation.m b/AVOS/AVOSCloudIM/Conversation/AVIMConversation.m index ae2d07ad5..a9361288a 100644 --- a/AVOS/AVOSCloudIM/Conversation/AVIMConversation.m +++ b/AVOS/AVOSCloudIM/Conversation/AVIMConversation.m @@ -742,7 +742,7 @@ - (void)addMembersWithClientIds:(NSArray *)clientIds for (NSString *item in clientIds) { if (item.length > kClientIdLengthLimit || item.length == 0) { [self invokeInUserInteractQueue:^{ - callback(false, LCErrorInternal([NSString stringWithFormat:@"client id's length should in range [1 %lu].", kClientIdLengthLimit])); + callback(false, LCErrorInternal([NSString stringWithFormat:@"client id's length should in range [1 %lu].", (unsigned long)kClientIdLengthLimit])); }]; return; } @@ -827,7 +827,7 @@ - (void)removeMembersWithClientIds:(NSArray *)clientIds for (NSString *item in clientIds) { if (item.length > kClientIdLengthLimit || item.length == 0) { [self invokeInUserInteractQueue:^{ - callback(false, LCErrorInternal([NSString stringWithFormat:@"client id's length should in range [1 %lu].", kClientIdLengthLimit])); + callback(false, LCErrorInternal([NSString stringWithFormat:@"client id's length should in range [1 %lu].", (unsigned long)kClientIdLengthLimit])); }]; return; } @@ -1494,7 +1494,7 @@ - (void)sendRealMessage:(AVIMMessage *)message outCommand.cmd = AVIMCommandType_Direct; outCommand.directMessage = directCommand; if (transientConv && priority) { - outCommand.priority = priority; + outCommand.priority = (int32_t)priority; } directCommand.cid = self->_conversationId; diff --git a/AVOS/AVOSCloudIM/Conversation/AVIMConversationQuery.m b/AVOS/AVOSCloudIM/Conversation/AVIMConversationQuery.m index 008fa1211..787c3b10a 100644 --- a/AVOS/AVOSCloudIM/Conversation/AVIMConversationQuery.m +++ b/AVOS/AVOSCloudIM/Conversation/AVIMConversationQuery.m @@ -247,19 +247,33 @@ - (void)whereKey:(NSString *)key matchesRegex:(NSString *)regex modifiers:(NSStr [self addWhereItem:dict forKey:key]; } +/** + * Converts a string into a regex that matches it. + * Surrounding with \Q .. \E does this, we just need to escape \E's in + * the text separately. + */ +static NSString * quote(NSString *string) +{ + NSString *replacedString = [string stringByReplacingOccurrencesOfString:@"\\E" withString:@"\\E\\\\E\\Q"]; + if (replacedString) { + replacedString = [[@"\\Q" stringByAppendingString:replacedString] stringByAppendingString:@"\\E"]; + } + return replacedString; +} + - (void)whereKey:(NSString *)key containsString:(NSString *)substring { - [self whereKey:key matchesRegex:[NSString stringWithFormat:@".*%@.*",substring]]; + [self whereKey:key matchesRegex:[NSString stringWithFormat:@".*%@.*", quote(substring)]]; } - (void)whereKey:(NSString *)key hasPrefix:(NSString *)prefix { - [self whereKey:key matchesRegex:[NSString stringWithFormat:@"^%@.*",prefix]]; + [self whereKey:key matchesRegex:[NSString stringWithFormat:@"^%@.*", quote(prefix)]]; } - (void)whereKey:(NSString *)key hasSuffix:(NSString *)suffix { - [self whereKey:key matchesRegex:[NSString stringWithFormat:@".*%@$",suffix]]; + [self whereKey:key matchesRegex:[NSString stringWithFormat:@".*%@$", quote(suffix)]]; } - (void)orderByAscending:(NSString *)key @@ -367,7 +381,7 @@ - (void)findConversationsWithCallback:(void (^)(NSArray * _N convCommand.sort = self.order; } if (self.option) { - convCommand.flag = self.option; + convCommand.flag = (int32_t)self.option; } if (self.skip) { convCommand.skip = (int32_t)self.skip; @@ -544,7 +558,7 @@ - (void)findTemporaryConversationsWith:(NSArray *)tempConvIds outCommand.convMessage = convCommand; if (self.option) { - convCommand.flag = self.option; + convCommand.flag = (int32_t)self.option; } convCommand.limit = (int32_t)tempConvIds.count; convCommand.tempConvIdsArray = tempConvIds.mutableCopy; diff --git a/AVOS/AVOSCloudIM/Utilities/AVIMRuntimeHelper.h b/AVOS/AVOSCloudIM/Utilities/AVIMRuntimeHelper.h deleted file mode 100644 index b780cf721..000000000 --- a/AVOS/AVOSCloudIM/Utilities/AVIMRuntimeHelper.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// AVIMRuntimeHelper.h -// AVOSCloudIM -// -// Created by Qihe Bian on 12/26/14. -// Copyright (c) 2014 LeanCloud Inc. All rights reserved. -// - -#import - -@interface AVIMRuntimeHelper : NSObject -+ (void)callMethodWithTarget:(id)target selector:(SEL)selector arguments:(NSArray *)arguments returnValue:(void *)returnValue; -+ (void)callMethodWithTarget:(id)target selector:(SEL)selector arguments:(NSArray *)arguments; -+ (void)callMethodInMainThreadWithTarget:(id)target selector:(SEL)selector arguments:(NSArray *)arguments; -@end diff --git a/AVOS/AVOSCloudIM/Utilities/AVIMRuntimeHelper.m b/AVOS/AVOSCloudIM/Utilities/AVIMRuntimeHelper.m deleted file mode 100644 index a79324d0f..000000000 --- a/AVOS/AVOSCloudIM/Utilities/AVIMRuntimeHelper.m +++ /dev/null @@ -1,208 +0,0 @@ -// -// AVIMRuntimeHelper.m -// AVOSCloudIM -// -// Created by Qihe Bian on 12/26/14. -// Copyright (c) 2014 LeanCloud Inc. All rights reserved. -// - -#import "AVIMRuntimeHelper.h" -#include - -@implementation AVIMRuntimeHelper -+ (void)invokeMethodWithTarget:(id)target method:(Method)method arguments:(NSArray *)arguments returnValue:(void *)returnValue { -//void invokeMethod(id obj, Method m, NSArray *arguments, void *returnValue) { - id obj = target; - Method m = method; - char *returnType = method_copyReturnType(m); - SEL sel = method_getName(m); - if ([obj respondsToSelector:sel]) { - NSMethodSignature *signature = [obj methodSignatureForSelector:sel]; - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; - unsigned int count = method_getNumberOfArguments(m); - [invocation setTarget:obj]; // index 0 (hidden) - [invocation setSelector:sel]; // index 1 (hidden) - void **argLocs = malloc(sizeof(void *) * (count - 2)); - - for (int i = 2; i < count; ++i) { - int j = i - 2; - id arg = [arguments objectAtIndex:j]; - char *argumentType = method_copyArgumentType(m, i); - if (arg == [NSNull null]) { - void *v = NULL; - argLocs[j] = malloc(sizeof(v)); - memcpy(argLocs[j], &v, sizeof(v)); - [invocation setArgument:argLocs[j] atIndex:i]; - continue; - } - switch (*argumentType) { - case '@': { - argLocs[j] = malloc(sizeof(arg)); - memcpy(argLocs[j], (void*)(&arg), sizeof(arg)); - [invocation setArgument:argLocs[j] atIndex:i]; - } - break; - case 'B': { - NSNumber *num = (NSNumber *)arg; - bool v = [num boolValue]; - argLocs[j] = malloc(sizeof(v)); - memcpy(argLocs[j], (void*)&v, sizeof(v)); - [invocation setArgument:argLocs[j] atIndex:i]; - } - break; - case 'c': { - NSNumber *num = (NSNumber *)arg; - char v = [num charValue]; - argLocs[j] = malloc(sizeof(v)); - memcpy(argLocs[j], (void*)&v, sizeof(v)); - [invocation setArgument:argLocs[j] atIndex:i]; - } - break; - case 's': { - NSNumber *num = (NSNumber *)arg; - short v = [num shortValue]; - argLocs[j] = malloc(sizeof(v)); - memcpy(argLocs[j], (void*)&v, sizeof(v)); - [invocation setArgument:argLocs[j] atIndex:i]; - } - break; - case 'i': { - NSNumber *num = (NSNumber *)arg; - int v = [num intValue]; - argLocs[j] = malloc(sizeof(v)); - memcpy(argLocs[j], (void*)&v, sizeof(v)); - [invocation setArgument:argLocs[j] atIndex:i]; - } - break; - case 'l': { - NSNumber *num = (NSNumber *)arg; - long v = [num longValue]; - argLocs[j] = malloc(sizeof(v)); - memcpy(argLocs[j], (void*)&v, sizeof(v)); - [invocation setArgument:argLocs[j] atIndex:i]; - } - break; - case 'q': { - NSNumber *num = (NSNumber *)arg; - long long v = [num longLongValue]; - argLocs[j] = malloc(sizeof(v)); - memcpy(argLocs[j], (void*)&v, sizeof(v)); - [invocation setArgument:argLocs[j] atIndex:i]; - } - break; - case 'd': { - NSNumber *num = (NSNumber *)arg; - double v = [num doubleValue]; - argLocs[j] = malloc(sizeof(v)); - memcpy(argLocs[j], (void*)&v, sizeof(v)); - [invocation setArgument:argLocs[j] atIndex:i]; - } - break; - case 'f': { - NSNumber *num = (NSNumber *)arg; - float v = [num floatValue]; - argLocs[j] = malloc(sizeof(v)); - memcpy(argLocs[j], (void*)&v, sizeof(v)); - [invocation setArgument:argLocs[j] atIndex:i]; - } - break; - case 'C': { - NSNumber *num = (NSNumber *)arg; - unsigned char v = [num unsignedCharValue]; - argLocs[j] = malloc(sizeof(v)); - memcpy(argLocs[j], (void*)&v, sizeof(v)); - [invocation setArgument:argLocs[j] atIndex:i]; - } - break; - case 'S': { - NSNumber *num = (NSNumber *)arg; - unsigned short v = [num unsignedShortValue]; - argLocs[j] = malloc(sizeof(v)); - memcpy(argLocs[j], (void*)&v, sizeof(v)); - [invocation setArgument:argLocs[j] atIndex:i]; - } - break; - case 'I': { - NSNumber *num = (NSNumber *)arg; - unsigned int v = [num unsignedIntValue]; - argLocs[j] = malloc(sizeof(v)); - memcpy(argLocs[j], (void*)&v, sizeof(v)); - [invocation setArgument:argLocs[j] atIndex:i]; - } - break; - case 'L': { - NSNumber *num = (NSNumber *)arg; - unsigned long v = [num unsignedLongValue]; - argLocs[j] = malloc(sizeof(v)); - memcpy(argLocs[j], (void*)&v, sizeof(v)); - [invocation setArgument:argLocs[j] atIndex:i]; - } - break; - case 'Q': { - NSNumber *num = (NSNumber *)arg; - unsigned long long v = [num unsignedLongLongValue]; - argLocs[j] = malloc(sizeof(v)); - memcpy(argLocs[j], (void*)&v, sizeof(v)); - [invocation setArgument:argLocs[j] atIndex:i]; - } - break; - case '^': { - NSValue *value = (NSValue *)arg; - void *v = [value pointerValue]; - argLocs[j] = malloc(sizeof(v)); - memcpy(argLocs[j], (void*)&v, sizeof(v)); - [invocation setArgument:argLocs[j] atIndex:i]; - } - break; - default: { - argLocs[j] = NULL; - } - break; - } - free(argumentType); - } - [invocation invoke]; - for (int i = 2; i < count; ++i) { - int j = i - 2; - if (argLocs[j]) { - free(argLocs[j]); - } - } - free(argLocs); - if (returnValue) { - switch (*returnType) { - case 'v': { - memset(returnValue, 0, sizeof(void *)); - } - break; - default: { - [invocation getReturnValue:returnValue]; - } - break; - } - } - } else { - if (returnValue) { - memset(returnValue, 0, sizeof(void *)); - } - } - free(returnType); -} - -+ (void)callMethodWithTarget:(id)target selector:(SEL)selector arguments:(NSArray *)arguments returnValue:(void *)returnValue { - if ([target respondsToSelector:selector]) { - Method m = class_getInstanceMethod([target class], selector); - [self invokeMethodWithTarget:target method:m arguments:arguments returnValue:returnValue]; - } -} - -+ (void)callMethodWithTarget:(id)target selector:(SEL)selector arguments:(NSArray *)arguments { - [self callMethodWithTarget:target selector:selector arguments:arguments returnValue:NULL]; -} - -+ (void)callMethodInMainThreadWithTarget:(id)target selector:(SEL)selector arguments:(NSArray *)arguments { - dispatch_async(dispatch_get_main_queue(), ^{ - [self callMethodWithTarget:target selector:selector arguments:arguments returnValue:NULL]; - }); -} -@end diff --git a/AVOS/AVOSCloudIM/Vendor/SDMacros/SDMacros.h b/AVOS/AVOSCloudIM/Vendor/SDMacros/SDMacros.h deleted file mode 100755 index 195a88d11..000000000 --- a/AVOS/AVOSCloudIM/Vendor/SDMacros/SDMacros.h +++ /dev/null @@ -1,168 +0,0 @@ -// -// SDMacros.h -// -// Created by Brandon Sneed on 7/11/13. -// Copyright (c) 2013 SetDirection. All rights reserved. -// -// -// DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE -// Version 2, December 2004 -// -// Everyone is permitted to copy and distribute verbatim or modified -// copies of this source code, and changing it is allowed as long -// as the name is changed. -// -// DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE -// TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -// -// 0. You just DO WHAT THE FUCK YOU WANT TO. - -/** - The __deprecated__ macro saves a little bit of typing around marking classes and methods as deprecated. - It also provides a compile-time warning which can be used to direct developers elsewhere. - - Example 1: Methods - - @interface SDLocationManager: CLLocationManager - + (SDLocationManager *)instance; - - (void)startUpdatingLocation __deprecated__("Use the withDelegate versions of this method"); - - (void)stopUpdatingHeading __deprecated__("Use the withDelegate versions of this method"); - @end - - Example 2: Object interface - - __deprecated__("Use CLGeocoder instead.") - @interface SDGeocoder : NSObject - - (id)initWithQuery:(NSString *)queryString apiKey:(NSString *)apiKey; - @end - - Example 3: Formal protocol - - __deprecated__("Use CLGeocoder instead.") - @protocol SDGeocoderDelegate - - (void)geocoder:(SDGeocoder *)geocoder didFailWithError:(NSError *)error; - - (void)geocoder:(SDGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark; - @end - */ - -#define __deprecated__(s) __attribute__((deprecated(s))) - -/** - @weakify, @unsafeify and @strongify are loosely based on EXTobjc's implementation with some subtle - differences. The main change here has been to reduce the amount of macro-foo to something more - understandable. The calling pattern has also changed. EXTobjc's @weakify for example accepts a - variable argument list, which it will in turn generate weak shadow vars for all the items in the arg - list. - - This version makes the weak designation a little more implicit by only accepting 1 variable per call. - A second version of this macro (with the same name) allows it to be used outside of the context of a - block. This can be useful when dealing with delegates, datasources, IBOutlets, etc that are marked - as weak or strong. - */ - -/** - @weakify(existingStrongVar) - - Creates a weak shadow variable called _existingStrongVar_weak which can be later made strong again - with #strongify. - - This is typically used to weakly reference variables in a block, but then ensure that - the variables stay alive during the actual execution of the block (if they were live upon - entry) - - Example: - - @weakify(self); - [object doSomethingInBlock:^{ - @strongify(self); - [self doSomething]; - }]; - - @weakify(existingStrongVar, myWeakVar) - - Creates a weak shadow variable of existingStrongVar and gives it the name myWeakVar. This is useful - outside of blocks where a weak reference might be needed. - - */ - -#define weakify(...) \ - try {} @finally {} \ - macro_dispatcher(weakify, __VA_ARGS__)(__VA_ARGS__) - -/** - Like #weakify, but uses __unsafe_unretained instead. - */ - -#define unsafeify(...) \ - try {} @finally {} \ - macro_dispatcher(unsafeify, __VA_ARGS__)(__VA_ARGS__) - -/** - @strongify(existingWeakVar) - - Redefines existingWeakVar to a strong variable of the same type. This is typically used to redefine - a weak self reference inside a block. - - Example: - - @weakify(self); - [object doSomethingInBlock:^{ - @strongify(self); - [self doSomething]; - }]; - - @strongify(existingWeakVar, myStrongVar) - - Creates a strong shadow variable of existingWeakVar and gives it the name myStrongVar. This is useful - outside of blocks where a strong reference might be needed. - - Example: - - @strongify(self.delegate, myDelegate); - if (myDelegate && [myDelegate respondsToSelector:@selector(someSelector)]) - [myDelegate someSelector]; - - */ - -#define strongify(...) \ - try {} @finally {} \ - macro_dispatcher(strongify, __VA_ARGS__)(__VA_ARGS__) - - -/****** It's probably best not to call macros below this line directly. *******/ - -// Support bits for macro dispatching based on parameter count. - -#define va_num_args(...) va_num_args_impl(__VA_ARGS__, 5,4,3,2,1) -#define va_num_args_impl(_1,_2,_3,_4,_5,N,...) N - -#define macro_dispatcher(func, ...) macro_dispatcher_(func, va_num_args(__VA_ARGS__)) -#define macro_dispatcher_(func, nargs) macro_dispatcher__(func, nargs) -#define macro_dispatcher__(func, nargs) func ## nargs - -// Support macros for @strongify. - -#define strongify1(v) \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wshadow\"") \ - __strong __typeof(v) v = v ## _weak_ \ - _Pragma("clang diagnostic pop") - -#define strongify2(v_in, v_out) \ - __strong __typeof(v_in) v_out = v_in \ - -// Support macros for @weakify. - -#define weakify1(v) \ - __weak __typeof(v) v ## _weak_ = v \ - -#define weakify2(v_in, v_out) \ - __weak __typeof(v_in) v_out = v_in \ - -// Support macros for @unsafeify. - -#define unsafeify1(v) \ - __unsafe_unretained __typeof(v) v ## _weak_ = v \ - -#define unsafeify2(v_in, v_out) \ - __unsafe_unretained __typeof(v_in) v_out = v_in \ diff --git a/AVOS/AVOSCloudIM/Vendor/SocketRocket/AVIMWebSocket.h b/AVOS/AVOSCloudIM/Vendor/SocketRocket/AVIMWebSocket.h index 5426630ee..d41ddd246 100755 --- a/AVOS/AVOSCloudIM/Vendor/SocketRocket/AVIMWebSocket.h +++ b/AVOS/AVOSCloudIM/Vendor/SocketRocket/AVIMWebSocket.h @@ -38,12 +38,6 @@ typedef enum AVIMStatusCode : NSInteger { AVIMStatusCodeMessageTooBig = 1009, } AVIMStatusCode; -typedef NS_ENUM(NSInteger, AVIMSSLPinningMode) { - AVIMSSLPinningModeNone = 0, - AVIMSSLPinningModeCertificate = 1, - AVIMSSLPinningModePublicKey = 2 -}; - @class AVIMWebSocket; extern NSString *const AVIMWebSocketErrorDomain; @@ -71,7 +65,6 @@ extern NSString *const AVIMHTTPResponseErrorKey; // This returns the negotiated protocol. // It will be nil until after the handshake completes. @property (nonatomic, readonly, copy) NSString *protocol; -@property (nonatomic, assign) AVIMSSLPinningMode SSLPinningMode; // Protocols should be an array of strings that turn into Sec-WebSocket-Protocol. - (id)initWithURLRequest:(NSURLRequest *)request protocols:(NSArray *)protocols allowsUntrustedSSLCertificates:(BOOL)allowsUntrustedSSLCertificates; @@ -123,22 +116,6 @@ extern NSString *const AVIMHTTPResponseErrorKey; @end -#pragma mark - NSURLRequest (CertificateAdditions) - -@interface NSURLRequest (CertificateAdditions) - -@property (nonatomic, retain, readonly) NSArray *AVIM_SSLPinnedCertificates; - -@end - -#pragma mark - NSMutableURLRequest (CertificateAdditions) - -@interface NSMutableURLRequest (CertificateAdditions) - -@property (nonatomic, retain) NSArray *AVIM_SSLPinnedCertificates; - -@end - #pragma mark - NSRunLoop (AVIMWebSocket) @interface NSRunLoop (AVIMWebSocket) diff --git a/AVOS/AVOSCloudIM/Vendor/SocketRocket/AVIMWebSocket.m b/AVOS/AVOSCloudIM/Vendor/SocketRocket/AVIMWebSocket.m index 84337ca10..e4b7c7706 100755 --- a/AVOS/AVOSCloudIM/Vendor/SocketRocket/AVIMWebSocket.m +++ b/AVOS/AVOSCloudIM/Vendor/SocketRocket/AVIMWebSocket.m @@ -221,8 +221,6 @@ @implementation AVIMWebSocket { NSString *_secKey; NSString *_basicAuthorizationString; - BOOL _pinnedCertFound; - uint8_t _currentReadMaskKey[4]; size_t _currentReadMaskOffset; @@ -601,14 +599,8 @@ - (void)_updateSecureStreamOptions; [_outputStream setProperty:(__bridge id)kCFStreamSocketSecurityLevelNegotiatedSSL forKey:(__bridge id)kCFStreamPropertySocketSecurityLevel]; - // If we're using pinned certs, don't validate the certificate chain - if ([_urlRequest AVIM_SSLPinnedCertificates].count) { - [SSLOptions setValue:@NO forKey:(__bridge id)kCFStreamSSLValidatesCertificateChain]; - } - /* * NOTE: we (LeanCloud) disable the certificate validation explicitly for using IP access. - * Instead, we use SSL pinning to ensure data security. As an additional benifit, it can prevent the MITM attack, to some extent. */ [SSLOptions setValue:@NO forKey:(__bridge id)kCFStreamSSLValidatesCertificateChain]; @@ -1436,133 +1428,10 @@ - (void)_sendFrameWithOpcode:(AVIMOpCode)opcode data:(id)data; [self _writeData:frame]; } -- (BOOL)pinCertificate:(NSArray *)sslCerts forServerTrust:(SecTrustRef)secTrust { - if (!secTrust) - return NO; - - NSInteger numCerts = SecTrustGetCertificateCount(secTrust); - for (NSInteger i = 0; i < numCerts; i++) { - SecCertificateRef cert = SecTrustGetCertificateAtIndex(secTrust, i); - NSData *certData = CFBridgingRelease(SecCertificateCopyData(cert)); - - for (id ref in sslCerts) { - SecCertificateRef trustedCert = (__bridge SecCertificateRef)ref; - NSData *trustedCertData = CFBridgingRelease(SecCertificateCopyData(trustedCert)); - - if ([trustedCertData isEqualToData:certData]) { - return YES; - } - } - } - - return NO; -} - -BOOL LCSecKeyIsEqual(SecKeyRef key1, SecKeyRef key2); -SecKeyRef LCGetPublicKeyFromCertificate(SecCertificateRef cert); - -/*! - * Convert certificates to public keys. - * @param certs Certificate array, it should be an array of SecCertificateRef. - * @return An array of public keys. - */ -NS_INLINE -NSArray *LCPublicKeysFromCerts(NSArray *certs) { - NSMutableArray *publicKeys = [NSMutableArray array]; - - for (id cert in certs) { - SecKeyRef publicKey = LCGetPublicKeyFromCertificate((__bridge SecCertificateRef)cert); - - if (publicKey) { - [publicKeys addObject:(__bridge_transfer id)publicKey]; - } - } - - return publicKeys; -} - -- (BOOL)pinPublicKey:(NSArray *)sslCerts forServerTrust:(SecTrustRef)secTrust { - BOOL result = NO; - - if (!secTrust) - return result; - - SecPolicyRef policy = SecPolicyCreateBasicX509(); - NSInteger numCerts = SecTrustGetCertificateCount(secTrust); - NSArray *pinnedPublicKeys = LCPublicKeysFromCerts(sslCerts); - - for (NSInteger i = 0; i < numCerts; i++) { - SecCertificateRef cert = SecTrustGetCertificateAtIndex(secTrust, i); - - SecCertificateRef certs[] = {cert}; - CFArrayRef certificates = CFArrayCreate(NULL, (const void **)certs, 1, NULL); - - SecTrustRef trust; - - do { - if (SecTrustCreateWithCertificates(certificates, policy, &trust) != noErr) break; - if (SecTrustEvaluate(trust, NULL) != noErr) break; - - id publicKey = (__bridge_transfer id)SecTrustCopyPublicKey(trust); - - for (id pinnedPublicKey in pinnedPublicKeys) { - if (LCSecKeyIsEqual((__bridge SecKeyRef)pinnedPublicKey, (__bridge SecKeyRef)publicKey)) { - result = YES; - break; - } - } - } while (NO); - - if (certificates) - CFRelease(certificates); - - if (trust) - CFRelease(trust); - - if (result) - break; - } - - if (policy) - CFRelease(policy); - - return result; -} - // MARK: - NSStreamDelegate - (void)stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode; { - if (_secure && _SSLPinningMode && !_pinnedCertFound && (eventCode == NSStreamEventHasBytesAvailable || eventCode == NSStreamEventHasSpaceAvailable)) { - NSArray *sslCerts = [_urlRequest AVIM_SSLPinnedCertificates]; - - if (sslCerts) { - SecTrustRef secTrust = (__bridge SecTrustRef)[aStream propertyForKey:(__bridge id)kCFStreamPropertySSLPeerTrust]; - - switch (_SSLPinningMode) { - case AVIMSSLPinningModeNone: - break; - case AVIMSSLPinningModeCertificate: - _pinnedCertFound = [self pinCertificate:sslCerts forServerTrust:secTrust]; - break; - case AVIMSSLPinningModePublicKey: - _pinnedCertFound = [self pinPublicKey:sslCerts forServerTrust:secTrust]; - break; - } - - if (!_pinnedCertFound) { - [self _failWithError:[NSError errorWithDomain:AVIMWebSocketErrorDomain code:23556 userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Invalid server cert"] forKey:NSLocalizedDescriptionKey]]]; - return; - } - - if (aStream == _outputStream && _pinnedCertFound) { - dispatch_async(_workQueue, ^{ - [self didConnect]; - }); - } - } - } - dispatch_async(_workQueue, ^{ switch (eventCode) { case NSStreamEventOpenCompleted: { @@ -1572,9 +1441,7 @@ - (void)stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode; } assert(_readBuffer); - // didConnect fires after certificate verification if we're using pinned certificates. - BOOL usingPinnedCerts = [[_urlRequest AVIM_SSLPinnedCertificates] count] > 0; - if ((!_secure || !usingPinnedCerts) && self.readyState == AVIMWebSocketStateConnecting && aStream == _inputStream) { + if (self.readyState == AVIMWebSocketStateConnecting && aStream == _inputStream) { [self didConnect]; } [self _pumpWriting]; @@ -1724,30 +1591,6 @@ - (void)returnConsumer:(AVIMIOConsumer *)consumer; @end - -@implementation NSURLRequest (CertificateAdditions) - -- (NSArray *)AVIM_SSLPinnedCertificates; -{ - return [NSURLProtocol propertyForKey:@"AVIM_SSLPinnedCertificates" inRequest:self]; -} - -@end - -@implementation NSMutableURLRequest (CertificateAdditions) - -- (NSArray *)AVIM_SSLPinnedCertificates; -{ - return [NSURLProtocol propertyForKey:@"AVIM_SSLPinnedCertificates" inRequest:self]; -} - -- (void)setAVIM_SSLPinnedCertificates:(NSArray *)AVIM_SSLPinnedCertificates; -{ - [NSURLProtocol setProperty:AVIM_SSLPinnedCertificates forKey:@"AVIM_SSLPinnedCertificates" inRequest:self]; -} - -@end - @implementation NSURL (AVIMWebSocket) - (NSString *)AVIM_origin; diff --git a/AVOS/AVOSCloudIM/WebSocket/AVIMWebSocketWrapper.m b/AVOS/AVOSCloudIM/WebSocket/AVIMWebSocketWrapper.m index 5034aa5fa..3d4457371 100644 --- a/AVOS/AVOSCloudIM/WebSocket/AVIMWebSocketWrapper.m +++ b/AVOS/AVOSCloudIM/WebSocket/AVIMWebSocketWrapper.m @@ -15,7 +15,6 @@ #import "LCNetworkReachabilityManager.h" #import "AVPaasClient.h" -#import "AVOSCloud_Internal.h" #import "LCRouter_Internal.h" #import "AVErrorUtils.h" #import "AVUtils.h" @@ -24,18 +23,14 @@ #import #define LCIM_OUT_COMMAND_LOG_FORMAT \ - @"\n\n" \ - @"------ BEGIN LeanCloud IM Out Command ------\n" \ + @"\n------ BEGIN LeanCloud IM Out Command ------\n" \ @"content: %@\n" \ - @"------ END ---------------------------------\n" \ - @"\n" + @"------ END ---------------------------------" \ #define LCIM_IN_COMMAND_LOG_FORMAT \ - @"\n\n" \ - @"------ BEGIN LeanCloud IM In Command ------\n" \ + @"\n------ BEGIN LeanCloud IM In Command ------\n" \ @"content: %@\n" \ - @"------ END --------------------------------\n" \ - @"\n" + @"------ END --------------------------------" // 180s #define PingInterval (60.0 * 3.0) diff --git a/AVOS/AVOSCloudIMTests/Swift/AVIMClientTestCase.swift b/AVOS/AVOSCloudIMTests/Swift/AVIMClientTestCase.swift index fbce1cb8c..9d9fa84a3 100644 --- a/AVOS/AVOSCloudIMTests/Swift/AVIMClientTestCase.swift +++ b/AVOS/AVOSCloudIMTests/Swift/AVIMClientTestCase.swift @@ -14,7 +14,7 @@ class AVIMClientTestCase: LCIMTestBase { func tests_session_open_close() { - var client: AVIMClient! = AVIMClient(clientId: String(#function[..<#function.index(of: "(")!])) + var client: AVIMClient! = AVIMClient(clientId: String(#function[..<#function.firstIndex(of: "(")!])) let delegate: AVIMClientDelegateWrapper = AVIMClientDelegateWrapper() client.delegate = delegate @@ -43,13 +43,13 @@ class AVIMClientTestCase: LCIMTestBase { func tests_session_conflict() { - let clientId: String = String(#function[..<#function.index(of: "(")!]) + let clientId: String = String(#function[..<#function.firstIndex(of: "(")!]) let tag: String = "tag" let delegate1 = AVIMClientDelegateWrapper() var client1: AVIMClient! = { let client: AVIMClient = AVIMClient(clientId: clientId, tag: tag, installation: AVInstallation()) - client.pushManager.installation.deviceToken = UUID().uuidString + client.pushManager.installation.setDeviceTokenHexString(UUID().uuidString, teamId: "LeanCloud") client.delegate = delegate1 return client }() @@ -68,7 +68,7 @@ class AVIMClientTestCase: LCIMTestBase { var client2: AVIMClient! = { let client: AVIMClient = AVIMClient(clientId: clientId, tag: tag, installation: AVInstallation()) - client.pushManager.installation.deviceToken = UUID().uuidString + client.pushManager.installation.setDeviceTokenHexString(UUID().uuidString, teamId: "LeanCloud") return client }() @@ -106,7 +106,7 @@ class AVIMClientTestCase: LCIMTestBase { func tests_session_refresh() { - guard let client: AVIMClient = LCIMTestBase.newOpenedClient(clientId: String(#function[..<#function.index(of: "(")!])) else { + guard let client: AVIMClient = LCIMTestBase.newOpenedClient(clientId: String(#function[..<#function.firstIndex(of: "(")!])) else { XCTFail() return } @@ -136,8 +136,8 @@ class AVIMClientTestCase: LCIMTestBase { func tests_session_query() { - let clientId1: String = String(#function[..<#function.index(of: "(")!]) + "1" - let clientId2: String = String(#function[..<#function.index(of: "(")!]) + "2" + let clientId1: String = String(#function[..<#function.firstIndex(of: "(")!]) + "1" + let clientId2: String = String(#function[..<#function.firstIndex(of: "(")!]) + "2" guard let client1: AVIMClient = LCIMTestBase.newOpenedClient(clientId: clientId1) else { XCTFail() @@ -177,9 +177,9 @@ class AVIMClientTestCase: LCIMTestBase { func tests_conv_start() { - let clientId1: String = String(#function[..<#function.index(of: "(")!]) + "1" - let clientId2: String = String(#function[..<#function.index(of: "(")!]) + "2" - let clientId3: String = String(#function[..<#function.index(of: "(")!]) + "3" + let clientId1: String = String(#function[..<#function.firstIndex(of: "(")!]) + "1" + let clientId2: String = String(#function[..<#function.firstIndex(of: "(")!]) + "2" + let clientId3: String = String(#function[..<#function.firstIndex(of: "(")!]) + "3" guard let client: AVIMClient = LCIMTestBase.newOpenedClient(clientId: clientId1) else { XCTFail() @@ -227,7 +227,7 @@ class AVIMClientTestCase: LCIMTestBase { func tests_conv_batch_query() { - let clientId: String = String(#function[..<#function.index(of: "(")!]) + let clientId: String = String(#function[..<#function.firstIndex(of: "(")!]) guard let client: AVIMClient = LCIMTestBase.newOpenedClient(clientId: clientId) else { XCTFail() return @@ -303,8 +303,8 @@ class AVIMClientTestCase: LCIMTestBase { func tests_push() { let installation: AVInstallation = AVInstallation() - installation.deviceToken = UUID().uuidString - guard let client: AVIMClient = LCIMTestBase.newOpenedClient(clientId: String(#function[..<#function.index(of: "(")!]), installation: installation) else { + installation.setDeviceTokenHexString(UUID().uuidString, teamId: "LeanCloud") + guard let client: AVIMClient = LCIMTestBase.newOpenedClient(clientId: String(#function[..<#function.firstIndex(of: "(")!]), installation: installation) else { XCTFail() return } @@ -343,7 +343,7 @@ class AVIMClientTestCase: LCIMTestBase { func test_goaway() { AVOSCloudIM.defaultOptions().rtmServer = "wss://rtm51.leancloud.cn"; - guard let client: AVIMClient = LCIMTestBase.newOpenedClient(clientId: String(#function[..<#function.index(of: "(")!])) else { + guard let client: AVIMClient = LCIMTestBase.newOpenedClient(clientId: String(#function[..<#function.firstIndex(of: "(")!])) else { XCTFail() return } diff --git a/AVOS/AVOSCloudIMTests/Swift/AVIMConversationTestCase.swift b/AVOS/AVOSCloudIMTests/Swift/AVIMConversationTestCase.swift index 6f73ee91e..4551a23d8 100644 --- a/AVOS/AVOSCloudIMTests/Swift/AVIMConversationTestCase.swift +++ b/AVOS/AVOSCloudIMTests/Swift/AVIMConversationTestCase.swift @@ -14,8 +14,8 @@ class AVIMConversationTestCase: LCIMTestBase { func tests_conv_read_maxread() { - let clientId1: String = String(#function[..<#function.index(of: "(")!]) + "1" - let clientId2: String = String(#function[..<#function.index(of: "(")!]) + "2" + let clientId1: String = String(#function[..<#function.firstIndex(of: "(")!]) + "1" + let clientId2: String = String(#function[..<#function.firstIndex(of: "(")!]) + "2" let delegate1: AVIMClientDelegateWrapper = AVIMClientDelegateWrapper() guard let client1: AVIMClient = LCIMTestBase.newOpenedClient(clientId: clientId1, delegate: delegate1) else { @@ -91,9 +91,9 @@ class AVIMConversationTestCase: LCIMTestBase { func tests_conv_add_remove() { let clientIds: [String] = [ - String(#function[..<#function.index(of: "(")!]) + "1", - String(#function[..<#function.index(of: "(")!]) + "2", - String(#function[..<#function.index(of: "(")!]) + "3" + String(#function[..<#function.firstIndex(of: "(")!]) + "1", + String(#function[..<#function.firstIndex(of: "(")!]) + "2", + String(#function[..<#function.firstIndex(of: "(")!]) + "3" ] let delegate1: AVIMClientDelegateWrapper = AVIMClientDelegateWrapper() @@ -257,8 +257,8 @@ class AVIMConversationTestCase: LCIMTestBase { func tests_conv_count() { - let clientId1: String = String(#function[..<#function.index(of: "(")!]) + "1" - let clientId2: String = String(#function[..<#function.index(of: "(")!]) + "2" + let clientId1: String = String(#function[..<#function.firstIndex(of: "(")!]) + "1" + let clientId2: String = String(#function[..<#function.firstIndex(of: "(")!]) + "2" guard let client1: AVIMClient = LCIMTestBase.newOpenedClient(clientId: clientId1) else { XCTFail() @@ -316,8 +316,8 @@ class AVIMConversationTestCase: LCIMTestBase { func tests_conv_update() { - let clientId1: String = String(#function[..<#function.index(of: "(")!]) + "1" - let clientId2: String = String(#function[..<#function.index(of: "(")!]) + "2" + let clientId1: String = String(#function[..<#function.firstIndex(of: "(")!]) + "1" + let clientId2: String = String(#function[..<#function.firstIndex(of: "(")!]) + "2" let delegate1: AVIMClientDelegateWrapper = AVIMClientDelegateWrapper() guard let client1: AVIMClient = LCIMTestBase.newOpenedClient(clientId: clientId1, delegate: delegate1) else { @@ -376,8 +376,8 @@ class AVIMConversationTestCase: LCIMTestBase { func tests_conv_mute_unmute() { - let clientId1: String = String(#function[..<#function.index(of: "(")!]) + "1" - let clientId2: String = String(#function[..<#function.index(of: "(")!]) + "2" + let clientId1: String = String(#function[..<#function.firstIndex(of: "(")!]) + "1" + let clientId2: String = String(#function[..<#function.firstIndex(of: "(")!]) + "2" guard let client: AVIMClient = LCIMTestBase.newOpenedClient(clientId: clientId1) else { XCTFail() @@ -414,8 +414,8 @@ class AVIMConversationTestCase: LCIMTestBase { func tests_conv_query() { - let clientId1: String = "\(#function[..<#function.index(of: "(")!])" + "1" - let clientId2: String = "\(#function[..<#function.index(of: "(")!])" + "2" + let clientId1: String = "\(#function[..<#function.firstIndex(of: "(")!])" + "1" + let clientId2: String = "\(#function[..<#function.firstIndex(of: "(")!])" + "2" guard let client: AVIMClient = LCIMTestBase.newOpenedClient(clientId: clientId1) else { XCTFail() @@ -467,9 +467,9 @@ class AVIMConversationTestCase: LCIMTestBase { func tests_conv_memberinfo_get_update() { - let clientId1: String = String(#function[..<#function.index(of: "(")!]) + "1" - let clientId2: String = String(#function[..<#function.index(of: "(")!]) + "2" - let clientId3: String = String(#function[..<#function.index(of: "(")!]) + "3" + let clientId1: String = String(#function[..<#function.firstIndex(of: "(")!]) + "1" + let clientId2: String = String(#function[..<#function.firstIndex(of: "(")!]) + "2" + let clientId3: String = String(#function[..<#function.firstIndex(of: "(")!]) + "3" let delegate1: AVIMClientDelegateWrapper = AVIMClientDelegateWrapper() guard let client1: AVIMClient = LCIMTestBase.newOpenedClient(clientId: clientId1, delegate: delegate1) else { @@ -544,10 +544,10 @@ class AVIMConversationTestCase: LCIMTestBase { func tests_blacklist_block_query_unblock() { - let clientId1: String = String(#function[..<#function.index(of: "(")!]) + "1" - let clientId2: String = String(#function[..<#function.index(of: "(")!]) + "2" - let clientId3: String = String(#function[..<#function.index(of: "(")!]) + "3" - let clientId4: String = String(#function[..<#function.index(of: "(")!]) + "4" + let clientId1: String = String(#function[..<#function.firstIndex(of: "(")!]) + "1" + let clientId2: String = String(#function[..<#function.firstIndex(of: "(")!]) + "2" + let clientId3: String = String(#function[..<#function.firstIndex(of: "(")!]) + "3" + let clientId4: String = String(#function[..<#function.firstIndex(of: "(")!]) + "4" let delegate1: AVIMClientDelegateWrapper = AVIMClientDelegateWrapper() guard let client1: AVIMClient = LCIMTestBase.newOpenedClient(clientId: clientId1, delegate: delegate1) else { @@ -650,10 +650,10 @@ class AVIMConversationTestCase: LCIMTestBase { func tests_conv_shutup_add_query_remove() { - let clientId1: String = String(#function[..<#function.index(of: "(")!]) + "1" - let clientId2: String = String(#function[..<#function.index(of: "(")!]) + "2" - let clientId3: String = String(#function[..<#function.index(of: "(")!]) + "3" - let clientId4: String = String(#function[..<#function.index(of: "(")!]) + "4" + let clientId1: String = String(#function[..<#function.firstIndex(of: "(")!]) + "1" + let clientId2: String = String(#function[..<#function.firstIndex(of: "(")!]) + "2" + let clientId3: String = String(#function[..<#function.firstIndex(of: "(")!]) + "3" + let clientId4: String = String(#function[..<#function.firstIndex(of: "(")!]) + "4" let delegate1: AVIMClientDelegateWrapper = AVIMClientDelegateWrapper() guard let client1: AVIMClient = LCIMTestBase.newOpenedClient(clientId: clientId1, delegate: delegate1) else { diff --git a/AVOS/AVOSCloudIMTests/Swift/AVIMMessageTestCase.swift b/AVOS/AVOSCloudIMTests/Swift/AVIMMessageTestCase.swift index 54baba1b5..fe8e0ed25 100644 --- a/AVOS/AVOSCloudIMTests/Swift/AVIMMessageTestCase.swift +++ b/AVOS/AVOSCloudIMTests/Swift/AVIMMessageTestCase.swift @@ -17,8 +17,8 @@ class AVIMMessageTestCase: LCIMTestBase { if self.isServerTesting { return } let clientIds: [String] = [ - "\(#function[..<#function.index(of: "(")!])_1", - "\(#function[..<#function.index(of: "(")!])_2" + "\(#function[..<#function.firstIndex(of: "(")!])_1", + "\(#function[..<#function.firstIndex(of: "(")!])_2" ] let delegate_1: AVIMClientDelegateWrapper = AVIMClientDelegateWrapper() @@ -110,8 +110,8 @@ class AVIMMessageTestCase: LCIMTestBase { if self.isServerTesting { return } let clientIds: [String] = [ - "\(#function[..<#function.index(of: "(")!])_1", - "\(#function[..<#function.index(of: "(")!])_2" + "\(#function[..<#function.firstIndex(of: "(")!])_1", + "\(#function[..<#function.firstIndex(of: "(")!])_2" ] let delegate_1: AVIMClientDelegateWrapper = AVIMClientDelegateWrapper() @@ -203,8 +203,8 @@ class AVIMMessageTestCase: LCIMTestBase { if self.isServerTesting { return } let clientIds: [String] = [ - "\(#function[..<#function.index(of: "(")!])_1", - "\(#function[..<#function.index(of: "(")!])_2" + "\(#function[..<#function.firstIndex(of: "(")!])_1", + "\(#function[..<#function.firstIndex(of: "(")!])_2" ] let delegate_1: AVIMClientDelegateWrapper = AVIMClientDelegateWrapper() @@ -302,8 +302,8 @@ class AVIMMessageTestCase: LCIMTestBase { if self.isServerTesting { return } let clientIds: [String] = [ - "\(#function[..<#function.index(of: "(")!])_1", - "\(#function[..<#function.index(of: "(")!])_2" + "\(#function[..<#function.firstIndex(of: "(")!])_1", + "\(#function[..<#function.firstIndex(of: "(")!])_2" ] let delegate_1: AVIMClientDelegateWrapper = AVIMClientDelegateWrapper() @@ -429,8 +429,8 @@ class AVIMMessageTestCase: LCIMTestBase { if self.isServerTesting { return } let clientIds: [String] = [ - "\(#function[..<#function.index(of: "(")!])_1", - "\(#function[..<#function.index(of: "(")!])_2" + "\(#function[..<#function.firstIndex(of: "(")!])_1", + "\(#function[..<#function.firstIndex(of: "(")!])_2" ] let delegate_1: AVIMClientDelegateWrapper = AVIMClientDelegateWrapper() @@ -554,8 +554,8 @@ class AVIMMessageTestCase: LCIMTestBase { if self.isServerTesting { return } let clientIds: [String] = [ - "\(#function[..<#function.index(of: "(")!])_1", - "\(#function[..<#function.index(of: "(")!])_2" + "\(#function[..<#function.firstIndex(of: "(")!])_1", + "\(#function[..<#function.firstIndex(of: "(")!])_2" ] let delegate_1: AVIMClientDelegateWrapper = AVIMClientDelegateWrapper() @@ -679,8 +679,8 @@ class AVIMMessageTestCase: LCIMTestBase { if self.isServerTesting { return } let clientIds: [String] = [ - "\(#function[..<#function.index(of: "(")!])_1", - "\(#function[..<#function.index(of: "(")!])_2" + "\(#function[..<#function.firstIndex(of: "(")!])_1", + "\(#function[..<#function.firstIndex(of: "(")!])_2" ] let delegate_1: AVIMClientDelegateWrapper = AVIMClientDelegateWrapper() @@ -800,8 +800,8 @@ class AVIMMessageTestCase: LCIMTestBase { AVIMCustomTypedMessage.registerSubclass() let clientIds: [String] = [ - "\(#function[..<#function.index(of: "(")!])_1", - "\(#function[..<#function.index(of: "(")!])_2" + "\(#function[..<#function.firstIndex(of: "(")!])_1", + "\(#function[..<#function.firstIndex(of: "(")!])_2" ] let delegate_1: AVIMClientDelegateWrapper = AVIMClientDelegateWrapper() @@ -894,8 +894,8 @@ class AVIMMessageTestCase: LCIMTestBase { if self.isServerTesting { return } let clientIds: [String] = [ - "\(#function[..<#function.index(of: "(")!])_1", - "\(#function[..<#function.index(of: "(")!])_2" + "\(#function[..<#function.firstIndex(of: "(")!])_1", + "\(#function[..<#function.firstIndex(of: "(")!])_2" ] let delegate_1: AVIMClientDelegateWrapper = AVIMClientDelegateWrapper() @@ -1007,8 +1007,8 @@ class AVIMMessageTestCase: LCIMTestBase { if self.isServerTesting { return } let clientIds: [String] = [ - "\(#function[..<#function.index(of: "(")!])_1", - "\(#function[..<#function.index(of: "(")!])_2" + "\(#function[..<#function.firstIndex(of: "(")!])_1", + "\(#function[..<#function.firstIndex(of: "(")!])_2" ] let delegate_1: AVIMClientDelegateWrapper = AVIMClientDelegateWrapper() @@ -1132,8 +1132,8 @@ class AVIMMessageTestCase: LCIMTestBase { if self.isServerTesting { return } let clientIds: [String] = [ - "\(#function[..<#function.index(of: "(")!])_1", - "\(#function[..<#function.index(of: "(")!])_2" + "\(#function[..<#function.firstIndex(of: "(")!])_1", + "\(#function[..<#function.firstIndex(of: "(")!])_2" ] let delegate_1: AVIMClientDelegateWrapper = AVIMClientDelegateWrapper() @@ -1227,8 +1227,8 @@ class AVIMMessageTestCase: LCIMTestBase { if self.isServerTesting { return } let clientIds: [String] = [ - "\(#function[..<#function.index(of: "(")!])_1", - "\(#function[..<#function.index(of: "(")!])_2" + "\(#function[..<#function.firstIndex(of: "(")!])_1", + "\(#function[..<#function.firstIndex(of: "(")!])_2" ] let delegate_1: AVIMClientDelegateWrapper = AVIMClientDelegateWrapper() @@ -1325,11 +1325,11 @@ class AVIMMessageTestCase: LCIMTestBase { if self.isServerTesting { return } - let clientId: String = "\(#function[..<#function.index(of: "(")!])" + let clientId: String = "\(#function[..<#function.firstIndex(of: "(")!])" let delegate_1: AVIMClientDelegateWrapper = AVIMClientDelegateWrapper() let installation_1: AVInstallation = AVInstallation() - installation_1.deviceToken = UUID().uuidString + installation_1.setDeviceTokenHexString(UUID().uuidString, teamId: "LeanCloud") guard let client_1: AVIMClient = LCIMTestBase.newOpenedClient(clientId: clientId, delegate: delegate_1, installation: installation_1) else { XCTFail() return @@ -1337,7 +1337,7 @@ class AVIMMessageTestCase: LCIMTestBase { let delegate_2: AVIMClientDelegateWrapper = AVIMClientDelegateWrapper() let installation_2: AVInstallation = AVInstallation() - installation_2.deviceToken = UUID().uuidString + installation_2.setDeviceTokenHexString(UUID().uuidString, teamId: "LeanCloud") guard let _: AVIMClient = LCIMTestBase.newOpenedClient(clientId: clientId, delegate: delegate_2, installation: installation_2) else { XCTFail() return @@ -1422,8 +1422,8 @@ class AVIMMessageTestCase: LCIMTestBase { if self.isServerTesting { return } let clientIds: [String] = [ - "\(#function[..<#function.index(of: "(")!])_1", - "\(#function[..<#function.index(of: "(")!])_2", + "\(#function[..<#function.firstIndex(of: "(")!])_1", + "\(#function[..<#function.firstIndex(of: "(")!])_2", ] let delegate_1: AVIMClientDelegateWrapper = AVIMClientDelegateWrapper() @@ -1487,7 +1487,7 @@ class AVIMMessageTestCase: LCIMTestBase { XCTAssertTrue(commonMessage.sendTimestamp > 0) XCTAssertNotNil(commonMessage.clientId) if succeeded { - XCTAssertTrue(RunLoop.current.run(mode: .defaultRunLoopMode, before: Date(timeIntervalSinceNow: 1.0))) + XCTAssertTrue(RunLoop.current.run(mode: RunLoop.Mode.default, before: Date(timeIntervalSinceNow: 1.0))) normalConv.update(commonMessage, toNewMessage: newCommonMessage, callback: { (succeeded: Bool, error: Error?) in semaphore.decrement() XCTAssertTrue(Thread.isMainThread) @@ -1512,8 +1512,8 @@ class AVIMMessageTestCase: LCIMTestBase { if self.isServerTesting { return } let clientIds: [String] = [ - "\(#function[..<#function.index(of: "(")!])_1", - "\(#function[..<#function.index(of: "(")!])_2", + "\(#function[..<#function.firstIndex(of: "(")!])_1", + "\(#function[..<#function.firstIndex(of: "(")!])_2", ] let delegate_1: AVIMClientDelegateWrapper = AVIMClientDelegateWrapper() @@ -1573,7 +1573,7 @@ class AVIMMessageTestCase: LCIMTestBase { XCTAssertTrue(commonMessage.sendTimestamp > 0) XCTAssertNotNil(commonMessage.clientId) if succeeded { - XCTAssertTrue(RunLoop.current.run(mode: .defaultRunLoopMode, before: Date(timeIntervalSinceNow: 1.0))) + XCTAssertTrue(RunLoop.current.run(mode: RunLoop.Mode.default, before: Date(timeIntervalSinceNow: 1.0))) normalConv.recall(commonMessage, callback: { (succeeded: Bool, error: Error?, recalledMessage: AVIMRecalledMessage?) in semaphore.decrement() XCTAssertTrue(Thread.isMainThread) @@ -1600,8 +1600,8 @@ class AVIMMessageTestCase: LCIMTestBase { if self.isServerTesting { return } - let clientId1: String = String(#function[..<#function.index(of: "(")!]) + "1" - let clientId2: String = String(#function[..<#function.index(of: "(")!]) + "2" + let clientId1: String = String(#function[..<#function.firstIndex(of: "(")!]) + "1" + let clientId2: String = String(#function[..<#function.firstIndex(of: "(")!]) + "2" guard let client1: AVIMClient = LCIMTestBase.newOpenedClient(clientId: clientId1) else { XCTFail() diff --git a/AVOS/AVOSCloudIMTests/Swift/LCIMTestBase.swift b/AVOS/AVOSCloudIMTests/Swift/LCIMTestBase.swift index 6525b7265..b13650a17 100644 --- a/AVOS/AVOSCloudIMTests/Swift/LCIMTestBase.swift +++ b/AVOS/AVOSCloudIMTests/Swift/LCIMTestBase.swift @@ -12,6 +12,8 @@ import XCTest class LCIMTestBase: LCTestBase { override class func setUp() { + LCRouter.sharedInstance().cleanCache(withKey: .app, error: nil) + LCRouter.sharedInstance().cleanCache(withKey: .RTM, error: nil) super.setUp() /// custom RTM server URL if let RTMServerURL: String = LCTestEnvironment.sharedInstance().url_RTMServer { diff --git a/AVOS/AVOSCloudTests/Swift/AVFileTestCase.swift b/AVOS/AVOSCloudTests/Swift/AVFileTestCase.swift index 13d86990c..a6575d0c7 100644 --- a/AVOS/AVOSCloudTests/Swift/AVFileTestCase.swift +++ b/AVOS/AVOSCloudTests/Swift/AVFileTestCase.swift @@ -221,7 +221,11 @@ class AVFile_TestCase: LCTestBase { let uploadDataTuple: (data: Data, name: String) = self.bigDataTuple let documentsDirectory: URL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0] - let filePath: URL = documentsDirectory.appendingPathComponent(uploadDataTuple.name) + try! FileManager.default.createDirectory( + at: documentsDirectory, + withIntermediateDirectories: true, + attributes: nil) + let filePath: URL = documentsDirectory.appendingPathComponent(uploadDataTuple.name, isDirectory: false) do { try uploadDataTuple.data.write(to: filePath, options: [.atomic]) } catch let err { @@ -794,29 +798,6 @@ class AVFile_TestCase: LCTestBase { return file.objectId() != nil ? file : nil } - RunLoopSemaphore.wait(async: { (semaphore: RunLoopSemaphore) in - - guard let file: AVFile = uploadedFile() else { - XCTFail() - return - } - - semaphore.increment() - - file.delete(completionHandler: { (succeeded: Bool, error: Error?) in - - semaphore.decrement() - XCTAssertTrue(Thread.isMainThread) - - XCTAssertTrue(succeeded) - XCTAssertNil(error) - }) - - }, failure: { - - XCTFail("timeout") - }) - RunLoopSemaphore.wait(async: { (semaphore: RunLoopSemaphore) in var array: [AVFile] = [] diff --git a/AVOS/AVOSCloudTests/Swift/AVInstallationTestCase.swift b/AVOS/AVOSCloudTests/Swift/AVInstallationTestCase.swift new file mode 100644 index 000000000..a01eaaac3 --- /dev/null +++ b/AVOS/AVOSCloudTests/Swift/AVInstallationTestCase.swift @@ -0,0 +1,112 @@ +// +// AVInstallationTestCase.swift +// AVOSCloud-iOSTests +// +// Created by zapcannon87 on 2019/9/27. +// Copyright © 2019 LeanCloud Inc. All rights reserved. +// + +import XCTest + +class AVInstallation_TestCase: LCTestBase { + + let teamId: String = "LeanCloud" + + func testDefault() { + AVInstallation.default().setDeviceTokenHexString( + UUID().uuidString, + teamId: teamId) + XCTAssertTrue(AVInstallation.default().save()) + } + + func testSave() { + let installation = AVInstallation() + installation.setDeviceTokenHexString( + "", + teamId: teamId) + XCTAssertFalse(installation.save()) + + installation.setDeviceTokenFrom( + Data(), + teamId: teamId) + XCTAssertFalse(installation.save()) + + installation.setDeviceTokenHexString( + UUID().uuidString, + teamId: "") + XCTAssertFalse(installation.save()) + + installation.setDeviceTokenHexString( + UUID().uuidString, + teamId: teamId) + XCTAssertTrue(installation.save()) + + installation.setDeviceTokenFrom( + UUID().uuidString.data(using: .utf8)!, + teamId: teamId) + XCTAssertTrue(installation.save()) + } + + func testSaveWithBadge() { + let installation = AVInstallation() + installation.setDeviceTokenHexString( + UUID().uuidString, + teamId: teamId) + XCTAssertTrue(installation.save()) + XCTAssertEqual(installation.badge, 0) + + installation.badge = 1 + XCTAssertTrue(installation.save()) + XCTAssertEqual(installation.badge, 1) + + installation.badge = 0 + XCTAssertTrue(installation.save()) + XCTAssertEqual(installation.badge, 0) + } + + func testSaveWithChannels() { + let installation = AVInstallation() + installation.setDeviceTokenHexString( + UUID().uuidString, + teamId: teamId) + XCTAssertTrue(installation.save()) + XCTAssertEqual(installation.channels?.count ?? 0, 0) + + let channelID = UUID().uuidString + installation.addUniqueObject( + channelID, + forKey: "channels") + XCTAssertTrue(installation.save()) + XCTAssertEqual(installation.channels?.count, 1) + XCTAssertEqual(installation.channels?.first as? String, channelID) + + installation.remove(channelID, forKey: "channels") + XCTAssertTrue(installation.save()) + XCTAssertEqual(installation.channels?.count, 0) + + installation.channels = [UUID().uuidString, UUID().uuidString] + XCTAssertTrue(installation.save()) + XCTAssertEqual(installation.channels?.count, 2) + } + + func testSaveWithDeviceProfile() { + let installation = AVInstallation() + installation.setDeviceTokenHexString( + UUID().uuidString, + teamId: teamId) + installation.deviceProfile = UUID().uuidString.replacingOccurrences(of: "-", with: "") + XCTAssertTrue(installation.save()) + XCTAssertNotNil(installation.deviceProfile) + } + + func testCustomField() { + let installation = AVInstallation() + installation.setDeviceTokenHexString( + UUID().uuidString, + teamId: teamId) + installation["customField"] = UUID().uuidString + XCTAssertTrue(installation.save()) + XCTAssertNotNil(installation["customField"]) + } + +} diff --git a/AVOS/AVOSCloudTests/Swift/AVObjectTestCase.swift b/AVOS/AVOSCloudTests/Swift/AVObjectTestCase.swift index 602b22ea8..67e1ad4d5 100644 --- a/AVOS/AVOSCloudTests/Swift/AVObjectTestCase.swift +++ b/AVOS/AVOSCloudTests/Swift/AVObjectTestCase.swift @@ -95,9 +95,4 @@ class AVObject_TestCase: LCTestBase { }) } - func testInstallation() { - AVInstallation.default().deviceToken = UUID().uuidString - XCTAssertTrue(AVInstallation.default().save()) - } - } diff --git a/AVOS/AVOSCloudTests/Swift/AVUserTestCase.swift b/AVOS/AVOSCloudTests/Swift/AVUserTestCase.swift index e4bf9aa6b..16cfaaadc 100644 --- a/AVOS/AVOSCloudTests/Swift/AVUserTestCase.swift +++ b/AVOS/AVOSCloudTests/Swift/AVUserTestCase.swift @@ -72,7 +72,7 @@ class AVUser_TestCase: LCTestBase { let authData: [String : Any] = [ "access_token" : "access_token_test" + testTag, - "openid" : "\(#function[..<#function.index(of: "(")!])" + testTag + "openid" : "\(#function[..<#function.firstIndex(of: "(")!])" + testTag ] let platformId: String = LeanCloudSocialPlatform.weiXin.rawValue + testTag @@ -111,7 +111,7 @@ class AVUser_TestCase: LCTestBase { let authData: [String : Any] = [ "access_token" : "access_token_test" + testTag, - "openid" : "\(#function[..<#function.index(of: "(")!])" + testTag + "openid" : "\(#function[..<#function.firstIndex(of: "(")!])" + testTag ] let options: AVUserAuthDataLoginOption = AVUserAuthDataLoginOption() @@ -175,7 +175,7 @@ class AVUser_TestCase: LCTestBase { if self.isServerTesting { return } - let unionId: String = "\(#function[..<#function.index(of: "(")!])" + let unionId: String = "\(#function[..<#function.firstIndex(of: "(")!])" var user_1: AVUser! = AVUser() RunLoopSemaphore.wait(async: { (semaphore: RunLoopSemaphore) in @@ -185,7 +185,7 @@ class AVUser_TestCase: LCTestBase { let authData: [String : Any] = [ "access_token" : "access_token_test" + testTag, - "openid" : "\(#function[..<#function.index(of: "(")!])" + testTag + "openid" : "\(#function[..<#function.firstIndex(of: "(")!])" + testTag ] let options: AVUserAuthDataLoginOption = AVUserAuthDataLoginOption() @@ -228,7 +228,7 @@ class AVUser_TestCase: LCTestBase { let authData: [String : Any] = [ "access_token" : "access_token_test" + testTag, - "openid" : "\(#function[..<#function.index(of: "(")!])" + testTag + "openid" : "\(#function[..<#function.firstIndex(of: "(")!])" + testTag ] let options: AVUserAuthDataLoginOption = AVUserAuthDataLoginOption() @@ -293,7 +293,7 @@ class AVUser_TestCase: LCTestBase { var user: AVUser! = AVUser() let authData: [String : Any] = [ "access_token" : "access_token_test", - "openid" : "\(#function[..<#function.index(of: "(")!])" + "openid" : "\(#function[..<#function.firstIndex(of: "(")!])" ] let platformId: String = LeanCloudSocialPlatform.weiXin.rawValue @@ -418,7 +418,7 @@ class AVUser_TestCase: LCTestBase { RunLoopSemaphore.wait(async: { (semaphore: RunLoopSemaphore) in - let username: String = "\(#function[..<#function.index(of: "(")!])" + let username: String = "\(#function[..<#function.firstIndex(of: "(")!])" let password: String = "123" let user: AVUser = AVUser() user.username = username diff --git a/AVOS/Resources/AVOSCloud-iOS.Info.plist b/AVOS/Resources/AVOSCloud-iOS.Info.plist index d56a44bab..543e5f92d 100644 --- a/AVOS/Resources/AVOSCloud-iOS.Info.plist +++ b/AVOS/Resources/AVOSCloud-iOS.Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - com.avoscloud.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/AVOS/TestsBase/LCTestBase.swift b/AVOS/TestsBase/LCTestBase.swift index 4935e7b22..8d8ab9b73 100644 --- a/AVOS/TestsBase/LCTestBase.swift +++ b/AVOS/TestsBase/LCTestBase.swift @@ -13,6 +13,8 @@ class LCTestBase: XCTestCase { override class func setUp() { super.setUp() + AVOSCloud.setAllLogsEnabled(true) + let env: LCTestEnvironment = LCTestEnvironment.sharedInstance() /// custom url for API @@ -33,22 +35,18 @@ class LCTestBase: XCTestCase { AVOSCloud.setApplicationId(appId, clientKey: appKey) } else { let testApp: TestApp = .ChinaNorth - AVOSCloud.setApplicationId(testApp.appInfo.id, clientKey: testApp.appInfo.key) + switch testApp { + case .ChinaNorth, .ChinaEast: + AVOSCloud.setApplicationId( + testApp.appInfo.id, + clientKey: testApp.appInfo.key, + serverURLString: testApp.appInfo.serverURL) + case .US: + AVOSCloud.setApplicationId( + testApp.appInfo.id, + clientKey: testApp.appInfo.key) + } } - - AVOSCloud.setAllLogsEnabled(true) - } - - override class func tearDown() { - super.tearDown() - } - - override func setUp() { - super.setUp() - } - - override func tearDown() { - super.tearDown() } } @@ -63,11 +61,20 @@ extension LCTestBase { case ChinaNorth case ChinaEast case US - var appInfo: (id: String, key: String) { + var appInfo: (id: String, key: String, serverURL: String) { switch self { - case .ChinaNorth: return (id: "S5vDI3IeCk1NLLiM1aFg3262-gzGzoHsz", key: "7g5pPsI55piz2PRLPWK5MPz0") - case .ChinaEast: return (id: "uwWkfssEBRtrxVpQWEnFtqfr-9Nh9j0Va", key: "9OaLpoW21lIQtRYzJya4WHUR") - case .US: return (id: "eX7urCufwLd6X5mHxt7V12nL-MdYXbMMI", key: "PrmzHPnRXjXezS54KryuHMG6") + case .ChinaNorth: + return (id: "S5vDI3IeCk1NLLiM1aFg3262-gzGzoHsz", + key: "7g5pPsI55piz2PRLPWK5MPz0", + serverURL: "https://s5vdi3ie.lc-cn-n1-shared.com") + case .ChinaEast: + return (id: "skhiVsqIk7NLVdtHaUiWn0No-9Nh9j0Va", + key: "T3TEAIcL8Ls5XGPsGz41B1bz", + serverURL: "https://skhivsqi.lc-cn-e1-shared.com") + case .US: + return (id: "eX7urCufwLd6X5mHxt7V12nL-MdYXbMMI", + key: "PrmzHPnRXjXezS54KryuHMG6", + serverURL: "") } } } @@ -100,14 +107,14 @@ class RunLoopSemaphore { static func wait(timeout: TimeInterval = 30, async: (RunLoopSemaphore) -> Void, failure: (() -> Void)? = nil) { XCTAssertTrue(timeout >= 0) defer { - XCTAssertTrue(RunLoop.current.run(mode: .defaultRunLoopMode, before: Date(timeIntervalSinceNow: 1.0))) + XCTAssertTrue(RunLoop.current.run(mode: RunLoop.Mode.default, before: Date(timeIntervalSinceNow: 1.0))) } let semaphore: RunLoopSemaphore = RunLoopSemaphore() async(semaphore) let startTimestamp: TimeInterval = Date().timeIntervalSince1970 while semaphore.running() { let date: Date = Date(timeIntervalSinceNow: 1.0) - XCTAssertTrue(RunLoop.current.run(mode: .defaultRunLoopMode, before: date)) + XCTAssertTrue(RunLoop.current.run(mode: RunLoop.Mode.default, before: date)) if date.timeIntervalSince1970 - startTimestamp > timeout { failure?() return diff --git a/AVOSCloud.podspec b/AVOSCloud.podspec index 831e401b6..312b93022 100644 --- a/AVOSCloud.podspec +++ b/AVOSCloud.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'AVOSCloud' - s.version = '11.6.7' + s.version = '12.0.0-beta.1' s.homepage = 'https://leancloud.cn/' s.summary = 'LeanCloud Objective-C SDK' s.authors = 'LeanCloud' @@ -11,7 +11,7 @@ Pod::Spec.new do |s| s.platform = :ios, :osx, :tvos, :watchos - s.ios.deployment_target = '7.0' + s.ios.deployment_target = '8.0' s.osx.deployment_target = '10.9' s.tvos.deployment_target = '9.0' s.watchos.deployment_target = '2.0' diff --git a/AVOSCloudIM.podspec b/AVOSCloudIM.podspec index 0d64c6f7c..2bcbbca10 100644 --- a/AVOSCloudIM.podspec +++ b/AVOSCloudIM.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'AVOSCloudIM' - s.version = '11.6.7' + s.version = '12.0.0-beta.1' s.homepage = 'https://leancloud.cn/' s.summary = 'LeanCloud IM Objective-C SDK' s.authors = 'LeanCloud' @@ -11,7 +11,7 @@ Pod::Spec.new do |s| s.platform = :ios, :osx - s.ios.deployment_target = '7.0' + s.ios.deployment_target = '8.0' s.osx.deployment_target = '10.9' s.source = { @@ -99,9 +99,7 @@ Pod::Spec.new do |s| 'AVOS/AVOSCloudIM/Conversation/AVIMConversation_Internal.h', 'AVOS/AVOSCloudIM/MessageCache/CacheStore/LCIMMessageCacheStoreSQL.h', 'AVOS/AVOSCloudIM/Protobuf/google/protobuf/LCIMAny.pbobjc.h', - 'AVOS/AVOSCloudIM/Utilities/AVIMRuntimeHelper.h', 'AVOS/AVOSCloudIM/Protobuf/LCIMRuntimeTypes.h', - 'AVOS/AVOSCloudIM/Vendor/SDMacros/SDMacros.h', 'AVOS/AVOSCloudIM/Client/AVIMClientInternalConversationManager.h', 'AVOS/AVOSCloudIM/Protobuf/google/protobuf/LCIMDuration.pbobjc.h', 'AVOS/AVOSCloudIM/Commands/AVIMDirectCommand+DirectCommandAdditions.h', @@ -135,7 +133,6 @@ Pod::Spec.new do |s| 'AVOS/AVOSCloudIM/Protobuf/google/protobuf/LCIMAny.pbobjc.m', 'AVOS/AVOSCloudIM/Commands/AVIMDirectCommand+DirectCommandAdditions.m', 'AVOS/AVOSCloudIM/MessageCache/CacheStore/LCIMConversationQueryCacheStore.m', - 'AVOS/AVOSCloudIM/Utilities/AVIMRuntimeHelper.m', 'AVOS/AVOSCloudIM/Protobuf/google/protobuf/LCIMStruct.pbobjc.m', 'AVOS/AVOSCloudIM/Commands/AVIMConversationOutCommand.m', 'AVOS/AVOSCloudIM/Client/AVIMClient.m', diff --git a/AVOSCloudLiveQuery.podspec b/AVOSCloudLiveQuery.podspec index 7d2d907f4..75c1a0678 100644 --- a/AVOSCloudLiveQuery.podspec +++ b/AVOSCloudLiveQuery.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'AVOSCloudLiveQuery' - s.version = '11.6.7' + s.version = '12.0.0-beta.1' s.homepage = 'https://leancloud.cn/' s.summary = 'LeanCloud LiveQuery Objective-C SDK' s.authors = 'LeanCloud' @@ -11,7 +11,7 @@ Pod::Spec.new do |s| s.platform = :ios, :osx - s.ios.deployment_target = '7.0' + s.ios.deployment_target = '8.0' s.osx.deployment_target = '10.9' s.source = {