本文主要是介绍ios开发:AFNetworking3+在请求头中添加UserAgent方法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
找到文件:AFURLRequestSerialization.m
搜索"userAgent"所在位置, 然后修改即可
userAgent = [NSString stringWithFormat:@"%@/%@ (%@ %@; Apple x64; JpushToken %@; uniqueId %@; source AppStore) ooyby/%@", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[UIDevice currentDevice] systemName], [[UIDevice currentDevice] systemVersion],[JPUSHService registrationID],[JPUSHService registrationID],@"20170630"];
这篇关于ios开发:AFNetworking3+在请求头中添加UserAgent方法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!