aliyun / aliyun-log-ios-sdk Goto Github PK
View Code? Open in Web Editor NEWAliyun LOG iOS SDK
License: MIT License
Aliyun LOG iOS SDK
License: MIT License
目前3.xx版本,DestroyLogProducer会直接崩溃,发现是CFRlease(Null)问题。
XCode 10.0
OC代码集成报错dyld: Library not loaded: @rpath/libswiftCore.dylib
已按照要求确保General--Embedded Binaries中含有AliyunLOGiOS.framework以及依赖的FMDB.framework
确保Build Settings--Search Paths--Framework Search Paths中有AliyunLOGiOS.framework,FMDB.framework的文件路径
可以编译成功,运行起来就报错
上传日志并没有使用https
LogClient.swift 75行
你好,请教个问题:项目中需要上传多个埋点(topic),看代码里topic是通过LogProducerConfig实例对象设置的,那岂不是一个topic对应一个client对象了?那有100个topic就需要创建100个不同的client对象保存在一个Dictionary里,这个内存会不会太大了,有什么建议吗?
这个不是问题,是我错了😅
The documents I saw this morning and evening are totally different.
So I wonder whether the api has been frozen or will change in the future?
I hope it could comply with the rule of semver
示例代码:https://github.com/lishanxin/ReactNativeDemo0_60_6.git
在Pod上集成,pod 'AliyunLogProducer', "2.2.27",导致出现错误:
请问通过Framework的方式引用了旧版本SDK,是否提供了API获取该版本号,已尝试通过TCData sdk_version属性获取,不能获取版本号。
2018-06-14 10:33:00.934198+0800 AliYunLogsTest[22758:680818] Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}: file /BuildRoot/Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-900.0.74.1/src/swift/stdlib/public/core/ErrorType.swift, line 181
OpenTelemetryApi等动态库,有静态库吗?
为什么oc的版本跑不起来啊?
demo里面的oc版本也跑不起来了,还在维护吗?
swift 版本 无法在 client 回调中调用 self 相关字段,使用了会有标题所述错误
on_log_producer_send_done_function
let callbackFunc: on_log_producer_send_done_function = {config_name,result,log_bytes,compressed_bytes,req_id,error_message,raw_buffer,user_param in
let res = LogProducerResult(rawValue: Int(result))
let value = (res?.rawValue ?? 1)
if value != 0 { self.requestSecurityToken() } // 不能添加 self 方法 其实这个回调也没有太大意义了
}
self.client = .init(logProducerConfig: self.logConfig, callback: callbackFunc)
只有初始化client的时候有一个on_log_producer_send_done_function的回调,在这个回调里也无法区分是哪一个log,
请问如何知道每一个log是否上传成功呢?
4.3.3
Crashed: com.apple.root.default-qos
0 libsystem_kernel.dylib 0xb160 __pthread_kill + 8
1 libsystem_pthread.dylib 0x71ac pthread_kill + 268
2 libsystem_c.dylib 0x20c8c abort + 180
3 libsystem_malloc.dylib 0x1de2c malloc_vreport + 908
4 libsystem_malloc.dylib 0x1e010 malloc_report + 64
5 libsystem_malloc.dylib 0x3074 realloc + 328
6 AliyunLogProducer 0x15718 log_sdsMakeRoomFor + 166 (log_sds.c:166)
7 AliyunLogProducer 0x1596c log_sdscpylen + 318 (log_sds.c:318)
8 AliyunLogProducer 0x11bfc _copy_config_string + 54 (log_producer_config.c:54)
9 XXXX 0x6b5b0 -[SLSLogManager config] + 62 (SLSLogManager.m:62)
10 XXXX 0x6b5f4 -[SLSLogManager client] + 68 (SLSLogManager.m:68)
- (LogProducerConfig *)config {
if (!_config) {
NSString *accessKeyId = @"xxxx";
NSString *accessKeySecret = @"xxxx";
NSString *securityToken = nil;
_config = [[LogProducerConfig alloc] initWithEndpoint:@"xxxx" project:@"xxxx" logstore:@"xxxx" accessKeyID:accessKeyId accessKeySecret:accessKeySecret securityToken:securityToken];
[_config SetDropDelayLog:0];
[_config SetDropUnauthorizedLog:0];
[_config SetSource:@"xxxx"];
}
return _config;
}
XCode 10,OC&Swift混编项目。导入脚本生成的两个framework,真机上编译通过,用模拟器编译报错。形如:
'LOGClient' is unavailable: cannot find Swift declaration for this class
'LogGroup' is unavailable: cannot find Swift declaration for this class
等。
请问下,现在可以使用吗?试了下,签名错误。
error = Optional(Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “****-hangzhou.sls.aliyuncs.com” which could put your confidential information at risk." UserInfo={NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x6000029d2760>, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9843, NSErrorPeerCertificateChainKey=(
"<cert(0x7f92c3055a00) s: .log.aliyuncs.com i: GlobalSign Organization Validation CA - SHA256 - G2>",
"<cert(0x7f92c2854000) s: GlobalSign Organization Validation CA - SHA256 - G2 i: GlobalSign Root CA>"
), NSUnderlyingError=0x6000015b42a0 {Error Domain=kCFErrorDomainCFNetwork Code=-1202 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=<SecTrustRef: 0x6000029d2760>, _kCFNetwork36
36
3D
CFStreamSSLErrorOriginalValue=-9843, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9843, kCFStreamPropertySSLPeerCertificates=(
"<cert(0x7f92c3055a00) s: .log.aliyuncs.com i: GlobalSign Organization Validation CA - SHA256 - G2>",
"<cert(0x7f92c2854000) s: GlobalSign Organization Validation CA - SHA256 - G2 i: GlobalSign Root CA>"
)}}, NSLocalizedDescription=The certificate for this server is invalid. You might be connecting to a server that is pretending to be “-hangzhou.sls.aliyuncs.com” which could put your confidential information at risk., NSErrorFailingURLKey=https://-hangzhou.sls.aliyuncs.com/logstores//shards/lb, NSErrorFailingURLStringKey=https://-hangzhou.sls.aliyuncs.com/logstores/*/shards/lb, NSErrorClientCertificateStateKey=0})
版本:3.1.16
测试代码:
`
(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
[super touchesBegan:touches withEvent:event];
// 模拟栈被占用很多的情况
char cStr [100000];
NSMutableString *str = [NSMutableString new];
for (NSInteger i = 0; i < 1000000 - 1; i ++) {
[str appendString:@"1"];
}
[self convertToChar:str];
}
/// 从LogProducerClient源码复制出来的
-(char*)convertToChar:(NSString*)strtemp
{
NSUInteger len = [strtemp lengthOfBytesUsingEncoding:NSUTF8StringEncoding] + 1;
if (len > 1000000) return strdup([strtemp UTF8String]);
char cStr [len];
[strtemp getCString:cStr maxLength:len encoding:NSUTF8StringEncoding];
return strdup(cStr);
}
`
crash信息:Thread 1: EXC_BAD_ACCESS (code=1, address=0x16f5b0bf0)
当栈被占用很多的时候,
[strtemp getCString:cStr maxLength:len encoding:NSUTF8StringEncoding];
这行代码会造成坏内存访问,可能是StackOverflow了
1、下载demo
2、编译framework
3、打开demo工程,编译demo
4、提示 找不到module:No such module 'AliyunLOGiOS'
然后我自己的工程拖入你们的framework,编译能通过,但是里面的类全都不能用
环境xcode9.2,swift3.2
NSMutableDictionary *dic = [log getContent];
[dic setValue:@{@"cookie_id":@"",@"session_id":@"",@"uid":[UserService sharedService].userId} forKey:@"user"];
crash
2022-06-08 14:53:55.447649+0800xxx[10434:6860520] -[__NSDictionaryI lengthOfBytesUsingEncoding:]: unrecognized selector sent to instance 0x60000067ad00
请问,2.2.4版本
LogProducerResult res = [client AddLog:log flush:0];
NSLog(@"res %ld", res);
打印为res 0,
但是在沙盒里 找不到对应的sqlite文件。只有 .idx 和_000 结尾的两个文件。
请问哪里出错了吗?
还是不会生成sqlite文件?
是按照介绍里,初始化的SDK和config。
Error (Xcode): Undefined symbols:
66. 6s
Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)
Could not build the application for the simulator.
Error launching application on iPhone 15.
(lldb) po response
<NSHTTPURLResponse: 0x2838542a0> { URL: https://trace-logs.log-global.aliyuncs.com/logstores/prd-mobile/shards/lb } { Status Code: 400, Headers {
"Access-Control-Allow-Origin" = (
""
);
"Content-Length" = (
65
);
"Content-Type" = (
"application/json"
);
Date = (
"Fri, 15 Mar 2019 05:52:54 GMT"
);
Server = (
Tengine
);
Via = (
"cache13.l2nu20-1[44,0], cache7.cn1221[46,0]"
);
eagleid = (
77a7fa9b15526291743487054e
);
"timing-allow-origin" = (
""
);
"x-alicdn-da-ups-status" = (
"endOs,0,400"
);
"x-log-requestid" = (
5C8B3DB60216E61CF0E52807
);
} }
(lldb) po error
nil
(lldb)
linkcircle@linkcircledeMBP LogDemo % pod install
Analyzing dependencies
Downloading dependencies
Installing AliyunLogProducer (2.1.0)
[!] Error installing AliyunLogProducer
[!] /usr/bin/git clone https://github.com/aliyun/aliyun-log-ios-sdk.git /var/folders/2q/kf6k0z916s3gkzqnwxgbwty00000gn/T/d20201027-2004-1khewp0 --template= --single-branch --depth 1 --branch 2.1.0
Cloning into '/var/folders/2q/kf6k0z916s3gkzqnwxgbwty00000gn/T/d20201027-2004-1khewp0'...
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
dyld: Symbol not found: __T0BOWV
Referenced from: /Users/apple10/Library/Developer/CoreSimulator/Devices/9E85D055-4FDB-4DEE-AE35-75396B3ACE4C/data/Containers/Bundle/Application/CF6C3F15-CA79-4AEB-8FBC-20BE4FBC2C8E/GameDemo.app/Frameworks/AliyunLOGiOS.framework/AliyunLOGiOS
Expected in: /Users/apple10/Library/Developer/CoreSimulator/Devices/9E85D055-4FDB-4DEE-AE35-75396B3ACE4C/data/Containers/Bundle/Application/CF6C3F15-CA79-4AEB-8FBC-20BE4FBC2C8E/GameDemo.app/Frameworks/libswiftCore.dylib
in /Users/apple10/Library/Developer/CoreSimulator/Devices/9E85D055-4FDB-4DEE-AE35-75396B3ACE4C/data/Containers/Bundle/Application/CF6C3F15-CA79-4AEB-8FBC-20BE4FBC2C8E/GameDemo.app/Frameworks/AliyunLOGiOS.framework/AliyunLOGiOS
版本号:sls-ios-sdk_v2.2.8
问题描述:发送日志失败,返回结果401,提示签名错误
hmac-sha.c文件中的hmac_sha1 函数出现问题,任何输入数据,
签名出来的数据hmac-sha1均为:\345m\241�}*F\306�$\213M\200|\355�Oe\246!R
base64后的结果为 5W2hFn0qRsYIJItNgHztEk9lpiE=
很令人费解,不知道是否是签名算法出现问题还是和别的函数、变量等有冲突。
敬请解答。
xocde升级最新的xcode10.2 不能编译通过,因为最新的SDK里有swift3的代码
我们在测试过程发现一旦字符串超过500000就会蹦在这个方法里面,我们尝试的做法是把1000000改为500000就OK了,
-(char*)convertToChar:(NSString*)strtemp
{
NSUInteger len = [strtemp lengthOfBytesUsingEncoding:NSUTF8StringEncoding] + 1;
if (len > 500000) return strdup([strtemp UTF8String]);
char cStr [len];
[strtemp getCString:cStr maxLength:len encoding:NSUTF8StringEncoding];
return strdup(cStr);
}
这里的getCString是什么作用,能否修复一下?或者提供一个好的解决方案?谢谢
logstore要传不同的行为名称,按照demo中的方式进行配置上传,导致后台统计出现窜表,一个统计行为跑到另一个统计行为的表里。
猜测出现问题的原因:项目里有很多行为可能同时上报,导致初始化完client后,还没统计上,下一个行为的client就被创建了。
因为client里要用logstore字段,没法用单例的模式。
怎么解决???
现象:LogClient使用便利方法生成对象和使用初始化方法生成对象,进行postLog时结果不同。通过便利方法生成的对象进行postLog时,请求回报错。
初步判断:LogClient的便利构造方法的token在初始化的时候会解包为空字符串而不是nil~
但在postLog方法中拼接header的时候,token的拼接是对token参数判空而不是判断字符串长度。最终导致了请求header中的字段不对。
完全编不过呀,为何这样的代码还打了 release 了。完全是半残品啊。
都定义了外部变量kReachabilityChangedNotification,编译报错
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.