集成httpdns

This commit is contained in:
kai60
2022-01-17 11:40:56 +08:00
parent 7b7faab5ce
commit f63f7d216c
82 changed files with 2789 additions and 13 deletions
+41 -3
View File
@@ -2275,6 +2275,13 @@
C024B7AF2379668B00509424 /* NSMutableString+AvoidCrash.h in Headers */ = {isa = PBXBuildFile; fileRef = C024B79B2379668B00509424 /* NSMutableString+AvoidCrash.h */; };
C024B7B02379668B00509424 /* NSMutableAttributedString+AvoidCrash.h in Headers */ = {isa = PBXBuildFile; fileRef = C024B79C2379668B00509424 /* NSMutableAttributedString+AvoidCrash.h */; };
C024B7B12379668B00509424 /* NSMutableArray+AvoidCrash.h in Headers */ = {isa = PBXBuildFile; fileRef = C024B79D2379668B00509424 /* NSMutableArray+AvoidCrash.h */; };
C02D9E502794011100BBBF8D /* EMASRest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C02D9E492794011100BBBF8D /* EMASRest.framework */; };
C02D9E512794011100BBBF8D /* AlicloudSender.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C02D9E4A2794011100BBBF8D /* AlicloudSender.framework */; };
C02D9E522794011200BBBF8D /* UTDID.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C02D9E4B2794011100BBBF8D /* UTDID.framework */; };
C02D9E532794011200BBBF8D /* AlicloudBeacon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C02D9E4C2794011100BBBF8D /* AlicloudBeacon.framework */; };
C02D9E542794011200BBBF8D /* AlicloudUtils.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C02D9E4D2794011100BBBF8D /* AlicloudUtils.framework */; };
C02D9E552794011300BBBF8D /* UTMini.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C02D9E4E2794011100BBBF8D /* UTMini.framework */; };
C02D9E562794011300BBBF8D /* AlicloudHttpDNS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C02D9E4F2794011100BBBF8D /* AlicloudHttpDNS.framework */; };
C02ED596249E3B7300CAC37D /* InfoByImageViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = C02ED594249E3B7300CAC37D /* InfoByImageViewController.h */; };
C02ED597249E3B7300CAC37D /* InfoByImageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C02ED595249E3B7300CAC37D /* InfoByImageViewController.m */; };
C072196A253AE2290065CF17 /* IfishP2PPlayBackListViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C0721969253AE2290065CF17 /* IfishP2PPlayBackListViewController.xib */; };
@@ -5747,6 +5754,13 @@
C024B79B2379668B00509424 /* NSMutableString+AvoidCrash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableString+AvoidCrash.h"; sourceTree = "<group>"; };
C024B79C2379668B00509424 /* NSMutableAttributedString+AvoidCrash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableAttributedString+AvoidCrash.h"; sourceTree = "<group>"; };
C024B79D2379668B00509424 /* NSMutableArray+AvoidCrash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableArray+AvoidCrash.h"; sourceTree = "<group>"; };
C02D9E492794011100BBBF8D /* EMASRest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = EMASRest.framework; sourceTree = "<group>"; };
C02D9E4A2794011100BBBF8D /* AlicloudSender.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = AlicloudSender.framework; sourceTree = "<group>"; };
C02D9E4B2794011100BBBF8D /* UTDID.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = UTDID.framework; sourceTree = "<group>"; };
C02D9E4C2794011100BBBF8D /* AlicloudBeacon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = AlicloudBeacon.framework; sourceTree = "<group>"; };
C02D9E4D2794011100BBBF8D /* AlicloudUtils.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = AlicloudUtils.framework; sourceTree = "<group>"; };
C02D9E4E2794011100BBBF8D /* UTMini.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = UTMini.framework; sourceTree = "<group>"; };
C02D9E4F2794011100BBBF8D /* AlicloudHttpDNS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = AlicloudHttpDNS.framework; sourceTree = "<group>"; };
C02ED594249E3B7300CAC37D /* InfoByImageViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InfoByImageViewController.h; sourceTree = "<group>"; };
C02ED595249E3B7300CAC37D /* InfoByImageViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InfoByImageViewController.m; sourceTree = "<group>"; };
C0721969253AE2290065CF17 /* IfishP2PPlayBackListViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = IfishP2PPlayBackListViewController.xib; sourceTree = "<group>"; };
@@ -6139,6 +6153,7 @@
buildActionMask = 2147483647;
files = (
CB484CF122B87D250075F050 /* libresolv.tbd in Frameworks */,
88C6861C1EA61000004CDFD9 /* libsqlite3.0.tbd in Frameworks */,
18C54F202350541500DF4E7D /* AlibabaAuthSDK.framework in Frameworks */,
88C686401EA611AE004CDFD9 /* libsqlite3.tbd in Frameworks */,
3D4AFF5F21F34E1C0053BAA0 /* libstdc++.tbd in Frameworks */,
@@ -6151,6 +6166,7 @@
8857E43C1ECBE53A004A3D75 /* libc++.tbd in Frameworks */,
18C54F2A2350541500DF4E7D /* SGNoCaptcha.framework in Frameworks */,
88C686581EA61298004CDFD9 /* AudioToolbox.framework in Frameworks */,
C02D9E522794011200BBBF8D /* UTDID.framework in Frameworks */,
18C54F2C2350541500DF4E7D /* SGSecurityBody.framework in Frameworks */,
88C6865A1EA612A6004CDFD9 /* AssetsLibrary.framework in Frameworks */,
88C686601EA612DE004CDFD9 /* Accelerate.framework in Frameworks */,
@@ -6162,6 +6178,7 @@
18C54F232350541500DF4E7D /* SecurityGuardSDK.framework in Frameworks */,
3D1C50B0221A9EDF0096AE43 /* YMsgBox.a in Frameworks */,
88C686501EA61259004CDFD9 /* CoreLocation.framework in Frameworks */,
C02D9E532794011200BBBF8D /* AlicloudBeacon.framework in Frameworks */,
18C54F262350541500DF4E7D /* SGMain.framework in Frameworks */,
88C6864E1EA6124B004CDFD9 /* CoreVideo.framework in Frameworks */,
88C6864C1EA6123B004CDFD9 /* CoreTelephony.framework in Frameworks */,
@@ -6176,6 +6193,7 @@
C0F0400C23756F3C00B61D3B /* ExternalAccessory.framework in Frameworks */,
88C686441EA611DC004CDFD9 /* libc++abi.tbd in Frameworks */,
3D1C50B3221A9EDF0096AE43 /* YTheNaviBar.a in Frameworks */,
C02D9E502794011100BBBF8D /* EMASRest.framework in Frameworks */,
18C54F272350541500DF4E7D /* AlibcTradeCommon.framework in Frameworks */,
88C6863C1EA6116C004CDFD9 /* libxml2.tbd in Frameworks */,
88C6863A1EA61149004CDFD9 /* MapKit.framework in Frameworks */,
@@ -6194,16 +6212,18 @@
88C686241EA61081004CDFD9 /* MediaToolbox.framework in Frameworks */,
88C686221EA6106E004CDFD9 /* MediaPlayer.framework in Frameworks */,
88C686201EA61057004CDFD9 /* libbz2.1.0.tbd in Frameworks */,
C02D9E552794011300BBBF8D /* UTMini.framework in Frameworks */,
88C6861E1EA61041004CDFD9 /* libicucore.tbd in Frameworks */,
88C6861C1EA61000004CDFD9 /* libsqlite3.0.tbd in Frameworks */,
88C6861A1EA60FD6004CDFD9 /* VideoToolbox.framework in Frameworks */,
3D1C50B5221A9EDF0096AE43 /* YSlider.a in Frameworks */,
C02D9E512794011100BBBF8D /* AlicloudSender.framework in Frameworks */,
88C686181EA60EDA004CDFD9 /* MessageUI.framework in Frameworks */,
88C686161EA60EB3004CDFD9 /* CoreText.framework in Frameworks */,
18C54F212350541500DF4E7D /* AlibcTradeSDK.framework in Frameworks */,
88C686141EA60EA9004CDFD9 /* WebKit.framework in Frameworks */,
CB8B646C230FAD340032EB24 /* Bugly.framework in Frameworks */,
88C686011EA603A8004CDFD9 /* UShareUI.framework in Frameworks */,
C02D9E562794011300BBBF8D /* AlicloudHttpDNS.framework in Frameworks */,
88C685F91EA603A8004CDFD9 /* libSocialWeChat.a in Frameworks */,
CB48209B2335CB2300A50C92 /* GWP2P.framework in Frameworks */,
3DD7AB4B21E2F2FB0064856A /* libzbar.a in Frameworks */,
@@ -6215,6 +6235,7 @@
883E7BCE1EA5FA1A00ED5D89 /* SMS_SDK.framework in Frameworks */,
88C685F71EA603A8004CDFD9 /* libWeiboSDK.a in Frameworks */,
881671BE1EA5DE2B00BEBF23 /* UMComNetwork.framework in Frameworks */,
C02D9E542794011200BBBF8D /* AlicloudUtils.framework in Frameworks */,
88C685F41EA603A8004CDFD9 /* TencentOpenAPI.framework in Frameworks */,
88C685FC1EA603A8004CDFD9 /* UMSocialCore.framework in Frameworks */,
18C54F252350541500DF4E7D /* AlibcTradeBiz.framework in Frameworks */,
@@ -12067,6 +12088,7 @@
88F5EEE81D48D04100CC7CAF /* libs */ = {
isa = PBXGroup;
children = (
C02D9E482794011100BBBF8D /* HTTPDNS */,
C0EA883E23AF61D6003DC53B /* SDWebImage3.8.2 */,
C024B7892379668B00509424 /* AvoidCrash */,
CB484CE822B76DEC0075F050 /* GWP2PSDK */,
@@ -12286,6 +12308,20 @@
path = AvoidCrash;
sourceTree = "<group>";
};
C02D9E482794011100BBBF8D /* HTTPDNS */ = {
isa = PBXGroup;
children = (
C02D9E492794011100BBBF8D /* EMASRest.framework */,
C02D9E4A2794011100BBBF8D /* AlicloudSender.framework */,
C02D9E4B2794011100BBBF8D /* UTDID.framework */,
C02D9E4C2794011100BBBF8D /* AlicloudBeacon.framework */,
C02D9E4D2794011100BBBF8D /* AlicloudUtils.framework */,
C02D9E4E2794011100BBBF8D /* UTMini.framework */,
C02D9E4F2794011100BBBF8D /* AlicloudHttpDNS.framework */,
);
path = HTTPDNS;
sourceTree = "<group>";
};
C0837A54244FF5500034FEC5 /* EGOCache */ = {
isa = PBXGroup;
children = (
@@ -15860,6 +15896,7 @@
"$(PROJECT_DIR)/Ifish/Bugly",
"$(PROJECT_DIR)/Ifish/ALiBCTrade/Frameworks",
"$(PROJECT_DIR)/Ifish/SDWebImage3.8.2",
"$(PROJECT_DIR)/Ifish/HTTPDNS",
);
GCC_PREFIX_HEADER = "Ifish/Ifish-Prefix.pch";
HEADER_SEARCH_PATHS = "";
@@ -15904,7 +15941,7 @@
"$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrlIOS/libAVCtrl",
"$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrl",
);
MARKETING_VERSION = 5.1.19;
MARKETING_VERSION = 5.1.20;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"-ObjC",
@@ -15978,6 +16015,7 @@
"$(PROJECT_DIR)/Ifish/Bugly",
"$(PROJECT_DIR)/Ifish/ALiBCTrade/Frameworks",
"$(PROJECT_DIR)/Ifish/SDWebImage3.8.2",
"$(PROJECT_DIR)/Ifish/HTTPDNS",
);
GCC_PREFIX_HEADER = "Ifish/Ifish-Prefix.pch";
HEADER_SEARCH_PATHS = "";
@@ -16022,7 +16060,7 @@
"$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrlIOS/libAVCtrl",
"$(PROJECT_DIR)/Ifish/controllers/IfishYooseeFile/IfishYsooseeNewLib/libAVCtrl",
);
MARKETING_VERSION = 5.1.19;
MARKETING_VERSION = 5.1.20;
ONLY_ACTIVE_ARCH = NO;
OTHER_LDFLAGS = (
"-ObjC",
BIN
View File
Binary file not shown.
+72 -1
View File
@@ -53,6 +53,8 @@
#define UMCommunity_APPKEY @"569f530fe0f55a3e9a002502"
#define UMCommunity_SECRET @"462384e695d18d287ee46c423c5dce34"
#define HTTPDNS_ACCOUNTID 139960
#define HTTPDNS_SECRET @"9ff868c992944f68a2a8929bc09e9f41"
//友盟分享appkey 和社区可通用
#import "UMSocialWechatHandler.h"
@@ -85,7 +87,9 @@
#import <AlibcTradeSDK/AlibcTradeSDK.h>
#import "IfishADTimerViewController.h"
#import "AvoidCrash.h"
@interface AppDelegate ()
#import <AlicloudHttpDNS/AlicloudHttpDNS.h>
@interface AppDelegate ()<HttpDNSDegradationDelegate,HttpdnsLoggerProtocol>
@property(nonatomic,strong)ICSDrawerController*ics;
@property(nonatomic)NSString*downloadAddress;
@@ -174,6 +178,9 @@
if (data != nil) {
[self sendExceptionLogWithData:data path:dataPath];
}*/
[self setupHTTPDNS];
#ifdef __OPTIMIZE__
[AvoidCrash becomeEffective];
#endif
@@ -377,6 +384,70 @@ if (kScreenSize.height>480) {
return YES;
}
#pragma mark - mark dns解析
-(void)setupHTTPDNS
{
HttpDnsService *httpdns = [[HttpDnsService alloc] initWithAccountID:HTTPDNS_ACCOUNTID];
// 为HTTPDNS服务设置降级机制
[httpdns setDelegateForDegradationFilter:self];
// 允许返回过期的IP
[httpdns setExpiredIPEnabled:YES];
// 打开HTTPDNS Log,线上建议关闭
[httpdns setLogEnabled:YES];
[httpdns setLogHandler:self];
/*
* 设置HTTPDNS域名解析请求类型(HTTP/HTTPS),若不调用该接口,默认为HTTP请求;
* SDK内部HTTP请求基于CFNetwork实现,不受ATS限制。
*/
//[httpdns setHTTPSRequestEnabled:YES];
// edited
NSArray *preResolveHosts = @[DOMAIN_NAME];
// NSArray* preResolveHosts = @[@"pic1cdn.igetget.com"];
// 设置预解析域名列表
[httpdns setPreResolveHosts:preResolveHosts];
[httpdns setTimeoutInterval:15];
httpdns=[HttpDnsService sharedInstance];
__block NSString*ip = [httpdns getIpByHostAsync:DOMAIN_NAME];
if (ip.length)
{
DOMAIN_NAME=ip;
}
else
{
dispatch_queue_t queue= dispatch_queue_create("dns", DISPATCH_QUEUE_CONCURRENT);
dispatch_semaphore_t sema =dispatch_semaphore_create(0);
dispatch_async(queue, ^{
while (!ip) {
ip = [httpdns getIpByHostAsync:DOMAIN_NAME];
if (ip)
{
dispatch_semaphore_signal(sema);
break;
}
}
});
dispatch_semaphore_wait(sema, dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1*NSEC_PER_SEC)));
if (ip.length)
{
DOMAIN_NAME=ip;
}
}
}
- (BOOL)shouldDegradeHTTPDNS:(NSString *)hostName;
{
return NO;
}
- (void)log:(NSString *)logStr;
{
NSLog(@"dnsLog:%@",logStr);
}
//自定义toast提示框
-(void)setUpToastView{
@@ -0,0 +1,13 @@
//
// AlicloudBeacon.h
// AlicloudBeacon
//
// Created by chenyilong on 12/10/2017.
// Copyright © 2017 alibaba. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <AlicloudBeacon/AlicloudBeaconService.h>
@@ -0,0 +1,41 @@
//
// AlicloudBeaconService.h
// AlicloudBeacon
//
// Created by junmo on 2017/7/6.
// Copyright © 2017年 junmo. All rights reserved.
//
#ifndef AlicloudBeaconService_h
#define AlicloudBeaconService_h
@interface AlicloudBeaconConfiguration : NSObject
- (instancetype)initWithData:(NSData *)data;
- (id)getConfigureItemByKey:(NSString *)key;
@end
typedef void (^AlicloudBeaconCallbackHandler)(BOOL res, NSError *error);
@interface AlicloudBeaconService : NSObject
- (instancetype)initWithAppKey:(NSString *)appKey
appSecret:(NSString *)appSecret
SDKVersion:(NSString *)SDKVersion
SDKID:(NSString *)SDKID;
- (instancetype)initWithAppKey:(NSString *)appKey
appSecret:(NSString *)appSecret
SDKVersion:(NSString *)SDKVersion
SDKID:(NSString *)SDKID
extension:(NSDictionary *)extension;
- (void)enableLog:(BOOL)enabled;
- (BOOL)isLogEnabled;
- (void)getBeaconConfigStringByKey:(NSString *)key
completionHandler:(void(^)(NSString *result, NSError *error))completionHandler;
@end
#endif /* AlicloudBeaconService_h */
@@ -0,0 +1,6 @@
framework module AlicloudBeacon {
umbrella header "AlicloudBeacon.h"
export *
module * { export * }
}
@@ -0,0 +1,27 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#import <Foundation/Foundation.h>
static NSString *const HTTPDNS_IOS_SDK_VERSION = @"2.0.5";
#import <Foundation/Foundation.h>
#import "HttpdnsLoggerDelegate.h"
#import "HttpdnsServiceProvider.h"
#import "HttpdnsDegradationDelegate.h"
@@ -0,0 +1,29 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef HttpdnsDegradationDelegate_h
#define HttpdnsDegradationDelegate_h
@protocol HttpDNSDegradationDelegate <NSObject>
- (BOOL)shouldDegradeHTTPDNS:(NSString *)hostName;
@end
#endif /* HttpdnsDegradationDelegate_h */
@@ -0,0 +1,20 @@
//
// HttpdnsLoggerProtocol.h
// AlicloudHttpDNS
//
// Created by junmo on 2018/12/19.
// Copyright © 2018年 alibaba-inc.com. All rights reserved.
//
#ifndef HttpdnsLoggerProtocol_h
#define HttpdnsLoggerProtocol_h
#import <Foundation/Foundation.h>
@protocol HttpdnsLoggerProtocol <NSObject>
- (void)log:(NSString *)logStr;
@end
#endif /* HttpdnsLoggerProtocol_h */
@@ -0,0 +1,184 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#import <Foundation/Foundation.h>
#import "HttpdnsDegradationDelegate.h"
#import "HttpdnsLoggerDelegate.h"
#define ALICLOUD_HTTPDNS_DEPRECATED(explain) __attribute__((deprecated(explain)))
extern NSString *const ALICLOUDHDNS_IPV4;
extern NSString *const ALICLOUDHDNS_IPV6;
typedef NS_ENUM(NSUInteger, AlicloudHttpDNS_IPType) {
AlicloudHttpDNS_IPTypeV4, //ipv4
AlicloudHttpDNS_IPTypeV6, //ipv6
AlicloudHttpDNS_IPTypeV64, //ipv4 + ipv6
};
@interface HttpDnsService: NSObject
@property (nonatomic, assign, readonly) int accountID;
@property (nonatomic, copy, readonly) NSString *secretKey;
@property (nonatomic, weak, setter=setDelegateForDegradationFilter:) id<HttpDNSDegradationDelegate> delegate;
@property (nonatomic, assign) NSTimeInterval timeoutInterval;
- (instancetype)autoInit;
- (instancetype)initWithAccountID:(int)accountID;
/*!
* @brief 启用鉴权功能的初始化接口
* @details 初始化、开启鉴权功能,并设置 HTTPDNS 服务 Account ID,鉴权功能对应的 secretKey。
* 您可以从控制台获取您的 Account ID 、secretKey 信息。
* 此方法会初始化为单例。
* @param accountID 您的 HTTPDNS Account ID
* @param secretKey 鉴权对应的 secretKey
*/
- (instancetype)initWithAccountID:(int)accountID secretKey:(NSString *)secretKey;
/*!
* @brief 校正 App 签名时间
* @param authCurrentTime 用于校正的时间戳,正整数。
* @details 不进行该操作,将以设备时间为准,为`(NSUInteger)[[NSDate date] timeIntervalSince1970]`。进行该操作后,如果有偏差,每次网络请求都会对设备时间进行矫正。
* @attention 校正操作在 APP 的一个生命周期内生效,APP 重启后需要重新设置才能重新生效。可以重复设置。
*/
- (void)setAuthCurrentTime:(NSUInteger)authCurrentTime;
+ (instancetype)sharedInstance;
/// 设置持久化缓存功能
/// @param enable YES: 开启 NO: 关闭
- (void)setCachedIPEnabled:(BOOL)enable;
/// 是否允许 HTTPDNS 返回 TTL 过期域名的 ip ,建议允许(默认不允许)
/// @param enable YES: 开启 NO: 关闭
- (void)setExpiredIPEnabled:(BOOL)enable;
/// * 设置 HTTPDNS 域名解析请求类型 ( HTTP / HTTPS )
/// 若不调用该接口,默认为 HTTP 请求。
/// HTTP 请求基于底层 CFNetwork 实现,不受 ATS 限制;
/// @param enable YES: HTTPS请求 NO: HTTP请求
- (void)setHTTPSRequestEnabled:(BOOL)enable;
/// 设置 region 节点,调用后,会按照 region 更新服务IP
/// @param region region为节点,可设置海外region
- (void)setRegion:(NSString *)region;
/// 域名预解析 (ipv4)
/// 选择性的预先向 HTTPDNS SDK 中注册您后续可能会使用到的域名,以便 SDK 提前解析,减少后续解析域名时请求的时延
/// @param hosts 预解析列表数组
- (void)setPreResolveHosts:(NSArray *)hosts;
/// 域名预解析
/// @param hosts 域名
/// @param ipType 4: ipv4; 6: ipv6; 64: ipv4+ipv6
- (void)setPreResolveHosts:(NSArray *)hosts queryIPType:(AlicloudHttpDNS_IPType)ipType;
/// 本地日志 log 开关
/// @param enable YES: 打开 NO: 关闭
- (void)setLogEnabled:(BOOL)enable;
/// 设置网络切换时是否自动跟新所有域名解析结果
/// 如果打开此开关,在网络切换时,会自动刷新所有域名的解析结果,但会产生一定流量消耗
/// @param enable YES: 开启 NO: 关闭
- (void)setPreResolveAfterNetworkChanged:(BOOL)enable;
/// 设置IP俳优规则
/// @param IPRankingDatasource 设置对应域名的端口号
/// @{host: port}
- (void)setIPRankingDatasource:(NSDictionary<NSString *, NSNumber *> *)IPRankingDatasource;
/// 设置是否 开启 IPv6 结果解析
/// 开启后调用 getIPv6ByHostAsync: 接口使用
///【注意】开启 IPv6 结果解析后,SDK在 IPv6-Only 网络环境下,对 IPv4 解析结果不再自动转换为 IPv6 地址, getIpsByHostAsync:返回 IPv4 地址,getIPv6ByHostAsync:返回 IPv6 地址
/// @param enable YES: 开启 NO: 关闭
- (void)enableIPv6:(BOOL)enable;
/// 是否允许通过 CNCopyCurrentNetworkInfo 获取wifi ssid bssid
/// @param enable YES: 开启 NO: 关闭 ,默认关闭
- (void)enableNetworkInfo:(BOOL)enable;
/// 获取用于用户追踪的 sessionId
/// sessionId为随机生成,长度为 12 位,App 生命周期内保持不变
/// 为了排查可能的解析问题,需要您将 sessionId 和解析出的 IP 一起记录在日志中
/// 请参考: 解析异常排查之 “会话追踪方案” https://help.aliyun.com/document_detail/100530.html
- (NSString *)getSessionId;
/// 获取域名对应的IP,单IP
/// @param host 域名
- (NSString *)getIpByHostAsync:(NSString *)host;
/// 获取域名对应的IP数组,多IP
/// @param host 域名
- (NSArray *)getIpsByHostAsync:(NSString *)host;
/// 获取域名对应格式化后的IP (针对ipv6)
/// @param host 域名
- (NSString *)getIpByHostAsyncInURLFormat:(NSString *)host;
/// 获取域名对应的ipv6, 单IP (需要开启ipv6 开关 enableIPv6
/// @param host 域名
- (NSString *)getIPv6ByHostAsync:(NSString *)host;
/// 获取域名对应的ipv6数组, 多IP (需要开启ipv6 开关 enableIPv6
/// @param host 域名
- (NSArray *)getIPv6sByHostAsync:(NSString *)host;
/// 同时获取ipv4 ipv6的IP (需要开启ipv6 开关 enableIPv6
/// @param host 域名
/// @result 返回字典类型结构
/// {
/// ALICLOUDHDNS_IPV4: ['xxx.xxx.xxx.xxx', 'xxx.xxx.xxx.xxx'],
/// ALICLOUDHDNS_IPV6: ['xx:xx:xx:xx:xx:xx:xx:xx', 'xx:xx:xx:xx:xx:xx:xx:xx']
/// }
- (NSDictionary <NSString *, NSArray *>*)getIPv4_v6ByHostAsync:(NSString *)host;
/// 清除指定host缓存(内存+沙盒数据库)
/// @param hostArray 需要清除的host域名数组。如果需要清空全部数据传nil或者空数组即可
- (void)cleanHostCache:(NSArray <NSString *>*)hostArray;
/// 设置日志输出回调
- (void)setLogHandler:(id<HttpdnsLoggerProtocol>)logHandler;
- (void)setSdnsGlobalParams:(NSDictionary<NSString *, NSString *> *)params;
- (void)clearSdnsGlobalParams;
- (NSDictionary *)getIpsByHostAsync:(NSString *)host withParams:(NSDictionary<NSString *, NSString *> *)params withCacheKey:(NSString *)cacheKey;
@end
@interface HttpDnsService (HttpdnsDeprecated)
- (void)setAccountID:(int)accountID ALICLOUD_HTTPDNS_DEPRECATED("Deprecated in v1.5.2. Use -[HttpDnsService initWithAccountID:] instead.");
@end
@@ -0,0 +1,6 @@
framework module AlicloudHttpDNS {
umbrella header "AlicloudHttpDNS.h"
export *
module * { export * }
}
@@ -0,0 +1,30 @@
//
// AlicloudSender.h
// AlicloudSender
//
// Created by sky on 2021/1/25.
// Copyright © 2021 aliyun. All rights reserved.
//
#import <Foundation/Foundation.h>
#define ALICLOUDRESTSEND_VERSION @"1.0.0.3"
//! Project version number for AlicloudSender.
FOUNDATION_EXPORT double AlicloudSenderVersionNumber;
//! Project version string for AlicloudSender.
FOUNDATION_EXPORT const unsigned char AlicloudSenderVersionString[];
NS_ASSUME_NONNULL_BEGIN
@interface AlicloudSender : NSObject
+ (instancetype)shareInstance;
- (void)sendEvent:(NSString *)event appKey:(NSString *)appkey sdkId:(NSString *)sdkId sdkVersion:(NSString *)sdkVersion extParams:(NSDictionary *)extParams;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,6 @@
framework module AlicloudSender {
umbrella header "AlicloudSender.h"
export *
module * { export * }
}
Binary file not shown.
@@ -0,0 +1,86 @@
//
// ABSBootingProtection.h
// AntilockBrakeSystem
//
// Created by 地风(ElonChan on 16/5/16.
// Copyright © 2016年 Ali. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef void (^ABSBoolCompletionHandler)(BOOL succeeded, NSError *error);
typedef void (^ABSRepairBlock)(ABSBoolCompletionHandler completionHandler);
typedef void (^ABSReportBlock)(NSUInteger crashCounts);
typedef NS_ENUM(NSInteger, ABSBootingProtectionStatus) {
ABSBootingProtectionStatusNormal, /**< APP 启动正常 */
ABSBootingProtectionStatusNormalChecking, /**< 正在检测是否会在特定时间内是否会 Crash,注意:检测状态下“连续启动崩溃计数”个数小于或等于上限值 */
ABSBootingProtectionStatusNeedFix, /**< APP 出现连续启动 Crash,需要采取修复措施 */
ABSBootingProtectionStatusFixing, /**< APP 出现连续启动 Crash,正在修复中... */
};
/**
* 启动连续 crash 保护。
* 启动后 `_crashOnLaunchTimeIntervalThreshold` 秒内 crash,反复超过 `_continuousCrashOnLaunchNeedToReport` 次则上报日志,超过 `_continuousCrashOnLaunchNeedToFix` 则启动修复操作。
*/
@interface ABSBootingProtection : NSObject
/**
* 启动连续 crash 保护方法。
* 前置条件:在 App 启动时注册 crash 处理函数,在 crash 时调用[ABSBootingProtection addCrashCountIfNeeded]。
* 启动后一定时间内(`crashOnLaunchTimeIntervalThreshold`秒内)crash,反复超过一定次数(`continuousCrashOnLaunchNeedToReport`次)则上报日志,超过一定次数(`continuousCrashOnLaunchNeedToFix`次)则启动修复程序;在一定时间内(`crashOnLaunchTimeIntervalThreshold`秒) 秒后若没有 crash 将“连续启动崩溃计数”计数置零。
`reportBlock` 上报逻辑,
`repairtBlock` 修复逻辑,完成后执行 `[self setCrashCount:0]`
*/
- (void)launchContinuousCrashProtect;
/*!
* 当前启动Crash的状态
*/
@property (nonatomic, assign, readonly) ABSBootingProtectionStatus bootingProtectionStatus;
/*!
* 达到需要执行上报操作的“连续启动崩溃计数”个数。
*/
@property (nonatomic, assign, readonly) NSUInteger continuousCrashOnLaunchNeedToReport;
/*!
* 达到需要执行修复操作的“连续启动崩溃计数”个数。
*/
@property (nonatomic, assign, readonly) NSUInteger continuousCrashOnLaunchNeedToFix;
/*!
* APP 启动后经过多少秒,可以将“连续启动崩溃计数”清零
*/
@property (nonatomic, assign, readonly) NSTimeInterval crashOnLaunchTimeIntervalThreshold;
/*!
* 借助 context 可以让多个模块注册事件,并且事件 block 能独立执行,互不干扰。
*/
@property (nonatomic, copy, readonly) NSString *context;
/*!
* @details 启动后kCrashOnLaunchTimeIntervalThreshold秒内crash,反复超过continuousCrashOnLaunchNeedToReport次则上报日志,超过continuousCrashOnLaunchNeedToFix则启动修复程序;当所有操作完成后,执行 completion。在 crashOnLaunchTimeIntervalThreshold 秒后若没有 crash 将 kContinuousCrashOnLaunchCounterKey 计数置零。
* @param context 借助 context 可以让多个模块注册事件,并且事件 block 能独立执行,互不干扰。
*/
- (instancetype)initWithContinuousCrashOnLaunchNeedToReport:(NSUInteger)continuousCrashOnLaunchNeedToReport
continuousCrashOnLaunchNeedToFix:(NSUInteger)continuousCrashOnLaunchNeedToFix
crashOnLaunchTimeIntervalThreshold:(NSTimeInterval)crashOnLaunchTimeIntervalThreshold
context:(NSString *)context;
/*!
* 当前“连续启动崩溃“的状态
*/
+ (ABSBootingProtectionStatus)bootingProtectionStatusWithContext:(NSString *)context continuousCrashOnLaunchNeedToFix:(NSUInteger)continuousCrashOnLaunchNeedToFix;
/*!
* 设置上报逻辑,参数 crashCounts 为启动连续 crash 次数
*/
- (void)setReportBlock:(ABSReportBlock)reportBlock;
/*!
* 设置修复逻辑
*/
- (void)setRepairBlock:(ABSRepairBlock)repairtBlock;
@end
@@ -0,0 +1,16 @@
//
// ABSUncaughtExceptionHandler.h
// AntilockBrakeSystem
//
// Created by 地风(ElonChan on 16/5/16.
// Copyright © 2016年 Ali. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef void (^ABSUncaughtExceptionCallback)(NSException *exception);
@interface ABSUncaughtExceptionHandler : NSObject
+ (void)registerExceptionHandlerWithCallback:(ABSUncaughtExceptionCallback)callback;
@end
@@ -0,0 +1,24 @@
//
// ABSUtil.h
// AntilockBrakeSystem
//
// Created by 地风(ElonChan on 16/5/16.
// Copyright © 2016年 Ali. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ABSUtil : NSObject
// 设置日志逻辑
+ (void)setLogger:(void (^)(NSString *))logger;
+ (void)Logger:(NSString *)log;
+ (BOOL)isValidString:(id)notValidString;
+ (BOOL)isWhiteListClass:(Class)class;
+ (void)deleteCacheWithfilePathsToRemove:(NSArray *)filePathsToRemove;
@end
@@ -0,0 +1,22 @@
//
// AlicloudHTTPDNSMini.h
// AlicloudUtils
//
// Created by ryan on 3/6/2016.
// Copyright © 2016 Ali. All rights reserved.
//
#ifndef AlicloudHTTPDNSMini_h
#define AlicloudHTTPDNSMini_h
#define HTTPDNSMINI_RESOLVED_NOTIFY @"HTTPDNSMiniResolvedNotify"
@interface AlicloudHTTPDNSMini : NSObject
+ (AlicloudHTTPDNSMini *)sharedInstance;
- (NSArray *)getIpsByHostAsync:(NSString *)host;
- (void)setPreResolveHosts:(NSArray *)hosts;
@end
#endif /* AlicloudHTTPDNSMini_h */
@@ -0,0 +1,106 @@
/*
* Copyright (c) 2000-2015 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1980, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)route.h 8.3 (Berkeley) 4/19/94
* $FreeBSD: src/sys/net/route.h,v 1.36.2.1 2000/08/16 06:14:23 jayanth Exp $
*/
#ifndef AlicloudIPv6Adapter_h
#define AlicloudIPv6Adapter_h
#import <Foundation/Foundation.h>
@interface AlicloudIPv6Adapter : NSObject
+ (instancetype)getInstance;
/**
* 判断当前是否为IPv6-Only网络
*/
- (BOOL)isIPv6OnlyNetwork;
/**
* 手动刷新IPv6-Only网络的判定
*/
- (BOOL)reResolveIPv6OnlyStatus;
/**
IPv4 > IPv6地址转换\n
- 输入IPv4地址无效,返回原地址
- IPv6-Only网络,返回转换后的IPv6地址
- 非IPv6-Only网络,返回原地址
@param addr IPv4地址
@return 转换后的v6地址 或 原地址
*/
- (NSString *)handleIpv4Address:(NSString *)addr;
/**
* 判断是否为IPv4地址
*/
- (BOOL)isIPv4Address:(NSString *)addr;
/**
* 判断是否为IPv6地址
*/
- (BOOL)isIPv6Address:(NSString *)addr;
@end
#endif /* AlicloudIPv6Adapter_h */
@@ -0,0 +1,61 @@
//
// AlicloudReachabilityManager.h
//
// Created by 亿刀 on 14-1-9.
// Edited by junmo on 15-5-16
// Copyright (c) 2014年 Twitter. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#define ALICLOUD_NETWOEK_STATUS_NOTIFY @"AlicloudNetworkStatusChangeNotify"
typedef enum {
AlicloudNotReachable = 0,
AlicloudReachableViaWiFi,
AlicloudReachableVia2G,
AlicloudReachableVia3G,
AlicloudReachableVia4G
} AlicloudNetworkStatus;
@interface AlicloudReachabilityManager : NSObject
/**
* 获取Reachability单例对象
*/
+ (AlicloudReachabilityManager *)shareInstance;
/**
* 获取Reachability单例对象,为保证全局维护一个netInfo实例,可从外部传入netInfo对象的引用
* warn: netInfo多次实例化,有一定几率crash
*
*/
+ (AlicloudReachabilityManager *)shareInstanceWithNetInfo:(CTTelephonyNetworkInfo *)netInfo;
/**
* 返回当前网络状态(同步调用,可能会阻塞调用线程)
*/
- (AlicloudNetworkStatus)currentNetworkStatus;
/**
* 返回之前网络状态
*/
- (AlicloudNetworkStatus)preNetworkStatus;
/**
* 检测网络是否连通(同步调用,阻塞调用线程)
*/
- (BOOL)checkInternetConnection;
/**
* 检测Wifi网络是否联通
*/
- (BOOL)isReachableViaWifi;
/**
* 检测蜂窝网络是否联通
*/
- (BOOL)isReachableViaWWAN;
@end
@@ -0,0 +1,68 @@
//
// AlicloudReport.h
// AlicloudUtils
//
// Created by ryan on 3/6/2016.
// Copyright © 2016 Ali. All rights reserved.
//
#ifndef AlicloudReport_h
#define AlicloudReport_h
extern const NSString *EXT_INFO_KEY_VERSION;
extern const NSString *EXT_INFO_KEY_PACKAGE;
// SDK标识
typedef NS_ENUM(NSInteger, AMSService) {
AMSMAN = 0,
AMSHTTPDNS,
AMSMPUSH,
AMSMAC,
AMSAPI,
AMSHOTFIX,
AMSFEEDBACK,
AMSIM
};
// 上报状态
typedef NS_ENUM(NSInteger, AMSReportStatus) {
AMS_UNREPORTED_STATUS,
AMS_REPORTED_STATUS
};
@interface AlicloudReport : NSObject
/**
* 异步上报活跃设备统计
*
@param tag SDK标识
*/
+ (void)statAsync:(AMSService)tag;
/**
* 异步上报活跃设备统计并携带附加信息
*
@param tag SDK标识
@param extInfo 附加上报信息 { EXT_INFO_KEY_VERSION :"x.x.x", EXT_INFO_KEY_PACKAGE: "xxx"}
*/
+ (void)statAsync:(AMSService)tag extInfo:(NSDictionary *)extInfo;
/**
* 获取指定SDK标识上报状态
*
@param tag SDK标识
@return 返回上报状态
*/
+ (AMSReportStatus)getReportStatus:(AMSService)tag;
/**
* 获取上报状态(兼容老版本接口)
*
@param tag SDK标识
@return YES:已经上报 NO:没有上报
*/
+ (BOOL)isDeviceReported:(AMSService)tag;
@end
#endif /* AlicloudReport_h */
@@ -0,0 +1,44 @@
//
// AlicloudTracker.h
// AlicloudUtils
//
// Created by junmo on 2017/6/30.
// Copyright © 2017年 Ali. All rights reserved.
//
#ifndef AlicloudTracker_h
#define AlicloudTracker_h
@interface AlicloudTracker : NSObject
@property (nonatomic, copy) NSString *sdkId;
@property (nonatomic, copy) NSString *sdkVersion;
/**
设置Tracker的通用打点属性,每次上报都携带该参数
@param key 通用属性Key
@param value 通用属性Value
*/
- (void)setGlobalProperty:(NSString *)key value:(NSString *)value;
/**
删除Tracker通用打点属性
@param key 通用属性Key
*/
- (void)removeGlobalProperty:(NSString *)key;
/**
自定义打点上报
@param eventName 事件名
@param duration 时长
@param properties 额外参数
*/
- (void)sendCustomHit:(NSString *)eventName
duration:(long long)duration
properties:(NSDictionary *)properties;
@end
#endif /* AlicloudTracker_h */
@@ -0,0 +1,34 @@
//
// AlicloudTrackerManager.h
// AlicloudUtils
//
// Created by junmo on 2017/7/4.
// Copyright © 2017年 Ali. All rights reserved.
//
#ifndef AlicloudTrackerManager_h
#define AlicloudTrackerManager_h
#import "AlicloudTracker.h"
@interface AlicloudTrackerManager : NSObject
/**
获取上报通道管理器对象,并初始化UT
@return 管理器对象
*/
+ (instancetype)getInstance;
/**
根据SDK标识和版本号获取上报通道
@param sdkId SDK标识
@param version SDK版本号
@return 上报通道对象
*/
- (AlicloudTracker *)getTrackerBySdkId:(NSString *)sdkId version:(NSString *)version;
@end
#endif /* AlicloudTrackerManager_h */
@@ -0,0 +1,27 @@
//
// AlicloudUtils.h
// AlicloudUtils
//
// Created by lingkun on 16/5/16.
// Copyright © 2016年 Ali. All rights reserved.
//
#import <UIKit/UIKit.h>
#define ALICLOUDUTILS_VERSION @"1.3.9-m1"
// In this header, you should import all the public headers of your framework using statements like #import <AlicloudUtils/PublicHeader.h>
#import <AlicloudUtils/AlicloudReachabilityManager.h>
#import <AlicloudUtils/EMASSecurityModeManager.h>
#import <AlicloudUtils/EMASSecurityModeCommon.h>
#import <AlicloudUtils/AlicloudTrackerManager.h>
#import <AlicloudUtils/AlicloudIPv6Adapter.h>
#import <AlicloudUtils/AlicloudHTTPDNSMini.h>
#import <AlicloudUtils/AntilockBrakeSystem.h>
#import <AlicloudUtils/EMASBeaconService.h>
#import <AlicloudUtils/AlicloudTracker.h>
#import <AlicloudUtils/AlicloudReport.h>
#import <AlicloudUtils/EMASOptions.h>
#import <AlicloudUtils/EMASTools.h>
#import <AlicloudUtils/UtilLog.h>
@@ -0,0 +1,11 @@
//
// AntilockBrakeSystem.h
// AntilockBrakeSystem
//
// Created by 地风(ElonChan on 16/5/16.
// Copyright © 2016年 Ali. All rights reserved.
//
#import "ABSUncaughtExceptionHandler.h"
#import "ABSBootingProtection.h"
#import "ABSUtil.h"
@@ -0,0 +1,45 @@
//
// EMASBeaconService.h
// AlicloudBeacon
//
// Created by junmo on 2017/7/6.
// Copyright © 2017年 junmo. All rights reserved.
//
#ifndef EMASBeaconService_h
#define EMASBeaconService_h
@interface EMASBeaconConfiguration : NSObject
- (instancetype)initWithData:(NSData *)data;
- (id)getConfigureItemByKey:(NSString *)key;
@end
typedef void (^AlicloudBeaconCallbackHandler)(BOOL res, NSError *error);
@interface EMASBeaconService : NSObject
- (instancetype)initWithAppKey:(NSString *)appKey
appSecret:(NSString *)appSecret
SDKVersion:(NSString *)SDKVersion
SDKID:(NSString *)SDKID;
- (instancetype)initWithAppKey:(NSString *)appKey
appSecret:(NSString *)appSecret
SDKVersion:(NSString *)SDKVersion
SDKID:(NSString *)SDKID
extension:(NSDictionary *)extension;
- (void)enableLog:(BOOL)enabled;
- (BOOL)isLogEnabled;
//- (void)getBeaconConfigByKey:(NSString *)key
// completionHandler:(void(^)(EMASBeaconConfiguration *configuration, NSError *error))completionHandler;
- (void)getBeaconConfigStringByKey:(NSString *)key
completionHandler:(void(^)(NSString *result, NSError *error))completionHandler;
@end
#endif /* EMASBeaconService_h */
@@ -0,0 +1,38 @@
//
// EMASOptions.h
// AlicloudUtils
//
// Created by junmo on 2018/3/16.
// Copyright © 2018年 Ali. All rights reserved.
//
#ifndef EMASOptions_h
#define EMASOptions_h
@interface EMASOptionSDKServiceItem : NSObject
@property (nonatomic, copy) NSString *sdkId;
@property (nonatomic, copy) NSString *version;
@property (nonatomic, assign) NSNumber *status;
@end
@interface EMASOptions : NSObject
@property (nonatomic, copy, readonly) NSString *emasAppKey;
@property (nonatomic, copy, readonly) NSString *emasAppSecret;
@property (nonatomic, copy, readonly) NSString *emasBundleId;
@property (nonatomic, copy, readonly) NSString *hotfixIdSecret;
@property (nonatomic, copy, readonly) NSString *hotfixRsaSecret;
@property (nonatomic, copy, readonly) NSString *tlogRsaSecret;
@property (nonatomic, copy, readonly) NSString *appmonitorRsaSecret;
@property (nonatomic, copy, readonly) NSString *httpdnsAccountId;
@property (nonatomic, copy, readonly) NSString *httpdnsSecretKey;
+ (EMASOptions *)defaultOptions;
- (NSString *)optionByConfigKey:(NSString *)key;
- (EMASOptionSDKServiceItem *)sdkServiceItemForSdkId:(NSString *)sdkId;
@end
#endif /* EMASOptions_h */
@@ -0,0 +1,15 @@
//
// EMASSecurityModeCommon.h
// AlicloudUtils
//
// Created by junmo on 2018/3/11.
// Copyright © 2018年 Ali. All rights reserved.
//
#ifndef EMASSecurityModeCommon_h
#define EMASSecurityModeCommon_h
typedef void (^SDKCheckSuccessHandler)(void);
typedef void (^SDKCheckCrashHandler)(NSUInteger crashCount);
#endif /* EMASSecurityModeCommon_h */
@@ -0,0 +1,28 @@
//
// EMASSecurityModeManager.h
// AlicloudUtils
//
// Created by junmo on 2018/3/10.
// Copyright © 2018年 Ali. All rights reserved.
//
#ifndef EMASSecurityModeManager_h
#define EMASSecurityModeManager_h
#import "EMASSecurityModeCommon.h"
@interface EMASSecurityModeManager : NSObject
+ (instancetype)sharedInstance;
- (void)registerSDKComponentAndStartCheck:(NSString *)sdkId
sdkVersion:(NSString *)sdkVersion
appKey:(NSString *)appKey
appSecret:(NSString *)appSecret
sdkCrashThreshold:(NSUInteger)crashTimesThreshold
onSuccess:(SDKCheckSuccessHandler)successHandler
onCrash:(SDKCheckCrashHandler)crashHandler;
@end
#endif /* EMASSecurityModeManager_h */
@@ -0,0 +1,57 @@
//
// EMASTools.h
// AlicloudUtils
//
// Created by junmo on 2018/3/14.
// Copyright © 2018年 Ali. All rights reserved.
//
#ifndef EMASTools_h
#define EMASTools_h
#define EMAS_SYNC_EXECUTE_BY_KEY(key, executor)\
[EMASTools syncExecuteBlockByKey:key block:executor];\
#define EMAS_SYNC_EXECUTE_BY_QUEUE(queue, executor)\
[EMASTools syncExecuteBlockByQueue:queue block:executor];\
@interface EMASTools : NSObject
+ (BOOL)isValidString:(id)obj;
+ (BOOL)isValidDictionary:(id)obj;
+ (BOOL)isValidArray:(id)obj;
+ (NSString *)md5:(NSString *)str;
+ (NSString *)sha1:(NSString *)str;
+ (NSString *)hmacSha1:(NSString *)str key:(NSString *)key;
+ (NSString *)base64EncodedWithString:(NSString *)str;
+ (NSString *)base64DecodedWithString:(NSString *)base64Str;
+ (NSData *)aes128CBCEncrypt:(NSData *)data key:(NSData *)key iv:(char *)iv;
+ (NSString *)URLEncodedString:(NSString *)str;
+ (NSString *)convertObjectToJsonString:(id)obj;
+ (id)convertJsonStringToObject:(NSString *)jsonStr;
+ (id)convertJsonDataToObject:(NSData *)jsonData;
+ (NSString *)convertDateToGMT0String:(NSDate *)date;
+ (NSString *)convertDateToGMT8String:(NSDate *)date;
+ (void)swizzleClassMethod:(Class)cls originSEL:(SEL)originSEL swizzleSEL:(SEL)swizzleSEL;
+ (void)swizzleInstanceMethod:(Class)cls originSEL:(SEL)originSEL swizzleSEL:(SEL)swizzleSEL;
+ (BOOL)isIPv4Address:(NSString *)addr;
+ (BOOL)isIPv6Address:(NSString *)addr;
+ (dispatch_queue_t)createQueueIfNotExists:(NSString *)key;
+ (void)syncExecuteBlockByKey:(NSString *)key block:(void(^)(void))block;
+ (void)syncExecuteBlockByQueue:(dispatch_queue_t)queue block:(void(^)(void))block;
+ (NSString *)bundleIdForApp;
+ (NSString *)deviceBrand;
+ (NSString *)deviceModel;
+ (void)threadWaitForSec:(double)sec;
@end
#endif /* EMASTools_h */
@@ -0,0 +1,34 @@
//
// UtilLog.h
// AlicloudUtils
//
// Created by junmo on 16/11/24.
// Copyright © 2016年 Ali. All rights reserved.
//
#ifndef UtilLog_h
#define UtilLog_h
@interface UtilLog : NSObject
+ (void)enableLog;
+ (BOOL)isLogEnabled;
#define UtilLogD(tag, frmt, ...)\
if ([UtilLog isLogEnabled]) {\
NSLog(@"[%@]-[D]: %@", tag, [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\
}
#define UtilLogI(tag, frmt, ...)\
if ([UtilLog isLogEnabled]) {\
NSLog(@"[%@]-[I]: %@", tag, [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\
}
#define UtilLogE(tag, frmt, ...)\
if ([UtilLog isLogEnabled]) {\
NSLog(@"[%@]-[E]: %@", tag, [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\
}
@end
#endif /* UtilLog_h */
Binary file not shown.
@@ -0,0 +1,6 @@
framework module AlicloudUtils {
umbrella header "AlicloudUtils.h"
export *
module * { export * }
}
Binary file not shown.
@@ -0,0 +1,18 @@
//
// EMASRest.h
// EMASRest
//
// Created by sky on 2020/6/11.
// Copyright © 2020 aliyun. All rights reserved.
//
#import <Foundation/Foundation.h>
#define ALICLOUD_EMAS_REST_IOS_SDK_VERSION @"11.1.1.2"
#import <EMASRest/EMASRestConfiguration.h>
#import <EMASRest/EMASRestCacheConfig.h>
#import <EMASRest/EMASRestManager.h>
#import <EMASRest/EMASRestManager.h>
#import <EMASRest/EMASRestSendService+MultiChannel.h>
#import <EMASRest/EMASRestSendService.h>
@@ -0,0 +1,33 @@
//
// EMASRestCacheConfig.h
// AlicloudCommonAnalytics
//
// Created by sky on 2020/7/27.
//
#import <Foundation/Foundation.h>
#import "EMASRestConfiguration.h"
NS_ASSUME_NONNULL_BEGIN
@interface EMASRestCacheConfig : NSObject
@property (nonatomic, assign) int memoryCacheSizeLimit; // 内存size限制
@property (nonatomic, assign) int memoryCacheCountLimit; // 日志条数限制
@property (nonatomic, assign) BOOL memoryCacheSwitch; // 内存缓存开关
@property (nonatomic, assign) BOOL diskCacheSwitch; // 磁盘缓存开关
@property (nonatomic, strong) NSString *cacheName; // 缓存标识,默认为common
// 缓存标识,对应一个实例。
// dataUploadHost+appkey+cacheName共同确认一个实例
@property (nonatomic, strong) NSString *cacheKey;
@property (nonatomic, strong) EMASRestConfiguration *restConfig;
// 是否有效
- (BOOL)isValid;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,36 @@
//
// EMASRestConfiguration.h
// EMASRest
//
// Created by qiulibin on 16/11/12.
// Copyright © 2016年 Taobao lnc. All rights reserved.
//
#ifndef EMASRestConfiguration_h
#define EMASRestConfiguration_h
#import <Foundation/Foundation.h>
//用于返回追加的保留字段信息
@protocol EMASRestReservesProviderProtocol <NSObject>
- (NSDictionary<NSString*, NSString*>*)reserveInfoDictionary;
@end
@interface EMASRestConfiguration : NSObject
@property(nonatomic, copy) NSString * channel;
@property(nonatomic, copy) NSString * appkey;
@property(nonatomic, copy) NSString * secret;
@property(nonatomic, copy) NSString * userId;
@property(nonatomic, copy) NSString * usernick;
@property(nonatomic, copy) NSString * appVersion;
@property(nonatomic, copy) NSString * country;
@property(nonatomic, copy) NSString * dataUploadScheme; // http or https
@property(nonatomic, copy) NSString * dataUploadHost; // data upload host
@end
#endif /* EMASRestConfiguration_h */
@@ -0,0 +1,32 @@
//
// TBDevice2.h
//
//
// Created by Alvin on 4/21/13.
//
// 设备信息的分装类
#ifndef EMASRestDevice_h
#define EMASRestDevice_h
#import <sys/socket.h>
#import <sys/sysctl.h>
#import <net/if.h>
#import <net/if_dl.h>
#import <Foundation/Foundation.h>
#import <CommonCrypto/CommonDigest.h>
#import <CommonCrypto/CommonHMAC.h>
#import "EMASRestDeviceInfo.h"
@interface EMASRestDevice : NSObject
// 获取设备信息:部分信息的变化性,因此这里需要提供一个 持久配置模块,用于支持这类数据
+ (EMASRestDeviceInfo *)getDevice;
// 获取Mac地址
+ (NSString *)macAddress;
@end
#endif
@@ -0,0 +1,37 @@
//
// TBDevice.h
//
//
// Created by Alvin on 4/21/13.
//
// 设备信息存储的元类
#ifndef EMASRestDeviceInfo_h
#define EMASRestDeviceInfo_h
#import <Foundation/Foundation.h>
@interface EMASRestDeviceInfo : NSObject
@property(readwrite,strong) NSString * mAppVersion;
@property(readwrite,strong) NSString * mOsName;
@property(readwrite,strong) NSString * mUtdid;
@property(readwrite,strong) NSString * mImei;
@property(readwrite,strong) NSString * mImsi;
@property(readwrite,strong) NSString * mBrand;
@property(readwrite,strong) NSString * mCpu;
@property(readwrite,strong) NSString * mDeviceId;
@property(readwrite,strong) NSString * mDeviceModel;
@property(readwrite,strong) NSString * mResolution;
@property(readwrite,strong) NSString * mCarrier;
@property(readwrite,strong) NSString * mAccess;
@property(readwrite,strong) NSString * mAccessSubType;
@property(readwrite,strong) NSString * mCountry;
@property(readwrite,strong) NSString * mLanguage;
@property(readwrite,strong) NSString * mOsVersion;
//@property(readwrite,strong) NSString * mDebugId;
@end
#endif
@@ -0,0 +1,24 @@
//
// EMASRest.h
// EMASRest
//
// Created by sky on 2020/6/11.
// Copyright © 2020 aliyun. All rights reserved.
//
#import "EMASRestCacheConfig.h"
@interface EMASRestManager : NSObject
+ (void)turnOnDebug;
// 添加rest配置
+ (void)addRestCacheConfigs:(EMASRestCacheConfig *)config;
/**
* 异步接口,注意数据大小不能超过30K
*/
+ (void)sendLogAsyncWithConfiguration:(EMASRestCacheConfig *)config aPageName:(NSObject *)aPageName eventId:(int) aEventId arg1:(NSString*) aArg1 arg2:(NSString*) aArg2 arg3:(NSString*) aArg3 args:(NSDictionary *) aArgs;
@end
@@ -0,0 +1,16 @@
//
// UTMd5.h
//
#import <Foundation/Foundation.h>
@interface EMASRestMd5 : NSObject
+ (NSString *)md5StrForData:(NSData *)data;
+ (NSData *)md5ForData:(NSData *)data;
+ (NSString *)md5StrForNSString:(NSString *) str;
@end
@@ -0,0 +1,29 @@
//
// EMASRestSendService+MultiChannel.h
// AlicloudCommonAnalytics
//
// Created by sky on 2020/6/11.
// Copyright © 2020 aliyun. All rights reserved.
//
#import "EMASRestSendService.h"
#import "EMASRestConfiguration.h"
NS_ASSUME_NONNULL_BEGIN
@interface EMASRestSendService (MultiChannel)
/**
* 异步接口,注意数据大小不能超过30K
*/
+ (void)sendLogAsyncWithConfiguration:(EMASRestConfiguration*)configuration aPageName:(NSObject *)aPageName eventId:(int) aEventId arg1:(NSString*) aArg1 arg2:(NSString*) aArg2 arg3:(NSString*) aArg3 args:(NSDictionary *) aArgs;
/**
* 同步接口,注意数据大小不能超过30K
*/
+ (BOOL)sendLogSyncWithConfiguration:(EMASRestConfiguration*)configuration aPageName:(NSObject *)aPageName eventId:(int) aEventId arg1:(NSString *) aArg1 arg2:(NSString *) aArg2 arg3:(NSString *) aArg3 args:(NSDictionary *) aArgs;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,57 @@
//
// EMASRestSendService.h
// EMASRest
//
// Created by qiulibin on 16/11/12.
// Copyright © 2016年 Taobao lnc. All rights reserved.
//
#ifndef EMASRestSendService_h
#define EMASRestSendService_h
#import <Foundation/Foundation.h>
#import "EMASRestConfiguration.h"
@interface EMASRestSendService : NSObject
//From数据链路打通需求,由一休SDK调用, 文档https://yuque.antfin-inc.com/ubmgda/lh1gwa/dffuy5
@property (nonatomic, copy) NSString* utabtest;
@property (nonatomic, copy) NSString* utabtestpage;
@property (nonatomic, weak) id<EMASRestReservesProviderProtocol> reserveProvider;
+ (EMASRestSendService*)shareInstance;
/**
* 配置初始化,该接口支持更新配置
* 》》》》》》》》》》》》》》》》提醒:只有调用接口比TBCrashReporter的业务才需要进行配置,比如安全模式 》》》》》》
* @param config 配置对象,参数存储在对象中
* @return 配置初始化是否成功,如appkey是必填参数,不可缺少
*/
- (BOOL)configBasicParamWithTBConfiguration:(EMASRestConfiguration*)config;
/**
* 获取配置参数
* @return 已经配置过了,返回配置的结果,否则返回nil
*/
- (EMASRestConfiguration*)obtainConfiguration;
/**
* 同步接口,注意数据大小不能超过30K
*/
-(BOOL)sendLogSync:(NSObject*)aPageName eventId:(int) aEventId arg1:(NSString*) aArg1 arg2:(NSString*) aArg2 arg3:(NSString*) aArg3 args:(NSDictionary *) aArgs;
/**
* 异步接口,注意数据大小不能超过30K
*/
-(void)sendLogAsync:(NSObject*)aPageName eventId:(int) aEventId arg1:(NSString*) aArg1 arg2:(NSString*) aArg2 arg3:(NSString*) aArg3 args:(NSDictionary *) aArgs;
/**
* 自定义url传输(同步),注意数据大小不能超过30K
*/
- (NSData *) sendLogWithUrl:(NSString*)url PageName:(NSObject *)aPageName eventId:(int) aEventId arg1:(NSString *) aArg1 arg2:(NSString *) aArg2 arg3:(NSString *) aArg3 args:(NSDictionary *) aArgs;
@end
#endif /* EMASRestSendService_h */
@@ -0,0 +1,6 @@
framework module EMASRest {
umbrella header "EMASRest.h"
export *
module * { export * }
}
@@ -0,0 +1,24 @@
//
// AidProtocol.h
// UtdidSDK
//
// Created by ALLEN on 14-12-22.
// Copyright (c) 2014年 Alvin. All rights reserved.
//
#ifndef AidProtocol_h
#define AidProtocol_h
#define EVENT_REQUEST_STARTED 1000
#define EVENT_REQUEST_SUCCESS 1001
#define EVENT_REQUEST_FAILED 1002
#define EVENT_NETWORK_ERROR 1003
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol AidProtocolDelegate <NSObject>
@required
- (void) onAidEventChanged:(NSInteger)eventId
aid:(NSString *)aid;
@end
NS_ASSUME_NONNULL_END
#endif
@@ -0,0 +1,13 @@
//
// UTDIDPublic.h
// UTDID
//
// Created by ljianfeng on 2019/8/1.
// Copyright © 2019 Alvin. All rights reserved.
//
#ifndef UTDID_h
#define UTDID_h
#import <UTDID/UTDevice.h>
#import <UTDID/AidProtocol.h>
#endif /* UTDIDPublic_h */
@@ -0,0 +1,56 @@
//
// UTDevice.h
//
//
// Created by Alvin on 4/21/13.
//
// 设备信息的分装类:sdk合作开发需要用这个类提供的设备信息接口
// Version:1.5.0-AU
#ifndef UTDIDDevice_h
#define UTDIDDevice_h
#import <Foundation/Foundation.h>
@protocol AidProtocolDelegate;
NS_ASSUME_NONNULL_BEGIN
@interface UTDevice : NSObject
/**
* @brief 获取SDK生成的设备唯一标识.
*
* @warning 调用说明:这个设备唯一标识是持久的,并且格式安全,iOS6以及以下,多应用互通.
*
* 调用顺序:utdid任意时刻都可以调用.
*
* @return 24字节的设备唯一标识.
*/
+(NSString *) utdid;
/**
* @brief 同步获得AID.
*
* @warning 调用说明:若本地端没有最新AID,将耗费远程通信时间并阻塞线程,建议将此调用置于非主线程,或使用{@link getAidAsync}异步获得AID。
*
* 调用顺序:aid任意时刻都可以调用.
*
* @return AID.
*/
+(NSString *) aid:(NSString *)appName
token:(NSString *)token;
/**
* @brief 异步请求AID.
*
* @warning 调用说明:若本地端没有最新AID,将建立异步请求获得AID,
*
* 调用顺序:aidAsync任意时刻都可以调用.
*/
+(void) aidAsync:(NSString *)appName
token:(NSString *)token
aidDelegate:(id<AidProtocolDelegate> )aidDelegate;
@end
NS_ASSUME_NONNULL_END
#endif
+51
View File
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>19G73</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>UTDID</string>
<key>CFBundleIdentifier</key>
<string>com.alibaba.UTDID-AU</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>UTDID</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.5.0.90-SNAPSHOT</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>17B102</string>
<key>DTPlatformName</key>
<string>iphoneos</string>
<key>DTPlatformVersion</key>
<string>13.2</string>
<key>DTSDKBuild</key>
<string>17B102</string>
<key>DTSDKName</key>
<string>iphoneos13.2</string>
<key>DTXcode</key>
<string>1120</string>
<key>DTXcodeBuild</key>
<string>11B500</string>
<key>MinimumOSVersion</key>
<string>7.0</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
</dict>
</plist>
@@ -0,0 +1,6 @@
framework module UTDID {
umbrella header "UTDID.h"
export *
module * { export * }
}
Binary file not shown.
@@ -0,0 +1,49 @@
//
// AppMonitorSDK.h
// AppMonitorSDK
//
// Created by junzhan on 14-9-9.
// Copyright (c) 2014年 君展. All rights reserved.
// 接口类
#import <Foundation/Foundation.h>
#import "AppMonitorTable.h"
#import "AppMonitorAlarm.h"
#import "AppMonitorCounter.h"
#import "AppMonitorStat.h"
@interface AppMonitor : NSObject
+ (BOOL)isInit;
+ (BOOL) isUTInit;
+ (void) setUTInit;
+ (instancetype)sharedInstance;
/*
* 设置采样率配置
* @param jsonStr JSON串
*/
+ (void)setSamplingConfigWithJson:(NSString *)jsonStr;
/**
* 关闭采样,紧开发调试用。线上版本请勿调用此API
*/
+ (void)disableSample;
/**
* 设置采样率(默认是 50%) 值范围在[0~10000] (0表示不上传,10000表示100%上传,5000表示50%上传)
*/
+ (void)setSampling:(NSString *)sampling;
////是否开启实时调试模式(与UT同步)
+ (BOOL)isTurnOnRealTimeDebug;
+ (NSString*)realTimeDebugUploadUrl;
+ (NSString*)realTimeDebugId;
+(void) turnOnAppMonitorRealtimeDebug:(NSDictionary *) pDict;
+(void) turnOffAppMonitorRealtimeDebug;
@end
@@ -0,0 +1,52 @@
//
// AppMonitorAlarm.h
// AppMonitor
//
// Created by junzhan on 14-9-15.
// Copyright (c) 2014年 君展. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "AppMonitorBase.h"
@interface AppMonitorAlarm : AppMonitorBase
/**
* 记录业务操作成功接口
*
* @param page 页面名称,安卓iOS要相同. 命名规范:若之前埋点有页面名,则用原来的; 否则用"业务名_页面名"(无页面则"业务名"); 采用首字母大写驼峰方式. 如Shop_Detail, Shop_List
* @param monitorPoint 监控点名称,安卓iOS要相同,从@雷曼 获取
*
*/
+ (void)commitSuccessWithPage:(NSString *)page monitorPoint:(NSString *)monitorPoint;
/**
* 记录业务操作失败接口
*
* @param page 页面名称,安卓iOS要相同. 命名规范:若之前埋点有页面名,则用原来的; 否则用"业务名_页面名"(无页面则"业务名"); 采用首字母大写驼峰方式. 如Shop_Detail, Shop_List
* @param monitorPoint 监控点名称,安卓iOS要相同,从@雷曼 获取
* @param errorCode 错误码,若为MTOP请求则传MTOP的错误码,否则请业务方对错误进行分类编码,方便统计错误类型占比
* @param errorMsg 错误信息,若位MTOP请求则传MTOP的错误信息, 否则请业务方自己描述错误, 方便自己查找原因
*/
+ (void)commitFailWithPage:(NSString *)page monitorPoint:(NSString *)monitorPoint errorCode:(NSString *)errorCode errorMsg:(NSString *)errorMsg;
/**
* 记录业务操作成功接口
*
* @param page 页面名称,安卓iOS要相同. 命名规范:若之前埋点有页面名,则用原来的; 否则用"业务名_页面名"(无页面则"业务名"); 采用首字母大写驼峰方式. 如Shop_Detail, Shop_List
* @param monitorPoint 监控点名称,安卓iOS要相同,从@雷曼 获取
* @arg 附加参数,用于做横向扩展
*/
+ (void)commitSuccessWithPage:(NSString *)page monitorPoint:(NSString *)monitorPoint arg:(NSString *)arg;
/**
* 记录业务操作失败接口
*
* @param page 页面名称,安卓iOS要相同. 命名规范:若之前埋点有页面名,则用原来的; 否则用"业务名_页面名"(无页面则"业务名"); 采用首字母大写驼峰方式. 如Shop_Detail, Shop_List
* @param monitorPoint 监控点名称,安卓iOS要相同,从@雷曼 获取
* @param errorCode 错误码,若为MTOP请求则传MTOP的错误码,否则请业务方对错误进行分类编码,方便统计错误类型占比
* @param errorMsg 错误信息,若位MTOP请求则传MTOP的错误信息, 否则请业务方自己描述错误, 方便自己查找原因
* @arg 附加参数,用于做横向扩展
*/
+ (void)commitFailWithPage:(NSString *)page monitorPoint:(NSString *)monitorPoint errorCode:(NSString *)errorCode errorMsg:(NSString *)errorMsg arg:(NSString *)arg;
@end
@@ -0,0 +1,27 @@
//
// AppMonitorBase.h
// AppMonitor
//
// Created by junzhan on 14-10-14.
// Copyright (c) 2014年 君展. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface AppMonitorBase : NSObject
/**
* 日志写入UT间隔时间(单位秒).默认300秒, -1代表关闭. 会监听配置中心做变化
*/
+ (void)setWriteLogInterval:(NSInteger)writeLogInterval;
+ (NSInteger)writeLogInterval;
/**
* 将appmonitor的日志立刻强制写入本地(UT),避免丢失。请不要私自调用,使用前咨询@君展
*/
+ (void)flushAllLog;
@end
@@ -0,0 +1,35 @@
//
// AppMonitorCounter.h
// AppMonitor
//
// Created by junzhan on 14-10-14.
// Copyright (c) 2014年 君展. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "AppMonitorBase.h"
@interface AppMonitorCounter : AppMonitorBase
/**
* 实时计数接口.(每次commit会累加一次count,value也会累加)可用于服务端计算总次数或求平均值。
* 此接口数据量不应太大,
*
* @param page 操作发生所在的页面
* @param monitorPoint 监控点名称
* @param value 数值
*/
+ (void)commitWithPage:(NSString *)page monitorPoint:(NSString *)monitorPoint value:(double)value;
/**
* 实时计数接口.(每次commit会累加一次count,value也会累加)可用于服务端计算总次数或求平均值。
* 此接口数据量不应太大,
*
* @param page 操作发生所在的页面
* @param monitorPoint 监控点名称
* @param value 数值
* @param arg 附加参数
*/
+ (void)commitWithPage:(NSString *)page monitorPoint:(NSString *)monitorPoint value:(double)value arg:(NSString *)arg;
@end
@@ -0,0 +1,25 @@
//
// AppMonitorDimension.h
// AppMonitor
//
// Created by christ.yuj on 15/2/15.
// Copyright (c) 2015年 君展. All rights reserved.
//
#import <Foundation/Foundation.h>
/**
* 监控维度
*
*/
@interface AppMonitorDimension : NSObject
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *constantValue;
- (instancetype)initWithName:(NSString *)name;
- (instancetype)initWithName:(NSString *)name constantValue:(NSString *)constantValue;
@end
@@ -0,0 +1,56 @@
//
// AppMonitorDimensionSet.h
// AppMonitor
//
// Created by christ.yuj on 15/2/15.
// Copyright (c) 2015年 君展. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "AppMonitorDimensionValueSet.h"
#import "AppMonitorDimension.h"
@interface AppMonitorDimensionSet : NSObject
/**
* 根据列表初始化指标集合对象
*
* @param array NSString类型的数组 string为Name;
* @return
*/
+ (instancetype)setWithArray:(NSArray *)array;
- (BOOL)valid:(AppMonitorDimensionValueSet*)dimensionValues;
/**
* 增加维度
*
* @param dimension 维度对象
* @return
*/
- (void)addDimension:(AppMonitorDimension *)dimension;
/**
* 增加维度对象
*
* @param name 维度名称
* @return
*/
- (void)addDimensionWithName:(NSString *)name;
/**
* 获取维度对象
*
* @param name 维度名称
* @return
*/
- (AppMonitorDimension *)dimensionForName:(NSString *)name;
- (NSMutableOrderedSet *)dimensions;
/**
* 设置定值维度
*
* @param dimensionValues key为维度名称,value为内容
*/
- (void)setConstantValue:(AppMonitorDimensionValueSet *)dimensionValues;
@end
@@ -0,0 +1,26 @@
//
// AppMonitorDimensionValueSet.h
// AppMonitor
//
// Created by christ.yuj on 15/2/15.
// Copyright (c) 2015年 君展. All rights reserved.
//
#import <Foundation/Foundation.h>
/**
其实就是个字典
*/
@interface AppMonitorDimensionValueSet : NSObject<NSCopying>
- (instancetype)initWithDictionary:(NSDictionary *)dictionary;
/**
* 存储维度值
*/
@property (nonatomic, strong) NSMutableDictionary *dict;
- (void)setValue:(NSString *)value forName:(NSString *)name;
- (BOOL)containValueForName:(NSString *)name;
- (NSString *)valueForName:(NSString *)name;
@end
@@ -0,0 +1,28 @@
//
// AppMonitorMeasure.h
// AppMonitor
//
// Created by christ.yuj on 15/2/15.
// Copyright (c) 2015年 君展. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "AppMonitorMeasureValue.h"
/**
* 监控指标项
*
*/
@interface AppMonitorMeasure : NSObject
@property (nonatomic, copy) NSString *name;
@property (nonatomic, strong) NSNumber *constantValue;
@property (nonatomic, strong) NSNumber *min;
@property (nonatomic, strong) NSNumber *max;
- (instancetype)initWithName:(NSString *)name;
- (instancetype)initWithName:(NSString *)name constantValue:(NSNumber *)constantValue;
- (instancetype)initWithName:(NSString *)name constantValue:(NSNumber *)constantValue min:(NSNumber *)min max:(NSNumber *)max;
- (void)setRangeWithMin:(NSNumber *)min max:(NSNumber *)max;
- (BOOL)valid:(AppMonitorMeasureValue *)measureValue;
@end
@@ -0,0 +1,61 @@
//
// AppMonitorMeasureSet.h
// AppMonitor
//
// Created by christ.yuj on 15/2/15.
// Copyright (c) 2015年 君展. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "AppMonitorMeasure.h"
#import "AppMonitorMeasureValueSet.h"
@interface AppMonitorMeasureSet : NSObject
/**
* 根据列表初始化指标集合对象
*
* @param array NSString类型的数组 string为Name;
* @return
*/
+ (instancetype)setWithArray:(NSArray *)array;
- (BOOL)valid:(NSString*)module MonitorPoint:(NSString*)monitorpoint measureValues:(AppMonitorMeasureValueSet *)measureValues;
/**
* 增加指标
*
* @param measure 指标对象
* @return
*/
- (void)addMeasure:(AppMonitorMeasure *)measure;
/**
* 增加指标对象
*
* @param name 指标名称
* @return
*/
- (void)addMeasureWithName:(NSString *)name;
/**
* 获取指标对象
*
* @param name 指标名称
* @return
*/
- (AppMonitorMeasure *)measureForName:(NSString *)name;
/**
* 获取指标对象的列表
*
* @return
*/
- (NSMutableOrderedSet *)measures;
/**
* 设置定值维度
*
* @param measureValues key为指标名称,value为内容
*/
- (void)setConstantValue:(AppMonitorMeasureValueSet *)measureValues;
@end
@@ -0,0 +1,33 @@
//
// AppMonitorMeasureValue.h
// AppMonitor
//
// Created by christ.yuj on 15/2/15.
// Copyright (c) 2015年 君展. All rights reserved.
//
#import <Foundation/Foundation.h>
/**
* 监控指标值
*
*/
@interface AppMonitorMeasureValue : NSObject
/**
* 耗时操作是否已经完成
*/
@property (nonatomic, assign) BOOL isFinish;
@property (nonatomic, strong) NSNumber * offset;
@property (nonatomic, strong) NSNumber * value;
- (instancetype)initWithValue:(NSNumber *)value;
- (instancetype)initWithValue:(NSNumber *)value offset:(NSNumber *)offset;
- (void)merge:(AppMonitorMeasureValue *)measureValue;
//为了json序列化
- (NSDictionary *)jsonDict;
//json反序列化
- (instancetype)initWithDictionary:(NSDictionary *)dictionary;
@end
@@ -0,0 +1,38 @@
//
// AppMonitorMeasureValueSet.h
// AppMonitor
//
// Created by christ.yuj on 15/2/15.
// Copyright (c) 2015年 君展. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "AppMonitorMeasureValue.h"
@interface AppMonitorMeasureValueSet : NSObject<NSCopying>
- (instancetype)initWithDictionary:(NSDictionary *)dictionary;
/**
* 设置指标值
*
* @param name
* @param value
* @return
*/
- (void)setDoubleValue:(double)value forName:(NSString *)name;
- (void)setValue:(AppMonitorMeasureValue *)value forName:(NSString *)name;
- (BOOL)containValueForName:(NSString *)name;
- (AppMonitorMeasureValue *)valueForName:(NSString *)name;
/**
* 合并指标
*
* @param measureValueSet 目标指标集合
* 发现相同的name就对MeasureValue做加操作
*/
- (void)merge:(AppMonitorMeasureValueSet*)measureValueSet;
- (NSDictionary *)jsonDict;
@end
@@ -0,0 +1,117 @@
//
// AppMonitorStat.h
// AppMonitor
//
// Created by christ.yuj on 15/3/10.
// Copyright (c) 2015年 君展. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "AppMonitorBase.h"
#import "AppMonitorMeasureSet.h"
#import "AppMonitorDimensionSet.h"
@interface AppMonitorStatTransaction :NSObject
- (void)beginWithMeasureName:(NSString *)measureName;
- (void)endWithMeasureName:(NSString *)measureName;
@end
@interface AppMonitorStat : AppMonitorBase
/**
* 注册性能埋点
* @param module 模块
* @param monitorPoint 监控点
* @param measures 多指标
*/
+ (void)registerWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint measureSet:(AppMonitorMeasureSet *)measures;
/**
* 注册性能埋点
* @param module 模块
* @param monitorPoint 监控点
* @param measures 多指标
* @param dimemsions 多维度
*/
+ (void)registerWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint measureSet:(AppMonitorMeasureSet *)measures dimensionSet:(AppMonitorDimensionSet *)dimensions;
/**
* 注册性能埋点
* @param module 模块
* @param monitorPoint 监控点
* @param measures 多指标
* @param isCommitDetail 标记是否提交明细。需要提交明细时设置为YES,否则为NO
*/
+ (void)registerWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint measureSet:(AppMonitorMeasureSet *)measures isCommitDetail:(BOOL)detail;
/**
* 注册性能埋点
* @param module 模块
* @param monitorPoint 监控点
* @param measures 多指标
* @param dimemsions 多维度
* @param isCommitDetail 标记是否提交明细。需要提交明细时设置为YES,否则为NO
*/
+ (void)registerWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint measureSet:(AppMonitorMeasureSet *)measures dimensionSet:(AppMonitorDimensionSet *)dimensions isCommitDetail:(BOOL)detail;
/**
* 提交多维度,多指标
* @param module 监控模块
* @param monitorPoint 监控点名称 Page+monitorPoint必须唯一
* @param dimensionValues 维度值集合
* @param measureValues 指标值集合
*/
+ (void)commitWithModule:(NSString*) module monitorPoint:(NSString *)monitorPoint dimensionValueSet:(AppMonitorDimensionValueSet *)dimensionValues measureValueSet:(AppMonitorMeasureValueSet *)measureValues;
/**
* 提交多维度单指标
* @param module 监控模块
* @param monitorPoint 监控点名称 Page+monitorPoint必须唯一
* @param dimensionValues 维度值集合
* @param value 指标值
*/
+ (void)commitWithModule:(NSString*) module monitorPoint:(NSString *)monitorPoint dimensionValueSet:(AppMonitorDimensionValueSet *)dimensionValues value:(double)value;
/**
* 提交单指标
* @param module 监控模块
* @param monitorPoint 监控点名称 Page+monitorPoint必须唯一
* @param value 指标值
*/
+ (void)commitWithModule:(NSString*) module monitorPoint:(NSString *)monitorPoint value:(double)value;
/**
*开始事件,适合不存在并发的跨多线程事件(比如常见的UI加载渲染)<br/>
*如果事件跨多线程多并发执行,请使用beginTransaction-endTransaction方法对,此场景较少见
* @param module 监控模块
* @param monitorPoint 监控点名称 module+monitorPoint必须唯一
*/
+ (void)beginWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint measureName:(NSString *)measureName;
/**
*结束事件,适合不存在并发的跨多线程事件(比如常见的UI加载渲染)<br/>
*如果事件跨多线程多并发执行,请使用beginTransaction-endTransaction方法对,此场景较少见
* @param module 监控模块
* @param monitorPoint 监控点名称 module+monitorPoint必须唯一
*/
+ (void)endWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint measureName:(NSString *)measureName;
/**
* 埋点事务,可以通过调用事务的begin-end方法对来统计耗时指标的值
*
* @param module 模块
* @param monitorPoint 监控点
* @return 返回埋点事务实例
*/
+ (AppMonitorStatTransaction *)createTransactionWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint;
@end
@@ -0,0 +1,56 @@
//
// AppMonitorStat2.h
// AppMonitor
//
// Created by sugar on 7/8/15.
// Copyright (c) 2015 君展. All rights reserved.
//
#import <Foundation/Foundation.h>
/////////////////////////////////////////////////////////
// 数据格式以下图为例:
// 启动性能 - 启动时间监控
// 启动方式 | cpu | 机型 | 网络类型| 总计
// ----------------------------------
// 冷启动耗时 |arm7 | 4s | 2G | 5s (约束2-10
// 热启动耗时 |arm7s| 5s | 4G | 3s (约束1-3
// step 1: 创建一个模块空间;monitorForScheme
// step 2: 在空间下面创建表
// step 3: 添加对应的值的约束,不在约束范围内的点将一噪点方式上报
// step 4: 更新表数据
//
/////////////////////////////////////////////////////////
@interface AppMonitorTable : NSObject
// BEGIN Add by 玄叶
+ (void)registerWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint columns:(NSArray *)cols rows:(NSArray * )rows aggregate:(BOOL)aggregate;
+ (void)addConstraintWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint name:(NSString *)name min:(double)min max:(double)max defaultValue:(double)value;
+ (BOOL)commitWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint columns:(NSDictionary *)cols rows:(NSDictionary *)rows;
// END
// 创建一个表的模块空间
+ (instancetype)monitorForScheme:(NSString *)scheme tableName:(NSString *)tableName;
// 新建一张表, 行,列,数据是否聚合
- (void)registerTableWithRows:(NSArray * )rows columns:(NSArray *)cols aggregate:(BOOL)yn;
// 添加约束
- (void)addConstraintWithName:(NSString *)name range:(NSRange)range defaultValue:(NSNumber *)number;
// 添加约束
- (void)addConstraintWithName:(NSString *)name min:(double)min max:(double)max defaultValue:(double)value;
// 更新表 行的名字,列的名字,行的数据,列的数据
- (BOOL)updateTableForColumns:(NSDictionary *)cols rows:(NSDictionary *)rows;
// 更新表,不区分行列名字。此接口不允许行列同名,性能偏低,慎用!
- (BOOL)updateTableWithDictionary:(NSDictionary *)dict;
@end
@@ -0,0 +1,29 @@
//
// UT.h
// miniUTSDK
//
// Created by 宋军 on 15/5/19.
// Copyright (c) 2015年 ___SONGJUN___. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface UT : NSObject
////=====================================h5&Native接口=====================================
/**
* @brief h5&Native打通
*
* @warning 调用说明:由windwave封装,供aplus_wap.js调用
*
*
*
* @param dataDict aplus_wap.js采集的h5信息都通过该字典传进来,该字典中必须有key(funcType)
* 用来区分采集的是哪个事件信息,比如funcType=2001,则h5UT内部会调用
* pageEnter来处理,funcType=2101,则调用ctrlClicked处理
*
*/
+(void) h5UT:(NSDictionary *) dataDict view:(UIView *) pView viewController:(UIViewController *) pViewController;
@end
@@ -0,0 +1,145 @@
//
// UTAnalytics.h
// miniUTInterface
//
// Created by 宋军 on 14-10-14.
// Copyright (c) 2014年 ___SONGJUN___. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "UTTracker.h"
#import "UTIRequestAuthentication.h"
#import "UTICrashCaughtListener.h"
@interface UTAnalytics : NSObject
+ (void) turnOnDev2;
/**
* 单例初始化时,不再会从安全图片和指令plist读取appkey
*
* @return 返回UTAnalytics单例
*
*/
+(UTAnalytics *) getInstance;
/**
* 老接口兼容:接口方式设置主app级appkey/appsecret对
* 重复设置抛异常
*
* @param appKey 主app级的appkey
*
* @param secret 主app级的appsecret
*
*/
- (void)setAppKey:(NSString *)appKey secret:(NSString *)secret;
/**
* 新接口1:从安全图片读取出appkey后,塞給ut,作为主app级的appkey
* 重复设置抛异常
*
* @param appKey 主app级的appkey
*
* @param authocode 多图片时的后缀;为nil时,对应默认图片
*
*/
- (void)setAppKey4APP:(NSString *)appKey authcode:(NSString *)authcode;
/**
* 新接口2:接口方式设置SDK级appkey/appsecret对
* !!!请注意:只设置了SDK级appkey,埋点方法(UTTracker *) getTracker:(NSString *) pTrackId将不起作用
* !!!请注意:一定要先设置了主app级appkey,埋点方法(UTTracker *) getTracker:(NSString *) pTrackId才会作用
*
* @param appKey SDK级的appkey
*
* @param secret SDK级的appsecret
*
*/
- (void)setAppKey4SDK:(NSString *)appKey secret:(NSString *)secret;
/**
* 新接口3:从安全图片读取出appkey后,塞給ut,作为SDK级的appkey
* !!!请注意:只设置了SDK级appkey,埋点方法(UTTracker *) getTracker:(NSString *) pTrackId将不起作用
* !!!请注意:一定要先设置了主app级appkey,埋点方法(UTTracker *) getTracker:(NSString *) pTrackId才会作用
*
* @param appKey SDK级的appkey
*
* @param authocode 多图片时的后缀;为nil时,对应默认图片
*
*/
- (void)setAppKey4SDK:(NSString *)appKey authcode:(NSString *)authcode;
+ (void)setDailyEnvironment __deprecated;
/**
* 老接口:对主app级的appkey设置appversion
*
* @param pAppVersion app级的appversion
*
*/
-(void) setAppVersion:(NSString *) pAppVersion;
-(void) setChannel:(NSString *) pChannel;
-(void) updateUserAccount:(NSString *) pNick userid:(NSString *) pUserId;
-(void) userRegister:(NSString *) pUsernick;
-(void) updateSessionProperties:(NSDictionary *) pDict;
/**
* 老接口兼容:获取默认的UTTracker.
* 如果设置了app级的appkey,默认的tracker对应app级的生产者
* 如果只设置了sdk级的appkey,默认的tracker为空,返回第一个设置appkey的对应生产者
*
* @return 默认的UTTracker
*
*/
-(UTTracker *) getDefaultTracker;
/**
* 老接口兼容:返回trackid对应的UTTracker.
* 只能已经设置主app级appkey的前提下,才能有效设置并返回
*
* @param pTrackId 主app级的trackid
*
* @return 返回trackid对应的UTTracker
*
*/
-(UTTracker *) getTracker:(NSString *) pTrackId;
/**
* 新接口:获取sdk级对应的UTTracker.
* 只有已经设置对应的sdk级的appkey的前提下,才能有效返回
*
* @param pAppkey SDK级的appkey
*
* @return sdk级对应的UTTracker
*
*/
-(UTTracker *) getTracker4SDK:(NSString *) pAppkey;
-(void) turnOnDebug;
-(void) turnOnDev;
// 以下接口功能已废弃,接口保留
-(void) setRequestAuthentication:(id<UTIRequestAuthentication>) pRequestAuth __deprecated;
- (void)onCrashHandler;
-(void) turnOffCrashHandler;
-(void) setCrashCaughtListener:(id<UTICrashCaughtListener>) aListener;
@end
@@ -0,0 +1,16 @@
//
// BaseRequestAuthentication.h
// miniUTInterface
//
// Created by 宋军 on 14-10-17.
// Copyright (c) 2014年 ___SONGJUN___. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "UTIRequestAuthentication.h"
@interface UTBaseRequestAuthentication : NSObject<UTIRequestAuthentication>
-(id) initWithAppKey:(NSString *) pAppKey appSecret:(NSString *) pSecret;
@end
@@ -0,0 +1,19 @@
//
// UTCustomHitBuilder.h
// miniUTInterface
//
// Created by 宋军 on 14-10-17.
// Copyright (c) 2014年 ___SONGJUN___. All rights reserved.
//
#import "UTHitBuilder.h"
@interface UTCustomHitBuilder : UTHitBuilder
-(void) setEventLabel:(NSString *) pEventId;
-(void) setEventPage:(NSString *) pPageName;
-(void) setDurationOnEvent:(long long) durationOnEvent;
@end
@@ -0,0 +1,21 @@
//
// UTBaseMapBuilder.h
// miniUTInterface
//
// Created by 宋军 on 14-10-14.
// Copyright (c) 2014年 ___SONGJUN___. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface UTHitBuilder : NSObject
-(NSDictionary *) build;
-(void) setProperty:(NSString *) pKey value:(NSString *) pValue;
-(void) setProperties:(NSDictionary *) pPageProperties;
@end
@@ -0,0 +1,15 @@
//
// UTICrashCaughtListener.h
// miniUTInterface
//
// Created by 宋军 on 14/10/28.
// Copyright (c) 2014年 ___SONGJUN___. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol UTICrashCaughtListener <NSObject>
-(NSDictionary *) onCrashCaught:(NSString *) pCrashReason CallStack:(NSString *)callStack;
@end
@@ -0,0 +1,17 @@
//
// IRequestAuthentication.h
// miniUTInterface
//
// Created by 宋军 on 14-10-17.
// Copyright (c) 2014年 ___SONGJUN___. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol UTIRequestAuthentication <NSObject>
-(NSString *) getAppKey;
-(NSString *) getSign:(NSString*) pToBeSignStr;
@end
@@ -0,0 +1,25 @@
//
// UTOirginalCustomHitBuilder.h
// miniUTInterface
//
// Created by 宋军 on 14/10/28.
// Copyright (c) 2014年 ___SONGJUN___. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "UTHitBuilder.h"
@interface UTOirginalCustomHitBuilder : UTHitBuilder
-(void) setPageName:(NSString *) pPage;
-(void) setEventId:(NSString *) pEventId;
-(void) setArg1:(NSString *) pArg1;
-(void) setArg2:(NSString *) pArg2;
-(void) setArg3:(NSString *) pArg3;
-(void) setArgs:(NSDictionary *) pArgs;
@end
@@ -0,0 +1,19 @@
//
// UTMapBuilder.h
// miniUTInterface
//
// Created by 宋军 on 14-10-14.
// Copyright (c) 2014年 ___SONGJUN___. All rights reserved.
//
#import "UTHitBuilder.h"
@interface UTPageHitBuilder : UTHitBuilder
-(void) setPageName:(NSString *) pPageName;
-(void) setReferPage:(NSString *) pReferPageName;
-(void) setDurationOnPage:(long long ) durationTimeOnPage;
@end
@@ -0,0 +1,16 @@
//
// SecuritySDKRequestAuthentication.h
// miniUTInterface
//
// Created by 宋军 on 14-10-17.
// Copyright (c) 2014年 ___SONGJUN___. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "UTIRequestAuthentication.h"
@interface UTSecuritySDKRequestAuthentication : NSObject<UTIRequestAuthentication>
-(id) initWithAppKey:(NSString *) pAppKey;
@end
@@ -0,0 +1,24 @@
//
// UTTeamWork.h
// UTMini
//
// Created by ljianfeng on 2019/9/29.
// Copyright © 2019 alibaba. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface UTTeamWork : NSObject
/**
* @brief 自定义https上传域名
*
* @param url 指定的https上传域名,比如以https://开头
*
* @warning 调用说明:需要在初始化UT之前调用(setAppkey之前)
*/
+ (void)setHttpsUploadUrl:(NSString *)url;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,143 @@
//
// UTTracker.h
// miniUTInterface
//
// Created by 宋军 on 14-10-14.
// Copyright (c) 2014年 ___SONGJUN___. All rights reserved.
//
#import <Foundation/Foundation.h>
//#import <UIKit/UIViewController.h>
//#import <UIKit/UIWebView.h>
@class UTDSDKInfo;
typedef enum _UTPageStatus{
UT_H5_IN_WebView//设置容器中的H5页面事件的eventid为2001,不设置默认为2006
} UTPageStatus;
@interface UTTracker : NSObject
@property (readonly,copy) UTDSDKInfo * mSdkinfo;
-(id) initWithTrackId:(NSString *) pTrackId __deprecated;
-(id) initWithAppKey:(NSString *) pAppkey
appsecret:(NSString *) pAppSecret
authcode:(NSString *) pAuthCode
securitySign:(BOOL) securitySign;
-(id) initWithTracker:(UTTracker *) pTracker trackid:(NSString *) pTrackId;
-(NSString *) getAppKey;
-(void) setGlobalProperty:(NSString *) pKey value:(NSString *) pValue;
-(void) removeGlobalProperty:(NSString *) pKey;
-(NSString *) getGlobalProperty:(NSString *) pKey;
-(void) send:(NSDictionary *) pLogDict;
#pragma mark 页面埋点
/**
* @brief 页面进入.
*
* @param pPageObject 页面对象,如viewcontroller指针
*
* @warning 调用说明:1.必须和pageDisAppear配对使用,否则不会成功埋点
* 2.确定页面名称优先级:updatePageName > NSStringFromClass(pObject.class)
*
* 最佳位置:若是viewcontroller页面,则需在viewDidAppear函数内调用
*/
-(void) pageAppear:(id) pPageObject;
/**
* @brief 页面进入.
*
* @param pPageObject 页面对象,如viewcontroller指针
* @param pPageName 页面名称,如Page_Detail
*
* @warning 调用说明:1.必须和pageDisAppear配对使用,否则不会成功埋点
* 2.确定页面名称优先级:updatePageName > pPageName > NSStringFromClass(pObject.class)
* 若当调用pageAppear时已知页面名称,强烈建议使用该接口
* 最佳位置:若是viewcontroller页面,则需在viewDidAppear函数内调用
*/
-(void) pageAppear:(id) pPageObject withPageName:(NSString *) pPageName;
/**
* @brief 页面离开.
*
* @param pPageObject 页面对象,如viewcontroller指针
*
* @warning 调用说明:必须和pageAppear配对使用,否则不会成功埋点
*
* 最佳位置:若是viewcontroller页面,则需在viewDidDisAppear函数内调用
*/
-(void) pageDisAppear:(id) pPageObject;
/**
* @brief 更新页面业务参数.
*
* @param pPageObject 页面对象,如viewcontroller指针
* @param pProperties 业务参数,kv对
*
* @warning 调用说明:必须在pageDisAppear之前调用
*
* 最佳位置:在pageDisAppear之前调用即可
*/
-(void) updatePageProperties:(id) pPageObject properties:(NSDictionary *) pProperties;
/**
* @brief 更新页面业务参数.
*
* @param pProperties 传给下一个页面业务参数,kv对
*
* @warning 调用说明:必须在下一个页面pageAppear之前调用,否则会携带错误
*
* 最佳位置:必须在下一个页面pageAppear之前调用
*/
-(void) updateNextPageProperties:(NSDictionary *) pProperties;
#pragma mark 页面埋点的辅助函数
/**
* @brief 更新页面名称.
*
* @param pPageObject 页面对象,如viewcontroller指针
* @param pPageName 更新后的页面名称
*
* @warning 调用说明:只有当调用pageAppear时还未知页面名称,后续可使用该接口更新
*
* 最佳位置:在pageDisAppear之前调用
*/
-(void) updatePageName:(id) pPageObject pageName:(NSString *) pPageName;
/**
* @brief 更新页面url.
*
* @param pPageObject 页面对象,如viewcontroller指针
* @param pUrl 页面对应的url
*
* @warning 调用说明:如手淘统一导航将每次页面跳转的url塞给对应的viewcontroller
*
* 最佳位置:在pageDisAppear之前调用
*/
-(void) updatePageUrl:(id) pPageObject url:(NSURL *) pUrl;
/**
* @brief 更新页面状态.
*
* @param pPageObject 页面对象,如viewcontroller指针
* @param aStatus 页面状态 enum类型
*
* @warning 调用说明:告知页面处于某些特殊的业务场景,如回退等
*
* 最佳位置:必须在pageAppear之前调用
*/
-(void) updatePageStatus:(id) pPageObject status:(UTPageStatus) aStatus;
-(void) skipPage:(id) pPageObject;
- (void) ctrlClicked:(NSString *)controlName onPage:(NSObject *) pageName args:(NSDictionary *) dict;
@end
+52
View File
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>18D109</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>UTMini</string>
<key>CFBundleIdentifier</key>
<string>com.taobao.junzhan.UTMini</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>UTMini</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>5.2.0.2-appkeys-SNAPSHOT</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>16B91</string>
<key>DTPlatformName</key>
<string>iphoneos</string>
<key>DTPlatformVersion</key>
<string>12.1</string>
<key>DTSDKBuild</key>
<string>16B91</string>
<key>DTSDKName</key>
<string>iphoneos12.1</string>
<key>DTXcode</key>
<string>1010</string>
<key>DTXcodeBuild</key>
<string>10B61</string>
<key>MinimumOSVersion</key>
<string>5.0</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
</array>
</dict>
</plist>
Binary file not shown.
+9 -8
View File
@@ -142,10 +142,11 @@ alpha:1.0]
//#define SOCKETPORT @"www.zhangxinyanv5.top"
// 云 @"app.ifish7.com"
static NSString* DOMAIN_NAME =@"app.ifish7.com";
//正式环境
#define SOCKETPORT @"app.ifish7.com"
#define JIEKOUPORT @"https://app.ifish7.com"
#define JIEKOUPORTHTTP @"https://app.ifish7.com"
#define SOCKETPORT DOMAIN_NAME
#define JIEKOUPORT [NSString stringWithFormat:@"https://%@",DOMAIN_NAME]
#define JIEKOUPORTHTTP [NSString stringWithFormat:@"https://%@",DOMAIN_NAME]
//测试环境
//#define SOCKETPORT @"test.ifish7.com:9955"
//#define JIEKOUPORT @"http://139.196.24.156:7080"
@@ -497,14 +498,14 @@ alpha:1.0]
pageSize 每页数据数量
@return <#return value description#>
*/
#define Push_Message_Url JIEKOUPORT @"/api/pageList/pushListInf.do"
#define Push_Message_Url [NSString stringWithFormat:@"%@/api/pageList/pushListInf.do",JIEKOUPORT]
//删除消息
#define Push_Message_Delete_Url JIEKOUPORT @"/api/updateUser/deleteMessages.do"
#define Push_Message_Delete_Url [NSString stringWithFormat:@"%@/api/updateUser/deleteMessages.do",JIEKOUPORT]
//绑定设备
#define Push_BindDevice_Url JIEKOUPORT @"/api/updateUser/bindDevice.do"
#define Push_BindDevice_Url [NSString stringWithFormat:@"%@/api/updateUser/bindDevice.do",JIEKOUPORT]
//用户消息已读
#define Push_Message_Readed JIEKOUPORT @"/api/updateUser/userMessageIsRead.do"
#define Push_Message_Readed [NSString stringWithFormat:@"%@/api/updateUser/userMessageIsRead.do",JIEKOUPORT]
//用户未读消息个数
#define Push_Message_UnReadCount JIEKOUPORT @"/api/updateUser/userMessageNoReadCount.do"
#define Push_Message_UnReadCount [NSString stringWithFormat:@"%@/api/updateUser/userMessageNoReadCount.do",JIEKOUPORT]
/*=====================add V4.9.8=======================================*/
#endif /* Define_h */
@@ -25,7 +25,7 @@
// CFShow((__bridge CFTypeRef)(infoDic));
NSString *app_Version=[infoDic objectForKey:@"CFBundleShortVersionString"];
NSLog(@"app_Version%@",app_Version);
app_Version=@"4.7.19";
app_Version=@"4.7.20";
NSString *versionStr = [NSString stringWithFormat:@"v%@",app_Version];
NSString *buildVersion = [infoDic objectForKey:@"CFBundleVersion"];
if (buildVersion.length > 0) {