chengyanfang

fix

Showing 26 changed files with 893 additions and 0 deletions
No preview for this file type
This file is too large to display.
/*
* 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 = @"1.17.3";
#import <Foundation/Foundation.h>
#import "HttpdnsLoggerDelegate.h"
#import "HttpdnsServiceProvider.h"
#import "HttpdnsDegradationDelegate.h"
... ...
/*
* 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 */
... ...
//
// 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 */
... ...
/*
* 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)))
@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;
- (void)setCachedIPEnabled:(BOOL)enable;
- (void)setPreResolveHosts:(NSArray *)hosts;
- (NSString *)getIpByHostAsync:(NSString *)host;
- (NSArray *)getIpsByHostAsync:(NSString *)host;
- (NSString *)getIpByHostAsyncInURLFormat:(NSString *)host;
- (void)setHTTPSRequestEnabled:(BOOL)enable;
- (void)setExpiredIPEnabled:(BOOL)enable;
- (void)setLogEnabled:(BOOL)enable;
- (void)setPreResolveAfterNetworkChanged:(BOOL)enable;
- (void)setIPRankingDatasource:(NSDictionary<NSString *, NSNumber *> *)IPRankingDatasource;
- (void)setLogHandler:(id<HttpdnsLoggerProtocol>)logHandler;
- (NSString *)getSessionId;
- (void)enableIPv6:(BOOL)enable;
- (NSString *)getIPv6ByHostAsync:(NSString *)host;
@end
@interface HttpDnsService (HttpdnsDeprecated)
- (void)setAccountID:(int)accountID ALICLOUD_HTTPDNS_DEPRECATED("Deprecated in v1.5.2. Use -[HttpDnsService initWithAccountID:] instead.");
@end
... ...
framework module AlicloudHttpDNS {
umbrella header "AlicloudHttpDNS.h"
export *
module * { export * }
}
... ...
//
// 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
... ...
//
// 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
... ...
//
// 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
... ...
//
// 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 */
... ...
/*
* 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 */
... ...
//
// 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
... ...
//
// 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 */
... ...
//
// 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 */
... ...
//
// 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 */
... ...
//
// 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.6"
// 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>
... ...
//
// 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"
... ...
//
// 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 */
... ...
//
// 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 *httpdnsAccountId;
@property (nonatomic, copy, readonly) NSString *httpdnsSecretKey;
+ (EMASOptions *)defaultOptions;
- (NSString *)optionByConfigKey:(NSString *)key;
- (EMASOptionSDKServiceItem *)sdkServiceItemForSdkId:(NSString *)sdkId;
@end
#endif /* EMASOptions_h */
... ...
//
// 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 */
... ...
//
// 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 */
... ...
//
// 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 */
... ...
//
// 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 */
... ...
framework module AlicloudUtils {
umbrella header "AlicloudUtils.h"
export *
module * { export * }
}
... ...