ios開發:AFNetworking3+在請求頭中新增UserAgent方法
阿新 • • 發佈:2019-02-03
找到檔案: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"];