2130 lines
91 KiB
Objective-C
Executable File
2130 lines
91 KiB
Objective-C
Executable File
//
|
||
// NewRootVC.m
|
||
// msext
|
||
//
|
||
// Created by chao on 2017/8/22.
|
||
// Copyright © 2017年 chao. All rights reserved.
|
||
//
|
||
|
||
#import "NewRootVC.h"
|
||
#import "WXApiManager.h"
|
||
#import "WXApiRequestHandler.h"
|
||
#import "NSString+SBJSON.h"
|
||
#import "SBJSON.h"
|
||
#import <WebKit/WebKit.h>
|
||
#import <AVFoundation/AVFoundation.h>
|
||
#import <AudioToolbox/AudioToolbox.h>
|
||
#import "AFNetworking.h"
|
||
#import "GDataXMLNode.h"
|
||
#import "ASIHTTPRequest.h"
|
||
#import "ZipArchive.h"
|
||
#import "threeView.h"
|
||
#import <AMapLocationKit/AMapLocationKit.h>
|
||
#import "VoiceConverter.h"
|
||
#import "ChatVoiceRecorderVC.h"
|
||
#import <Bugly/Bugly.h>
|
||
#import "Reachability.h"
|
||
#import "WebViewJavascriptBridge.h"
|
||
#import "gameController.h"
|
||
#import <CoreTelephony/CTCall.h>
|
||
#import <CoreTelephony/CTCallCenter.h>
|
||
#import <CoreTelephony/CTCarrier.h>
|
||
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
|
||
#import "AppDelegate.h"
|
||
#import <AdSupport/ASIdentifierManager.h>
|
||
#import "XianliaoApiManager.h"
|
||
#import "versionConfig.h"
|
||
|
||
#define DefaultLocationTimeout 10
|
||
#define DefaultReGeocodeTimeout 5
|
||
@interface NewRootVC ()
|
||
<WKNavigationDelegate,WXApiManagerDelegate,VoiceRecorderBaseVCDelegate,AVAudioPlayerDelegate,ASIHTTPRequestDelegate,AMapLocationManagerDelegate,UIActionSheetDelegate>
|
||
{
|
||
WKWebView *_webView;
|
||
NSString *versionURL;
|
||
AVAudioPlayer *backgroundPlayer;
|
||
AVAudioPlayer *buttunPlayer;
|
||
AVAudioPlayer *voicePlayer;
|
||
SystemSoundID sound;
|
||
ChatVoiceRecorderVC *recorderVC;
|
||
NSURLSessionDownloadTask *_downloadTask;
|
||
UIImageView *imageView, *proimageView,*background;
|
||
UILabel *prolabel,*prolabeltwo;
|
||
UIProgressView *pro_Download;
|
||
NSProgress *pro;
|
||
BOOL canshake,canvoice;
|
||
NSString *downLoadfile;
|
||
BOOL firsttime,canbofang,first_Time,Nothere,one_Time;
|
||
BOOL alertCan;
|
||
NSTimer *timer,*timertwo;
|
||
}
|
||
@property (copy, nonatomic) NSString *weburl;
|
||
@property (copy, nonatomic) NSString *iosNumber;
|
||
@property (strong, nonatomic) NSString *recordFileName,*recordFilePath;
|
||
@property (copy, nonatomic) NSString *originWav;
|
||
@property (copy, nonatomic) NSString *backgroundType;
|
||
@property (copy, nonatomic) NSString *User_id,*UserType;
|
||
@property (copy, nonatomic) NSString *agentinfo,*gameinfo;
|
||
@property (copy, nonatomic) NSString *versioninfo,*channel_id,*tuiguang_id;
|
||
@property (copy, nonatomic) NSArray *agentlist,*gamelist;
|
||
|
||
@property (copy, nonatomic) NSDictionary *magentlist,*mgamelist;
|
||
|
||
@property (nonatomic) BOOL callWasStarted;
|
||
@property (nonatomic, strong) AMapLocationManager *locationManager;
|
||
@property (nonatomic, copy) AMapLocatingCompletionBlock completionBlock;
|
||
@property (nonatomic) int netstate;
|
||
@property (copy, nonatomic) NSString *showmessage;
|
||
@property (copy, nonatomic) NSString *market,*version_ios,*game_version_,*game_zip_;
|
||
@property (copy, nonatomic) NSString *gamedir,*gamestart,*gameconfig;
|
||
@property WebViewJavascriptBridge* bridge;
|
||
@property (nonatomic, strong) CTCallCenter *callCenter;
|
||
|
||
|
||
|
||
@end
|
||
|
||
@implementation NewRootVC
|
||
|
||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
|
||
{
|
||
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
||
if (self) {
|
||
// Custom initialization
|
||
self.view.backgroundColor=[UIColor colorWithRed:255.0f/255 green:255.0f/255 blue:255.0f/255 alpha:1.0f];
|
||
}
|
||
return self;
|
||
}
|
||
/* system class */
|
||
|
||
-(void) viewDidAppear:(BOOL)animated
|
||
{
|
||
}
|
||
-(BOOL)canBecomeFirstResponder
|
||
{
|
||
return YES;
|
||
}
|
||
-(void)noterecord:(NSString *)errormsg user:(NSString *)userid agent:(NSString *)agentid game:(NSString *)gameid {
|
||
NSString *urlStr=[NSString stringWithFormat:@"http://ylyxservice1.0791ts.cn:1089/index.html?{\"data\": {\"agentid\": \"%@\",\"gameid\": \"%@\",\"playerid\": \"%@\",\"msg\": \"%@\",\"packet\": \"123\"},\"app\":\"youle\",\"route\":\"agent\",\"rpc\":\"submit_error\"}",agentid,gameid,@"ios",errormsg];
|
||
urlStr=[urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||
NSURL *url=[NSURL URLWithString:urlStr];
|
||
|
||
//通过URL设置网络请求
|
||
NSURLRequest *request = [[NSURLRequest alloc]initWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10];
|
||
NSError *error=nil;
|
||
//获取服务器数据
|
||
NSData *requestData= [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:&error];
|
||
if (error) {
|
||
NSLog(@"错误信息:%@",[error localizedDescription]);
|
||
}else{
|
||
NSString *result=[[NSString alloc]initWithData:requestData encoding:NSUTF8StringEncoding];
|
||
NSLog(@"返回结果:%@",result);
|
||
}
|
||
|
||
}
|
||
|
||
|
||
-(void)initView
|
||
{
|
||
[self initJSdata];
|
||
/*
|
||
AppDelegate *appd = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
||
NSString *port = appd.port;
|
||
if (nil == port) {
|
||
NSLog(@">>> Error:端口不存在");
|
||
|
||
}
|
||
NSString *str = [NSString stringWithFormat:@"http://localhost:%@", port];
|
||
NSURL *url = [NSURL URLWithString:str];
|
||
NSURLRequest *request = [NSURLRequest requestWithURL:url];
|
||
|
||
WKWebViewConfiguration *config = [WKWebViewConfiguration new];
|
||
//初始化偏好设置属性:preferences
|
||
config.preferences = [WKPreferences new];
|
||
//The minimum font size in points default is 0;
|
||
config.preferences.minimumFontSize = 10;
|
||
//是否支持JavaScript
|
||
config.preferences.javaScriptEnabled = YES;
|
||
//不通过用户交互,是否可以打开窗口
|
||
config.preferences.javaScriptCanOpenWindowsAutomatically = NO;
|
||
|
||
WKWebView* _webView12 = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, DEVW, DEVH) configuration:config];
|
||
_webView12.backgroundColor = [UIColor lightGrayColor];
|
||
[self.view addSubview:_webView12];
|
||
_webView12.navigationDelegate = self;
|
||
[_webView12 loadRequest:request];
|
||
|
||
return;
|
||
*/
|
||
// Do any additional setup after loading the view from its nib.
|
||
@try{
|
||
NSString *filePath=[FuncPublic getFilePath:[NSString stringWithFormat:@"%@/%@/index.html",self.gamedir,self.gamestart] PathType:2];
|
||
NSURL *url = [NSURL fileURLWithPath:filePath];
|
||
[_webView loadFileURL:url allowingReadAccessToURL:[NSURL fileURLWithPath:[FuncPublic getFilePath:[NSString stringWithFormat:@"%@/%@",self.gamedir,self.gamestart] PathType:2]]];
|
||
} @catch (NSException * e) {
|
||
NSLog(@"Exception: %@", e);
|
||
}
|
||
|
||
}
|
||
- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation {
|
||
NSLog(@"webViewDidStartLoad");
|
||
}
|
||
|
||
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {
|
||
NSLog(@"webViewDidFinishLoad");
|
||
|
||
if(prolabel!=nil)
|
||
{
|
||
[UIView beginAnimations:@"FrameAni"context:nil];
|
||
[UIView setAnimationDuration:0.5];
|
||
[UIView setAnimationDelegate:self];
|
||
// [UIViewsetAnimationWillStartSelector:@selector(startAni:)];
|
||
[UIView setAnimationDidStopSelector:@selector(stopAni:)];
|
||
[UIView setAnimationRepeatCount:1];
|
||
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
|
||
proimageView.alpha=0;
|
||
prolabel.alpha=0;
|
||
[UIView commitAnimations];
|
||
}
|
||
}
|
||
-(void)stopAni:(NSString*)aniID{
|
||
NSLog(@"%@stop",aniID);
|
||
[prolabel removeFromSuperview];
|
||
[prolabeltwo removeFromSuperview];
|
||
[proimageView removeFromSuperview];
|
||
}
|
||
- (void)didReceiveMemoryWarning {
|
||
[super didReceiveMemoryWarning];
|
||
// Dispose of any resources that can be recreated.
|
||
// [FuncPublic ShowAlert:@"系统内存不够,请清理应用数据,或者重启应用"];
|
||
}
|
||
//支持的方向 因为界面A我们只需要支持竖屏
|
||
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
|
||
return UIInterfaceOrientationMaskLandscape;
|
||
}
|
||
-(BOOL)shouldAutorotate{
|
||
return YES;
|
||
}
|
||
//当前viewcontroller默认的屏幕方向 - 横屏显示
|
||
|
||
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
|
||
|
||
return UIInterfaceOrientationLandscapeRight;
|
||
|
||
}
|
||
-(void)dealloc
|
||
{
|
||
|
||
}
|
||
-(void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler
|
||
{
|
||
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"alert"message:@"JS调用alert"preferredStyle:UIAlertControllerStyleAlert];
|
||
[alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { }]];
|
||
[self presentViewController:alert animated:YES completion:NULL];
|
||
NSLog(@"%@", message);
|
||
}
|
||
-(void)canbackone
|
||
{
|
||
one_Time=YES;
|
||
}
|
||
- (void)viewDidLoad {
|
||
if([[[UIDevice currentDevice] systemVersion] floatValue]>=7.0) {
|
||
self.edgesForExtendedLayout = UIRectEdgeNone;
|
||
}
|
||
[super viewDidLoad];
|
||
self.gamedir= [FuncPublic filename:@"gamedir"];
|
||
self.gameconfig= [FuncPublic filename:@"gameconfig"];
|
||
self.gamestart= [FuncPublic filename:@"gamestart"];
|
||
self.tuiguang_id= [FuncPublic filename:@"tuiguang"];
|
||
self.channel_id= [FuncPublic filename:@"channel"];
|
||
self.agentinfo= [FuncPublic filename:@"agent"];
|
||
self.iosNumber=[FuncPublic filename:@"appversion"];
|
||
self.gameinfo=[FuncPublic filename:@"gameid"];
|
||
self.market= [FuncPublic filename:@"market"];
|
||
|
||
// [FuncPublic ShowAlert:self.tuiguang_id];
|
||
|
||
//[FuncPublic ShowAlert:@"进入viewDidLoad"];
|
||
//self.gameconfig=[self.gameconfig stringByReplacingOccurrencesOfString:@"-" withString:@"/"];
|
||
self.weburl=[NSString stringWithFormat:@"http://%@.txt",[self.gameconfig stringByReplacingOccurrencesOfString:@"-" withString:@"/"]];
|
||
|
||
|
||
[UIApplication sharedApplication].idleTimerDisabled=YES;
|
||
|
||
firsttime=YES; first_Time=YES; canbofang=YES;one_Time=YES;alertCan=YES;
|
||
_webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0,DEVW ,DEVH )];
|
||
_webView.navigationDelegate = self;
|
||
[self.view addSubview: _webView];
|
||
if (@available(ios 11.0,*))
|
||
{
|
||
UIScrollView.appearance.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||
_webView.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||
}
|
||
[WebViewJavascriptBridge enableLogging];
|
||
_bridge = [WebViewJavascriptBridge bridgeForWebView:_webView];
|
||
[_bridge setWebViewDelegate:self];
|
||
[_bridge registerHandler:@"accreditlogin" handler:^(id data, WVJBResponseCallback responseCallback) {
|
||
[WXApiRequestHandler sendAuthRequestScope: kAuthScope State:kAuthState OpenID:kAuthOpenID InViewController:self];
|
||
responseCallback(@"Response from accreditlogin");
|
||
}];
|
||
[_bridge registerHandler:@"srcIsloop" handler:^(id data, WVJBResponseCallback responseCallback) {
|
||
NSLog(@"Callback called: %@", data);
|
||
NSString *message2=[data objectForKey:@"isloop"];
|
||
NSString *message=[data objectForKey:@"src"];
|
||
NSURL *url_=nil;
|
||
NSString * string=[FuncPublic getFilePath:[NSString stringWithFormat:@"%@/%@/assets/wav/%@",self.gamedir,self.gamestart,message] PathType:2];
|
||
url_=[NSURL URLWithString:string];
|
||
|
||
if([message2 intValue]==0)
|
||
{
|
||
buttunPlayer = [[AVAudioPlayer alloc]initWithContentsOfURL:url_ error:Nil];
|
||
[buttunPlayer prepareToPlay];
|
||
[buttunPlayer play];
|
||
return ;
|
||
}
|
||
if([message2 intValue]==1)
|
||
{
|
||
self.backgroundType=message;
|
||
if (backgroundPlayer!=nil) {
|
||
[backgroundPlayer stop];
|
||
backgroundPlayer = nil;
|
||
}
|
||
backgroundPlayer = [[AVAudioPlayer alloc]initWithContentsOfURL:url_ error:Nil];
|
||
backgroundPlayer.delegate = self;
|
||
[backgroundPlayer prepareToPlay];
|
||
backgroundPlayer.numberOfLoops = -1;
|
||
[backgroundPlayer play];
|
||
|
||
}
|
||
if([message2 intValue]==-1)
|
||
{
|
||
if ([self.backgroundType isEqualToString:message]) {
|
||
if (backgroundPlayer!=nil) {
|
||
[backgroundPlayer stop];
|
||
backgroundPlayer = nil;
|
||
}
|
||
}
|
||
}
|
||
responseCallback(@"Response from srcIsloop");
|
||
}];
|
||
[_bridge registerHandler:@"prepareaudio" handler:^(id data, WVJBResponseCallback responseCallback) {
|
||
NSLog(@"Callback called: %@", data);
|
||
self.originWav =[VoiceRecorderBaseVC getCurrentTimeString];//[dateformat stringFromDate:[NSDate date]];//
|
||
if([FuncPublic ifauth]==0)
|
||
{
|
||
NSString* runJS=[NSString stringWithFormat:@"%@需要访问您的麦克风,请启用麦克风-设置/隐私/麦克风!",gamehallname];
|
||
[FuncPublic ShowAlert:runJS];
|
||
return;
|
||
}
|
||
//开始录音
|
||
[recorderVC beginRecordByFileName:self.originWav];
|
||
responseCallback(@"Response from prepareaudio");
|
||
}];
|
||
[_bridge registerHandler:@"mediaTypeAudio" handler:^(id data, WVJBResponseCallback responseCallback) {
|
||
NSLog(@"Callback called: %@", data);
|
||
NSString *url=[data objectForKey:@"audiourl"];
|
||
// NSString *history=[data objectForKey:@"type"];
|
||
NSString *userid=[data objectForKey:@"user"];
|
||
self.User_id=userid;
|
||
self.recordFileName = [FuncPublic GetCurrentTimeString];
|
||
NSURL *urlPath = [NSURL URLWithString:url];
|
||
NSData *data_url = [NSData dataWithContentsOfURL:urlPath];
|
||
NSString *filename = [FuncPublic GetPathByFileName:self.recordFileName ofType:@"amr"];
|
||
[data_url writeToFile: filename atomically: NO];
|
||
if (![[NSFileManager defaultManager] fileExistsAtPath:filename]) {
|
||
return;
|
||
}
|
||
//获取路径
|
||
self.recordFilePath = [FuncPublic GetPathByFileName:self.recordFileName ofType:@"wav"];
|
||
|
||
NSString *convertedPath = [FuncPublic GetPathByFileName:[self.recordFileName stringByAppendingString:@"_AmrToWav"] ofType:@"wav"];
|
||
|
||
if ([VoiceConverter ConvertAmrToWav:filename wavSavePath:convertedPath]){
|
||
// [session setCategory:AVAudioSessionCategoryPlayback error:nil];
|
||
|
||
voicePlayer = [[AVAudioPlayer alloc]initWithContentsOfURL:[NSURL fileURLWithPath:convertedPath] error:Nil];
|
||
[voicePlayer prepareToPlay];
|
||
voicePlayer.delegate=self;
|
||
// voicePlayer.numberOfLoops =1;
|
||
if (canbofang) {
|
||
[voicePlayer play];
|
||
[_bridge callHandler:@"gameui_play_voice" data:[NSString stringWithFormat:@"%@",self.User_id] ];
|
||
}
|
||
|
||
}else
|
||
NSLog(@"amr转wav失败");
|
||
responseCallback(@"Response from mediaTypeAudio");
|
||
}];
|
||
[_bridge registerHandler:@"startshake" handler:^(id data, WVJBResponseCallback responseCallback) {
|
||
canshake=YES;
|
||
responseCallback(@"startshake from accreditlogin");
|
||
}];
|
||
[_bridge registerHandler:@"stopshake" handler:^(id data, WVJBResponseCallback responseCallback) {
|
||
canshake=NO;
|
||
responseCallback(@"startshake from accreditlogin");
|
||
}];
|
||
|
||
[_bridge registerHandler:@"SwitchShake" handler:^(id data, WVJBResponseCallback responseCallback) {
|
||
int tempinfo=[data intValue];
|
||
if (tempinfo ==1)
|
||
{
|
||
canvoice=YES;
|
||
}else
|
||
{
|
||
canvoice=NO;
|
||
}
|
||
responseCallback(@"SwitchShake");
|
||
}];
|
||
[_bridge registerHandler:@"gamepastetext" handler:^(id data, WVJBResponseCallback responseCallback) {
|
||
UIPasteboard * myPasteboard = [UIPasteboard generalPasteboard];
|
||
responseCallback(myPasteboard.string);
|
||
}];
|
||
[_bridge registerHandler:@"gameCopytext" handler:^(id data, WVJBResponseCallback responseCallback) {
|
||
UIPasteboard * myPasteboard = [UIPasteboard generalPasteboard];
|
||
myPasteboard.string =[NSString stringWithFormat:@"%@",data];
|
||
responseCallback(@"gameCopytext");
|
||
}];
|
||
[_bridge registerHandler:@"OpenurlTitleData" handler:^(id data, WVJBResponseCallback responseCallback) {
|
||
NSString *url =[data objectForKey:@"url"];
|
||
NSString *title =[data objectForKey:@"title "];
|
||
NSString *data_ =[data objectForKey:@"data"];
|
||
int orientation=[[data objectForKey:@"orientation"] intValue];
|
||
if(first_Time)
|
||
{
|
||
threeView *detail = [[threeView alloc] initWithNibName:@"threeView" bundle:nil];
|
||
[detail Openurl:url Title:title Data:data_ orientation_:orientation];
|
||
[FuncPublic PushAnimation:self InsertVC:detail];
|
||
first_Time=NO;
|
||
}
|
||
[self performSelector:@selector(canopen) withObject:nil afterDelay:3.0f];
|
||
|
||
responseCallback(@"OpenurlTitleData");
|
||
}];
|
||
|
||
|
||
[_bridge registerHandler:@"browser" handler:^(id data, WVJBResponseCallback responseCallback) {
|
||
NSString *encodeUrl = [data stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",encodeUrl]]];
|
||
responseCallback(@"browser");
|
||
}];
|
||
[_bridge registerHandler:@"startlocation" handler:^(id data, WVJBResponseCallback responseCallback) {
|
||
NSLog(@"%@",data);
|
||
int tempinfo=[data intValue];
|
||
if (tempinfo ==1) {
|
||
[self.locationManager startUpdatingLocation];
|
||
}else
|
||
{
|
||
[self reGeocodeAction];
|
||
}
|
||
responseCallback(@"startlocation");
|
||
}];
|
||
|
||
|
||
[_bridge registerHandler:@"canclevibrator" handler:^(id data, WVJBResponseCallback responseCallback) {
|
||
AudioServicesDisposeSystemSoundID(kSystemSoundID_Vibrate);
|
||
responseCallback(@"canclevibrator");
|
||
}];
|
||
[_bridge registerHandler:@"vibrator" handler:^(id data, WVJBResponseCallback responseCallback) {
|
||
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
|
||
responseCallback(@"vibrator");
|
||
}];
|
||
[_bridge registerHandler:@"repeatvibrator" handler:^(id data, WVJBResponseCallback responseCallback) {
|
||
int tempinfo=[data intValue];
|
||
if (tempinfo ==-1) {
|
||
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
|
||
}else
|
||
{
|
||
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
|
||
}
|
||
responseCallback(@"repeatvibrator");
|
||
}];
|
||
[_bridge registerHandler:@"voicePlaying" handler:^(id data, WVJBResponseCallback responseCallback) {
|
||
NSLog(@"%@",data);
|
||
int tempinfo=[data intValue];
|
||
if (tempinfo ==1) {
|
||
canbofang=YES;
|
||
}else
|
||
{
|
||
canbofang=NO;
|
||
}
|
||
responseCallback(@"voicePlaying");
|
||
}];
|
||
[_bridge registerHandler:@"friendsSharetypeUrlToptitleDescript" handler:^(id data, WVJBResponseCallback responseCallback) {
|
||
NSString *one =[data objectForKey:@"sharefriend"];
|
||
NSString *sharetype =[data objectForKey:@"sharetype"];
|
||
NSString *two =[data objectForKey:@"type"];NSString *three =[data objectForKey:@"webpageUrl"];
|
||
NSString *four =[data objectForKey:@"title"];NSString *five =[data objectForKey:@"description"];
|
||
self.UserType=one;
|
||
NSLog(@"%@",two);
|
||
enum WXScene currentScene;
|
||
int friend = [one intValue];
|
||
if(friend==1)
|
||
{
|
||
currentScene=WXSceneSession;
|
||
}else
|
||
{
|
||
currentScene=WXSceneTimeline;
|
||
}
|
||
|
||
|
||
if([two intValue]==1)
|
||
{
|
||
if ([sharetype intValue]==3) {
|
||
XianliaoShareLinkObject *object = [[XianliaoShareLinkObject alloc] init];
|
||
object.title = four;
|
||
object.linkDescription = five;
|
||
object.imageData = UIImagePNGRepresentation([UIImage imageNamed:@"sharelogo.png"]);
|
||
object.url = three;
|
||
[XianliaoApiManager share:object fininshBlock:^(XianliaoShareCallBackType callBackType) {
|
||
NSLog(@"callBackType:%ld", (long)callBackType);
|
||
[_bridge callHandler:@"sharesuccess" data:@{ @"success":@"2",@"type":[NSString stringWithFormat:@"%d",[self.UserType intValue]]} ];
|
||
}];
|
||
}else{
|
||
[WXApiRequestHandler sendLinkURL:three
|
||
TagName:[NSString stringWithFormat:@"%@游戏下载链接",gamehallname]
|
||
Title:four
|
||
Description:five
|
||
ThumbImage:[UIImage imageNamed:@"sharelogo.png"]
|
||
InScene:currentScene];
|
||
}
|
||
|
||
}else if([two intValue]==2)
|
||
{
|
||
if ([sharetype intValue]==3) {
|
||
XianliaoShareImageObject *imageObject = [[XianliaoShareImageObject alloc] init];
|
||
UIImage *imageName=[FuncPublic getImageWithFullScreenshot];
|
||
NSData *dataThumbImage = UIImageJPEGRepresentation(imageName, 0.6);
|
||
imageObject.imageData = dataThumbImage;
|
||
[XianliaoApiManager share:imageObject fininshBlock:^(XianliaoShareCallBackType callBackType) {
|
||
NSLog(@"callBackType:%ld", (long)callBackType);
|
||
[_bridge callHandler:@"sharesuccess" data:@{ @"success":@"2",@"type":[NSString stringWithFormat:@"%d",[self.UserType intValue]]} ];
|
||
}];
|
||
|
||
}else{
|
||
UIImage *imageName=[FuncPublic getImageWithFullScreenshot];
|
||
NSData *dataThumbImage = UIImageJPEGRepresentation(imageName, 0.6);
|
||
[WXApiRequestHandler sendImageData:dataThumbImage
|
||
TagName:[NSString stringWithFormat:@"%@游戏截图分享",gamehallname]
|
||
MessageExt:five
|
||
Action:kMessageAction
|
||
ThumbImage:[FuncPublic imageByScalingAndCroppingForSize:CGSizeMake(imageName.size.width*0.4, imageName.size.height*0.4) image:imageName]//[UIImage imageNamed:@"sharelogo.png"]
|
||
InScene:currentScene];
|
||
}
|
||
}else
|
||
{
|
||
if ([sharetype intValue]==3) {
|
||
XianliaoShareImageObject *imageObject = [[XianliaoShareImageObject alloc] init];
|
||
imageObject.imageUrl = three;
|
||
[XianliaoApiManager share:imageObject fininshBlock:^(XianliaoShareCallBackType callBackType) {
|
||
NSLog(@"callBackType:%ld", (long)callBackType);
|
||
[_bridge callHandler:@"sharesuccess" data:@{ @"success":@"2",@"type":[NSString stringWithFormat:@"%d",[self.UserType intValue]]} ];
|
||
}];
|
||
}else
|
||
{
|
||
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:three]];
|
||
UIImage *viewImage = [UIImage imageWithData:data];
|
||
|
||
[WXApiRequestHandler sendImageData:data
|
||
TagName:[NSString stringWithFormat:@"%@公众号二维码分享",gamehallname]
|
||
MessageExt:[NSString stringWithFormat:@"%@公众号二维码分享",gamehallname]
|
||
Action:kMessageAction
|
||
ThumbImage:[FuncPublic imageByScalingAndCroppingForSize:CGSizeMake(viewImage.size.width*0.4, viewImage.size.height*0.4) image:viewImage]
|
||
InScene:currentScene];
|
||
}
|
||
}
|
||
responseCallback(@"sharefriend");
|
||
}];
|
||
|
||
//跳转子游戏
|
||
|
||
[_bridge registerHandler:@"SwitchOverGameData" handler:^(id data, WVJBResponseCallback responseCallback) {
|
||
NSLog(@"SwitchOverGameData%@",data);
|
||
NSString *directory =[data objectForKey:@"Gamedirectory"];//子游戏目录
|
||
NSString *downurl =[data objectForKey:@"gamedownloadurl"];//游戏ID
|
||
NSString *data_ =[data objectForKey:@"data"];//数据交换
|
||
if (one_Time) {
|
||
one_Time=false;
|
||
[WXApiManager sharedManager].delegate = nil;
|
||
if (backgroundPlayer) {
|
||
[backgroundPlayer stop];
|
||
backgroundPlayer = nil;
|
||
}
|
||
int result;
|
||
if ([self.version_ios intValue]>=[self.iosNumber intValue])
|
||
result=0;
|
||
else
|
||
result=1;
|
||
|
||
gameController *vcNew =[[gameController alloc] initWithNibName:@"gameController" bundle:nil];
|
||
[vcNew initinfo:directory downurl:downurl gamedata:data_ agent:self.agentinfo channel:self.channel_id market:self.market gamedir:self.gamedir agentlist:self.agentlist gamelist:self.gamelist result:result];
|
||
[FuncPublic PushAnimation:self InsertVC:vcNew];
|
||
|
||
[self performSelector:@selector(canbackone) withObject:nil afterDelay:5.0f];
|
||
}
|
||
responseCallback(@"SwitchOverGameData");
|
||
}];
|
||
[_bridge registerHandler:@"opensaoma" handler:^(id data, WVJBResponseCallback responseCallback) {
|
||
responseCallback(@"opensaoma");
|
||
}];
|
||
[_bridge registerHandler:@"getphoneInfo" handler:^(id data, WVJBResponseCallback responseCallback) {
|
||
responseCallback(@"getphoneInfo");
|
||
[self getphoneinfo];
|
||
}];
|
||
recorderVC = [[ChatVoiceRecorderVC alloc]init];
|
||
recorderVC.vrbDelegate = self;
|
||
|
||
UIImage *back=[UIImage imageNamed:@"Default-568h@2x~iphone.png"];
|
||
|
||
//远程地址
|
||
proimageView=[[UIImageView alloc]initWithImage: [UIImage imageWithCGImage:back.CGImage scale:1 orientation:UIImageOrientationLeft] ];
|
||
|
||
proimageView.frame=CGRectMake(0,0,DEVW , DEVH);
|
||
[self.view addSubview:proimageView];
|
||
|
||
prolabel=[FuncPublic InstanceLabel:@"拼命启动中..." RECT:CGRectMake(0, 20, 568, 38) RECT5:CGRectMake(0, 20, 568, 38) FontName:@"Arial-BoldMT" Red:52 green:52 blue:52 FontSize:18 Target:self.view Lines:0 TAG:-1 Ailgnment:1];
|
||
prolabel.alpha=0;
|
||
prolabeltwo=[FuncPublic InstanceLabel:@"游戏重新连接中,请稍等..." RECT:CGRectMake(0, 250, DEVW, 38) RECT5:CGRectMake(0, 250, DEVW, 38) FontName:@"Arial-BoldMT" Red:255 green:11 blue:11 FontSize:22 Target:self.view Lines:0 TAG:-1 Ailgnment:1];
|
||
prolabeltwo.alpha=0;
|
||
|
||
timer = [NSTimer scheduledTimerWithTimeInterval:4.0 target:self selector:@selector(gonet) userInfo:nil repeats:YES];
|
||
// timertwo = [NSTimer scheduledTimerWithTimeInterval:61.0 target:self selector:@selector(timeproblem) userInfo:nil repeats:NO];
|
||
|
||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(YLbackgameData:) name:@"backgameDatatwo" object:nil];
|
||
}
|
||
|
||
-(void)getphoneinfo
|
||
{
|
||
@try{
|
||
CTTelephonyNetworkInfo *telephonyInfo = [[CTTelephonyNetworkInfo alloc] init];
|
||
CTCarrier *carrier = [telephonyInfo subscriberCellularProvider];
|
||
NSString *currentCountry=[carrier carrierName];
|
||
// NSLog(@"[carrier isoCountryCode]==%@,[carrier allowsVOIP]=%d,[carrier mobileCountryCode=%@,[carrier mobileCountryCode]=%@",[carrier isoCountryCode],[carrier allowsVOIP],[carrier mobileCountryCode],[carrier mobileNetworkCode]);
|
||
UIDevice *device = [[UIDevice alloc] init];
|
||
// NSString *name = device.name; //获取设备所有者的名称
|
||
NSString *model = device.model; //获取设备的类别
|
||
NSString *type = device.localizedModel; //获取本地化版本
|
||
//NSString *systemName = device.systemName; //获取当前运行的系统
|
||
NSString *systemVersion = device.systemVersion;//获取当前系统的版本
|
||
NSString *identifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
|
||
|
||
ASIdentifierManager *asIM = [[ASIdentifierManager alloc] init];
|
||
NSString *idfa = [asIM.advertisingIdentifier UUIDString];
|
||
|
||
[_bridge callHandler:@"getphoneinfo" data:@{@"PhoneAdresseMAC":identifier,@"PhoneDeviceBrand":model,@"PhoneIMEI":idfa,@"PhoneModel":type,@"PhoneProvidersName":currentCountry,@"PhoneVersion":systemVersion} ];
|
||
|
||
} @catch (NSException * e) {
|
||
NSLog(@"Exception: %@", e);
|
||
}
|
||
}
|
||
-(void)canopen
|
||
{
|
||
first_Time=YES;
|
||
}
|
||
-(void)timeproblem
|
||
{
|
||
|
||
if (prolabeltwo!=nil) {
|
||
prolabeltwo.text=@"网络,配置文件加载有问题,请重新启动游戏!!!";
|
||
prolabeltwo.alpha=1;
|
||
}
|
||
[timer invalidate];
|
||
[timertwo invalidate];
|
||
}
|
||
|
||
|
||
-(void)showmessage_
|
||
{
|
||
[FuncPublic ShowAlert:self.showmessage title:[NSString stringWithFormat:@"%@提醒",gamehallname] viewController:self];
|
||
|
||
}
|
||
- (BOOL)isEmptyString:(NSString *) string {
|
||
|
||
if([string length] == 0) { //string isempty or nil
|
||
return YES;
|
||
}
|
||
else if([[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]length] == 0) {
|
||
//string is all whitespace
|
||
return YES;
|
||
}
|
||
return NO;
|
||
}
|
||
-(void)onnet
|
||
{
|
||
|
||
|
||
NSLog(@"%@",self.agentlist);
|
||
NSLog(@"%@",self.gamelist);
|
||
|
||
|
||
|
||
|
||
|
||
|
||
NSString * path=[FuncPublic getFilePath:[NSString stringWithFormat:@"%@/%@/version.xml",self.gamedir,self.gamestart] PathType:2];
|
||
|
||
|
||
|
||
NSData *dataversion = [[NSData alloc] initWithContentsOfFile:path];
|
||
GDataXMLDocument *doc = [[GDataXMLDocument alloc] initWithData:dataversion options:0 error:nil];
|
||
NSArray *array = [doc nodesForXPath:@"/game/game" error:nil];
|
||
//CityName
|
||
GDataXMLElement *element = [array firstObject];
|
||
if(self.gameinfo==nil){//没有配置gameid 读取xmlg配置的gameID
|
||
self.gameinfo=[element attributeForName:@"id"].stringValue;
|
||
}
|
||
|
||
|
||
|
||
NSArray *arraythree = [doc nodesForXPath:@"/game/version" error:nil];
|
||
|
||
GDataXMLElement *elementthree = [arraythree firstObject];
|
||
self.versioninfo=[elementthree attributeForName:@"value"].stringValue;
|
||
//
|
||
// [FuncPublic ShowAlert:self.agentinfo];
|
||
// [FuncPublic ShowAlert:self.gameinfo];
|
||
|
||
|
||
|
||
if(self.gamelist==nil){
|
||
for (int x=0; x<[self.agentlist count]; x++) {
|
||
NSDictionary *infoagent=[self.agentlist objectAtIndex:x];
|
||
|
||
if([[infoagent objectForKey:@"agentid"] isEqualToString:self.agentinfo])
|
||
{
|
||
|
||
|
||
if (![self isEmptyString:[infoagent objectForKey:@"showmessage"]]) {
|
||
self.showmessage=[infoagent objectForKey:@"showmessage"];
|
||
|
||
}
|
||
|
||
NSArray *gamelist=[infoagent objectForKey:@"gamelist"];
|
||
for (int i=0; i<[gamelist count]; i++) {
|
||
NSDictionary *info=[gamelist objectAtIndex:i];
|
||
|
||
if([[info objectForKey:@"gameid"] isEqualToString:self.gameinfo])
|
||
{
|
||
|
||
if (![self isEmptyString:[info objectForKey:@"showmessage"]]) {
|
||
self.showmessage=[info objectForKey:@"showmessage"];
|
||
|
||
}
|
||
NSString *game_version=[info objectForKey:@"game_version"];
|
||
NSString *game_zip=[info objectForKey:@"game_zip"];
|
||
if (![game_zip isEqualToString:@""]) {
|
||
self.game_zip_=[info objectForKey:@"game_zip"];
|
||
|
||
}
|
||
if ([game_version integerValue]!=0) {
|
||
self.game_version_=[info objectForKey:@"game_version"];
|
||
|
||
}
|
||
|
||
NSArray *channellist=[info objectForKey:@"channellist"];
|
||
|
||
for (int j=0; j<[channellist count]; j++) {
|
||
NSDictionary *infotwo=[channellist objectAtIndex:j];
|
||
|
||
if([[infotwo objectForKey:@"channelid"] isEqualToString:self.channel_id])
|
||
{
|
||
|
||
if (![self isEmptyString:[infotwo objectForKey:@"showmessage"]]) {
|
||
self.showmessage=[infotwo objectForKey:@"showmessage"];
|
||
}
|
||
game_version=[infotwo objectForKey:@"game_version"];
|
||
game_zip=[infotwo objectForKey:@"game_zip"];
|
||
if (![game_zip isEqualToString:@""]) {
|
||
self.game_zip_=[infotwo objectForKey:@"game_zip"];
|
||
|
||
}
|
||
if ([game_version integerValue]!=0) {
|
||
self.game_version_=[infotwo objectForKey:@"game_version"];
|
||
|
||
}
|
||
|
||
|
||
NSArray *marketlist=[infotwo objectForKey:@"marketlist"];
|
||
for (int x=0; x<[marketlist count]; x++) {
|
||
NSDictionary *infothree=[marketlist objectAtIndex:x];
|
||
|
||
if([[infothree objectForKey:@"marketid"] intValue]==[self.market intValue])
|
||
{
|
||
|
||
if (![self isEmptyString:[infothree objectForKey:@"showmessage"]]) {
|
||
self.showmessage=[infothree objectForKey:@"showmessage"];
|
||
}
|
||
game_version=[infothree objectForKey:@"game_version"];
|
||
game_zip=[infothree objectForKey:@"game_zip"];
|
||
if (![game_zip isEqualToString:@""]) {
|
||
self.game_zip_=[infothree objectForKey:@"game_zip"];
|
||
|
||
}
|
||
if ([game_version integerValue]!=0) {
|
||
self.game_version_=[infothree objectForKey:@"game_version"];
|
||
|
||
}
|
||
|
||
if(self.showmessage!=nil)
|
||
{
|
||
if(![self.showmessage isEqualToString:@""])
|
||
{
|
||
[self showmessage_];
|
||
return;
|
||
}
|
||
}
|
||
self.version_ios=[infothree objectForKey:@"app_version"];
|
||
|
||
if ([self.version_ios intValue]>[self.iosNumber intValue]) {
|
||
if ([self.market intValue]==1) {
|
||
[self uplevel:[self.game_version_ intValue] download:self.game_zip_];
|
||
return;
|
||
}
|
||
versionURL=[[NSString alloc]initWithString:[infothree objectForKey:@"app_download"]];
|
||
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"%@提醒",gamehallname] message:@"有新的版本更新,点击前往下载!更新过程中可能会白屏,请切到桌面查看下载进度" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
|
||
[alert show];
|
||
|
||
alert.tag=PublicTagfive;
|
||
return;
|
||
}else
|
||
{
|
||
[self uplevel:[self.game_version_ intValue] download:self.game_zip_];
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if(self.showmessage!=nil)
|
||
{
|
||
if(![self.showmessage isEqualToString:@""])
|
||
{
|
||
[self showmessage_];
|
||
return;
|
||
}
|
||
}
|
||
// [FuncPublic ShowAlert: [NSString stringWithFormat:@"agentid=%@;gameid=%@;channelid=%@;game_version=%@;marketid=%@;app_version=%@;game_zip=%@",self.agentinfo,self.gameinfo,self.channel_id,self.game_version_,self.market, self.version_ios,self.game_zip_] title:@"error info!" viewController:self];
|
||
}else{
|
||
if(self.agentinfo!=nil&&self.gameinfo!=nil ){
|
||
|
||
// NSDictionary *magentdata=nil;
|
||
//NSDictionary *mgamedata=nil;
|
||
// NSString *Sagentlist=[NSString stringWithFormat:@"agentid=%@",self.agentlist];
|
||
|
||
|
||
|
||
for (int x=0; x<[self.agentlist count]; x++) {
|
||
NSDictionary *infoagent=[self.agentlist objectAtIndex:x];
|
||
|
||
if([[infoagent objectForKey:@"agentid"] isEqualToString:self.agentinfo]){
|
||
|
||
if (![self isEmptyString:[infoagent objectForKey:@"showmessage"]]) {
|
||
self.showmessage=[infoagent objectForKey:@"showmessage"];
|
||
|
||
}
|
||
[self gonetconfig1:infoagent];
|
||
// NSString *url=[infoagent objectForKey:@"url"];
|
||
//
|
||
// if(![self isEmptyString:url]){
|
||
// // [FuncPublic ShowAlert:[NSString stringWithFormat:@"agenturl=%@",url]];
|
||
// [self gonetconfig:url];
|
||
//
|
||
// }else{
|
||
// [FuncPublic ShowAlert:@"agent url 地址为空" ];
|
||
//
|
||
// }
|
||
|
||
break;
|
||
}
|
||
|
||
|
||
}
|
||
|
||
for (int x=0; x<[self.gamelist count]; x++) {
|
||
NSDictionary *infogame=[self.gamelist objectAtIndex:x];
|
||
|
||
if([[infogame objectForKey:@"gameid"] isEqualToString:self.gameinfo]){
|
||
if (![self isEmptyString:[infogame objectForKey:@"showmessage"]]) {
|
||
self.showmessage=[infogame objectForKey:@"showmessage"];
|
||
|
||
}
|
||
[self gonetconfigone1:infogame];
|
||
// NSString *url=[infogame objectForKey:@"url"];
|
||
//
|
||
// if(![self isEmptyString:url]){
|
||
//
|
||
// [self gonetconfigone:url];
|
||
//
|
||
// // [FuncPublic ShowAlert:[NSString stringWithFormat:@"gameurl=%@",url]];
|
||
// }else{
|
||
// [FuncPublic ShowAlert:@"game url 地址为空" ];
|
||
//
|
||
// }
|
||
|
||
break;
|
||
}
|
||
|
||
|
||
|
||
}
|
||
|
||
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
|
||
|
||
|
||
|
||
-(versionConfig *) getagentversion :(NSDictionary *)agentdata{
|
||
versionConfig *versonfig=[versionConfig new];
|
||
|
||
NSString *game_version;
|
||
NSString *game_zip;
|
||
NSString *app_version;
|
||
NSString *app_download;
|
||
|
||
NSString *agentid=[agentdata objectForKey:@"agentid"];
|
||
if([FuncPublic isBlankString:agentid]==NO){
|
||
if([agentid isEqualToString:self.agentinfo]){
|
||
if (![self isEmptyString:[agentdata objectForKey:@"showmessage"]]) {
|
||
self.showmessage=[agentdata objectForKey:@"showmessage"];
|
||
}
|
||
// [FuncPublic ShowAlert:self.agentinfo];
|
||
NSArray *channellist=[agentdata objectForKey:@"channellist"];
|
||
if(channellist!=nil){
|
||
for (int j=0; j<[channellist count]; j++) {
|
||
NSDictionary *infotwo=[channellist objectAtIndex:j];
|
||
|
||
if([FuncPublic isBlankString:[infotwo objectForKey:@"channelid"]]==NO){
|
||
|
||
if([[infotwo objectForKey:@"channelid"] isEqualToString:self.channel_id]){
|
||
// [FuncPublic ShowAlert:self.channel_id];
|
||
if (![self isEmptyString:[infotwo objectForKey:@"showmessage"]]) {
|
||
self.showmessage=[infotwo objectForKey:@"showmessage"];
|
||
}
|
||
NSArray *marketlist=[infotwo objectForKey:@"marketlist"];
|
||
if(marketlist!=nil)
|
||
{
|
||
for (int x=0; x<[marketlist count]; x++) {
|
||
NSDictionary *infothree=[marketlist objectAtIndex:x];
|
||
NSString *marketid = [NSString stringWithFormat:@"%@", [infothree objectForKey:@"marketid"]];
|
||
if([FuncPublic isBlankString:marketid]==NO){
|
||
if([marketid isEqualToString: self.market])
|
||
{
|
||
// [FuncPublic ShowAlert:self.market];
|
||
|
||
if (![self isEmptyString:[infothree objectForKey:@"showmessage"]]) {
|
||
self.showmessage=[infothree objectForKey:@"showmessage"];
|
||
}
|
||
|
||
app_version = [NSString stringWithFormat:@"%@", [infothree objectForKey:@"app_version"]];
|
||
app_download= [infothree objectForKey:@"app_download"];
|
||
|
||
if ([FuncPublic isBlankString:app_download]==NO) {
|
||
versonfig.app_download=app_download;
|
||
|
||
}
|
||
if ([app_version integerValue]!=0) {
|
||
versonfig.app_version=app_version;
|
||
|
||
}
|
||
|
||
NSArray *gamelist=[agentdata objectForKey:@"gamelist"];
|
||
if(gamelist!=nil)
|
||
{
|
||
for (int i=0; i<[gamelist count]; i++) {
|
||
NSDictionary *info=[gamelist objectAtIndex:i];
|
||
if([FuncPublic isBlankString:[info objectForKey:@"gameid"]]==NO){
|
||
if([[info objectForKey:@"gameid"] isEqualToString:self.gameinfo]){
|
||
// [FuncPublic ShowAlert:self.gameinfo];
|
||
if (![self isEmptyString:[info objectForKey:@"showmessage"]]) {
|
||
self.showmessage=[info objectForKey:@"showmessage"];
|
||
}
|
||
|
||
game_version=[NSString stringWithFormat:@"%@", [info objectForKey:@"game_version"]];
|
||
game_zip=[info objectForKey:@"game_download"];
|
||
|
||
app_version= [NSString stringWithFormat:@"%@", [info objectForKey:@"app_version"]];
|
||
app_download= [info objectForKey:@"app_download"];
|
||
|
||
if ([FuncPublic isBlankString:app_download]==NO) {
|
||
versonfig.app_download=app_download;
|
||
|
||
}
|
||
if ([app_version integerValue]!=0) {
|
||
versonfig.app_version=app_version;
|
||
|
||
}
|
||
|
||
|
||
if ([FuncPublic isBlankString:game_zip]==NO) {
|
||
versonfig.game_download=game_zip;
|
||
|
||
}
|
||
if ([game_version integerValue]!=0) {
|
||
versonfig.game_version=game_version;
|
||
|
||
}
|
||
|
||
|
||
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
}
|
||
|
||
|
||
}
|
||
|
||
}
|
||
|
||
}else{
|
||
|
||
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
return versonfig;
|
||
|
||
}
|
||
|
||
-(versionConfig *) getgameversion :(NSDictionary *)gamedata{
|
||
versionConfig *versonfig=[versionConfig new];
|
||
|
||
NSString *game_version;
|
||
NSString *game_zip;
|
||
NSString *app_version;
|
||
NSString *app_download;
|
||
|
||
NSString *gameid=[gamedata objectForKey:@"gameid"];
|
||
if([FuncPublic isBlankString:gameid]==NO){
|
||
if([gameid isEqualToString:self.gameinfo]){
|
||
if (![self isEmptyString:[gamedata objectForKey:@"showmessage"]]) {
|
||
self.showmessage=[gamedata objectForKey:@"showmessage"];
|
||
}
|
||
|
||
|
||
NSString *gameversion1 = [NSString stringWithFormat:@"%@", [gamedata objectForKey:@"game_version"]];
|
||
game_version=gameversion1;
|
||
game_zip=[gamedata objectForKey:@"game_zip"];
|
||
|
||
|
||
|
||
if ([FuncPublic isBlankString:game_zip]==NO) {
|
||
versonfig.game_download=game_zip;
|
||
|
||
}
|
||
if ([game_version integerValue]!=0) {
|
||
versonfig.game_version=game_version;
|
||
|
||
}
|
||
|
||
|
||
|
||
// NSArray *agentlist=[gamedata objectForKey:@"gamelist"];
|
||
//
|
||
// if(agentlist!=nil){
|
||
// for (int j=0; j<[agentlist count]; j++) {
|
||
NSDictionary *infotwo=gamedata;
|
||
// if([FuncPublic isBlankString:[infotwo objectForKey:@"agentid"]]==NO){
|
||
//
|
||
// if([[infotwo objectForKey:@"agentid"] isEqualToString:self.agentinfo]){
|
||
|
||
if (![self isEmptyString:[infotwo objectForKey:@"showmessage"]]) {
|
||
self.showmessage=[infotwo objectForKey:@"showmessage"];
|
||
}
|
||
|
||
|
||
NSString *gameversion2 = [NSString stringWithFormat:@"%@", [infotwo objectForKey:@"game_version"]];
|
||
game_version=gameversion2;
|
||
game_zip=[infotwo objectForKey:@"game_zip"];
|
||
|
||
if ([FuncPublic isBlankString:game_zip]==NO) {
|
||
versonfig.game_download=game_zip;
|
||
|
||
}
|
||
if ([game_version integerValue]!=0) {
|
||
versonfig.game_version=game_version;
|
||
|
||
}
|
||
|
||
|
||
NSArray *channellist=[infotwo objectForKey:@"channellist"];
|
||
if(channellist!=nil){
|
||
for (int x=0; x<[channellist count]; x++) {
|
||
NSDictionary *infothree=[channellist objectAtIndex:x];
|
||
|
||
if([FuncPublic isBlankString:[infothree objectForKey:@"channelid"]]==NO){
|
||
if([[infothree objectForKey:@"channelid"] isEqualToString: self.channel_id])
|
||
{
|
||
|
||
|
||
if (![self isEmptyString:[infothree objectForKey:@"showmessage"]]) {
|
||
self.showmessage=[infothree objectForKey:@"showmessage"];
|
||
}
|
||
NSString *gameversion3 = [NSString stringWithFormat:@"%@", [infothree objectForKey:@"game_version"]];
|
||
game_version=gameversion3;
|
||
game_zip=[infothree objectForKey:@"game_zip"];
|
||
if ([FuncPublic isBlankString:game_zip]==NO) {
|
||
versonfig.game_download=game_zip;
|
||
|
||
}
|
||
if ([game_version integerValue]!=0) {
|
||
versonfig.game_version=game_version;
|
||
|
||
}
|
||
|
||
|
||
|
||
|
||
NSArray *marketlist=[infothree objectForKey:@"marketlist"];
|
||
if(marketlist!=nil){
|
||
for (int i=0; i<[marketlist count]; i++) {
|
||
NSDictionary *info=[marketlist objectAtIndex:i];
|
||
NSString *marketid = [NSString stringWithFormat:@"%@", [info objectForKey:@"marketid"]];
|
||
if([FuncPublic isBlankString:marketid]==NO){
|
||
|
||
if([marketid isEqualToString:self.market]){
|
||
|
||
if (![self isEmptyString:[info objectForKey:@"showmessage"]]) {
|
||
self.showmessage=[info objectForKey:@"showmessage"];
|
||
}
|
||
|
||
NSString *appversion4 = [NSString stringWithFormat:@"%@", [info objectForKey:@"app_version"]];
|
||
|
||
app_version= appversion4;
|
||
app_download= [info objectForKey:@"app_download"];
|
||
|
||
if ([FuncPublic isBlankString:app_download]==NO) {
|
||
versonfig.app_download=app_download;
|
||
|
||
}
|
||
if ([app_version integerValue]!=0) {
|
||
versonfig.app_version=app_version;
|
||
|
||
}
|
||
|
||
NSString *gameversion4 = [NSString stringWithFormat:@"%@", [info objectForKey:@"game_version"]];
|
||
game_version=gameversion4;
|
||
game_zip=[info objectForKey:@"game_zip"];
|
||
if ([FuncPublic isBlankString:game_zip]==NO) {
|
||
versonfig.game_download=game_zip;
|
||
|
||
}
|
||
if ([game_version integerValue]!=0) {
|
||
versonfig.game_version=game_version;
|
||
|
||
}
|
||
|
||
|
||
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
// }
|
||
//
|
||
// }
|
||
|
||
|
||
// }
|
||
// }
|
||
|
||
|
||
}
|
||
|
||
}else{
|
||
|
||
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
return versonfig;
|
||
|
||
}
|
||
|
||
|
||
#pragma mark - 初始化索引文件
|
||
|
||
-(void) initconfig{
|
||
|
||
}
|
||
|
||
|
||
-(void)initJSdata
|
||
{
|
||
|
||
int result;
|
||
NSString *str;
|
||
if ([self.version_ios intValue]>=[self.iosNumber intValue])
|
||
{
|
||
str= [FuncPublic filename:@"gameconfig"];
|
||
result=0;}
|
||
else{
|
||
str= [FuncPublic filename:@"appleconfig"];
|
||
result=1;
|
||
}
|
||
NSString *filePath=[FuncPublic getFilePath:[NSString stringWithFormat:@"%@/%@/app_data.js",self.gamedir,self.gamestart] PathType:2];
|
||
NSString *info=[NSString stringWithFormat:@"var app_version=1;var app_gameconfig='%@';var app_gamedir='%@';var app_gamestart='%@';var app_agent='%@';var app_appversion='%d';var app_market='%@';var app_channel='%@';var app_Launchtype=0;var app_getwifisignalLevel=1;var app_gamename='%@';var app_invitationcode='%@';",str, self.gamedir,self.gamestart,self.agentinfo,result,self.market,self.channel_id,self.gamestart,self.tuiguang_id];
|
||
NSData *txtData=[info dataUsingEncoding:NSUTF8StringEncoding];
|
||
[[NSFileManager defaultManager]createFileAtPath:filePath contents:txtData attributes:nil];
|
||
|
||
}
|
||
-(void)gonet
|
||
{
|
||
// [FuncPublic ShowAlert:@"进入gonet"];
|
||
Reachability *conn = [Reachability reachabilityForInternetConnection];
|
||
if (conn.currentReachabilityStatus==NotReachable) {
|
||
if(alertCan)
|
||
{
|
||
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"%@提醒",gamehallname] message:@"网络没有信号,请检查您的网络状态!是否开启蜂窝移动网络关闭了应用访问网络的权限!" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
|
||
[alert show];
|
||
|
||
alert.tag=PublicTagfive+1;
|
||
alertCan=NO;
|
||
}
|
||
prolabeltwo.alpha=1;
|
||
return;
|
||
}
|
||
|
||
NSString *url_=[NSString stringWithFormat:@"%@%@",self.weburl,[NSString stringWithFormat:@"?v%08X%08X", arc4random(), arc4random()]];
|
||
NSURL *urlPath = [NSURL URLWithString:url_];
|
||
|
||
NSData *requestData = [NSData dataWithContentsOfURL:urlPath];
|
||
|
||
if(requestData==nil)
|
||
{
|
||
return;
|
||
}
|
||
[timer invalidate];
|
||
// [timertwo invalidate];
|
||
NSString *result=[[NSString alloc]initWithData:requestData encoding:NSUTF8StringEncoding];
|
||
NSString *str = [[NSString alloc]initWithFormat:@"%@",[result stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
|
||
if(str.length<=100)
|
||
{
|
||
[FuncPublic ShowAlert:str title:[NSString stringWithFormat:@"%@提醒",gamehallname] viewController:self];
|
||
return;
|
||
}
|
||
NSDictionary * obj_return = [str JSONValue];
|
||
// NSDictionary *data=[obj_return objectForKey:@"agentlist"];
|
||
self.agentlist=[obj_return objectForKey:@"agentlist"];
|
||
|
||
self.gamelist=[obj_return objectForKey:@"gamelist"];
|
||
|
||
if (![self isEmptyString:[obj_return objectForKey:@"showmessage"]]) {
|
||
self.showmessage=[obj_return objectForKey:@"showmessage"];
|
||
|
||
}
|
||
[self onnet];
|
||
}
|
||
|
||
|
||
|
||
-(void)gonetconfig: (NSString *)weburl
|
||
{
|
||
|
||
|
||
NSDictionary * obj_return;
|
||
|
||
@try {
|
||
NSString *url_=[NSString stringWithFormat:@"%@%@",weburl,[NSString stringWithFormat:@"?v%08X%08X", arc4random(), arc4random()]];
|
||
NSURL *urlPath = [NSURL URLWithString:url_];
|
||
|
||
NSData *requestData = [NSData dataWithContentsOfURL:urlPath];
|
||
|
||
if(requestData==nil)
|
||
{
|
||
return;
|
||
}
|
||
[timer invalidate];
|
||
// [timertwo invalidate];
|
||
|
||
NSString *result=[[NSString alloc]initWithData:requestData encoding:NSUTF8StringEncoding];
|
||
NSString *str = [[NSString alloc]initWithFormat:@"%@",[result stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
|
||
if(str.length<=100)
|
||
{
|
||
[FuncPublic ShowAlert:str title:[NSString stringWithFormat:@"%@提醒",gamehallname] viewController:self];
|
||
return;
|
||
}
|
||
|
||
obj_return = [str JSONValue];
|
||
self.magentlist=obj_return;
|
||
|
||
|
||
|
||
if (![self isEmptyString:[obj_return objectForKey:@"showmessage"]]) {
|
||
self.showmessage=[obj_return objectForKey:@"showmessage"];
|
||
|
||
}
|
||
} @catch (NSException *exception) {
|
||
[FuncPublic ShowAlert:@"转json失败请检查格式 "];
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
-(void)gonetconfig1: (NSDictionary *)agentlist{
|
||
self.magentlist = agentlist;
|
||
}
|
||
-(void)gonetconfigone1: (NSDictionary *)gametlist {
|
||
self.mgamelist = gametlist;
|
||
if (![self isEmptyString:[gametlist objectForKey:@"showmessage"]]) {
|
||
self.showmessage=[gametlist objectForKey:@"showmessage"];
|
||
|
||
}
|
||
[self chulishengji];
|
||
}
|
||
-(void)gonetconfigone: (NSString *)weburl
|
||
{
|
||
|
||
|
||
NSDictionary * obj_return;
|
||
|
||
@try {
|
||
NSString *url_=[NSString stringWithFormat:@"%@%@",weburl,[NSString stringWithFormat:@"?v%08X%08X", arc4random(), arc4random()]];
|
||
NSURL *urlPath = [NSURL URLWithString:url_];
|
||
|
||
NSData *requestData = [NSData dataWithContentsOfURL:urlPath];
|
||
|
||
if(requestData==nil)
|
||
{
|
||
return;
|
||
}
|
||
[timer invalidate];
|
||
// [timertwo invalidate];
|
||
|
||
NSString *result=[[NSString alloc]initWithData:requestData encoding:NSUTF8StringEncoding];
|
||
NSString *str = [[NSString alloc]initWithFormat:@"%@",[result stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
|
||
if(str.length<=100)
|
||
{
|
||
[FuncPublic ShowAlert:str title:[NSString stringWithFormat:@"%@提醒",gamehallname] viewController:self];
|
||
return;
|
||
}
|
||
|
||
obj_return = [str JSONValue];
|
||
if(obj_return!=nil)
|
||
{
|
||
self.mgamelist=obj_return;
|
||
}
|
||
|
||
|
||
|
||
if (![self isEmptyString:[obj_return objectForKey:@"showmessage"]]) {
|
||
self.showmessage=[obj_return objectForKey:@"showmessage"];
|
||
|
||
}
|
||
} @catch (NSException *exception) {
|
||
[FuncPublic ShowAlert:@"转json失败请检查格式 "];
|
||
}
|
||
|
||
[self chulishengji];
|
||
|
||
|
||
}
|
||
|
||
-(void)chulishengji{
|
||
NSDictionary *magentdata,*mgamedata1;
|
||
|
||
|
||
if(self.magentlist!=nil&&self.mgamelist!=nil)
|
||
{
|
||
|
||
magentdata=self.magentlist;
|
||
mgamedata1=self.mgamelist;
|
||
}else{
|
||
[FuncPublic ShowAlert:@"self.mgamelist为空" ];
|
||
}
|
||
|
||
//&&gamedata!=nil
|
||
if(magentdata!=nil&&mgamedata1!=nil){
|
||
|
||
|
||
|
||
versionConfig *agentconfig=[self getagentversion:magentdata];
|
||
|
||
versionConfig *gameconfig= [self getgameversion:mgamedata1];
|
||
|
||
// [FuncPublic ShowAlert: [NSString stringWithFormat:@"agentappversion=%@;agentappdownload=%@;agentgameversion=%@;agentgamedownload=%@",agentconfig.app_version,agentconfig.app_download,agentconfig.game_version,agentconfig.game_download] title:@"error info!" viewController:self];
|
||
//
|
||
// [FuncPublic ShowAlert: [NSString stringWithFormat:@"gameappversion=%@;gameappdownload=%@;gamegameversion=%@;gamegamedownload=%@",gameconfig.app_version,gameconfig.app_download,gameconfig.game_version,gameconfig.game_download] title:@"error info!" viewController:self];
|
||
//
|
||
//
|
||
//
|
||
|
||
|
||
NSString *game_version=nil;
|
||
NSString *game_download=nil;
|
||
NSString *app_version=nil;
|
||
NSString *app_download=nil;
|
||
|
||
//处理自app升级
|
||
if([FuncPublic isBlankString:agentconfig.app_download]==NO &&[FuncPublic isBlankString:gameconfig.app_download]==NO){
|
||
|
||
@try
|
||
{
|
||
|
||
app_download=agentconfig.app_download;
|
||
app_version=agentconfig.app_version;
|
||
|
||
if([gameconfig.app_version intValue]>[agentconfig.app_version intValue]){
|
||
app_download=gameconfig.app_download;
|
||
app_version=gameconfig.app_version;
|
||
|
||
}
|
||
|
||
}
|
||
@catch (NSException *exception)
|
||
{
|
||
|
||
|
||
}
|
||
|
||
}else{
|
||
|
||
@try {
|
||
if([FuncPublic isBlankString:agentconfig.app_download]==NO){
|
||
app_download=agentconfig.app_download;
|
||
app_version=agentconfig.app_version;
|
||
|
||
}
|
||
if([FuncPublic isBlankString:gameconfig.app_download]==NO){
|
||
app_download=gameconfig.app_download;
|
||
app_version=gameconfig.app_version;
|
||
}
|
||
|
||
|
||
} @catch (NSException *exception) {
|
||
|
||
}
|
||
|
||
}
|
||
|
||
// 处理game升级
|
||
if([FuncPublic isBlankString:gameconfig.game_download]==NO &&[FuncPublic isBlankString:gameconfig.game_download]==NO){
|
||
@try
|
||
{
|
||
game_download=gameconfig.game_download;
|
||
game_version=gameconfig.game_version;
|
||
|
||
if([agentconfig.game_version intValue]>[gameconfig.game_version intValue]){
|
||
game_download=agentconfig.game_download;
|
||
game_version=agentconfig.game_version;
|
||
|
||
}
|
||
|
||
}
|
||
@catch (NSException *exception)
|
||
{
|
||
|
||
|
||
}
|
||
|
||
}else{
|
||
|
||
|
||
@try {
|
||
if([FuncPublic isBlankString:agentconfig.game_download]==NO){
|
||
game_download=agentconfig.game_download;
|
||
game_version=agentconfig.game_version;
|
||
|
||
}
|
||
if([FuncPublic isBlankString:gameconfig.game_download]==NO){
|
||
// [FuncPublic ShowAlert:gameconfig.game_download];
|
||
// // [FuncPublic ShowAlert:gameconfig.game_version];
|
||
|
||
game_download=gameconfig.game_download;
|
||
|
||
game_version=gameconfig.game_version;
|
||
}
|
||
|
||
|
||
} @catch (NSException *exception) {
|
||
|
||
}
|
||
|
||
}
|
||
|
||
|
||
self.game_version_=game_version;
|
||
self.game_zip_=game_download;
|
||
self.version_ios=app_version;
|
||
|
||
|
||
|
||
if(self.showmessage!=nil)
|
||
{
|
||
if(![self.showmessage isEqualToString:@""])
|
||
{
|
||
[self showmessage_];
|
||
return;
|
||
}
|
||
}
|
||
|
||
if ([self.version_ios intValue]>[self.iosNumber intValue]) {
|
||
// if ([self.market intValue]==1) {
|
||
// [self uplevel:[self.game_version_ intValue] download:self.game_zip_];
|
||
// return;
|
||
// }
|
||
versionURL=[[NSString alloc]initWithString:app_download];
|
||
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"%@提醒",gamehallname] message:@"有新的版本更新,点击前往下载!更新过程中可能会白屏,请切到桌面查看下载进度" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
|
||
[alert show];
|
||
|
||
alert.tag=PublicTagfive;
|
||
return;
|
||
}else{
|
||
|
||
|
||
|
||
[self uplevel:[self.game_version_ intValue] download:self.game_zip_];
|
||
return;
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
}
|
||
|
||
|
||
|
||
}
|
||
|
||
|
||
-(void)viewWillDisappear:(BOOL)animated
|
||
{
|
||
|
||
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"enterForeground" object:nil];
|
||
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"applicationWillResignActive" object:nil];
|
||
|
||
}
|
||
|
||
|
||
|
||
-(void)viewWillAppear:(BOOL)animated
|
||
{
|
||
|
||
//[FuncPublic ShowAlert:@"进入viewWillAppear"];
|
||
|
||
[FuncPublic SharedFuncPublic]._CurrentShow=2;
|
||
[WXApiManager sharedManager].delegate = self;
|
||
[self.navigationController setNavigationBarHidden:YES animated:NO];
|
||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(enterForeground) name:@"enterForeground" object:nil];
|
||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillResignActive) name:@"applicationWillResignActive" object:nil];
|
||
|
||
|
||
|
||
if(firsttime)
|
||
{
|
||
firsttime=false;
|
||
[self commoninit];
|
||
[self configLocationManager];
|
||
[self initCompleteBlock];
|
||
}else
|
||
{
|
||
return;
|
||
}
|
||
|
||
if(1)
|
||
{
|
||
Reachability *conn = [Reachability reachabilityForInternetConnection];
|
||
if (conn.currentReachabilityStatus==NotReachable) {
|
||
[FuncPublic ShowAlert:@"网络没有信号,请检查您的网络状态!是否开启蜂窝移动网络关闭了应用访问网络的权限!" title:[NSString stringWithFormat:@"%@提醒",gamehallname] viewController:self];
|
||
prolabeltwo.alpha=1;
|
||
return;
|
||
}
|
||
|
||
}
|
||
NSString *url_=[NSString stringWithFormat:@"%@%@",self.weburl,[NSString stringWithFormat:@"?v%08X%08X", arc4random(), arc4random()]];
|
||
NSURL *urlPath = [NSURL URLWithString:url_];
|
||
|
||
NSData *requestData = [NSData dataWithContentsOfURL:urlPath];
|
||
|
||
if(requestData==nil)
|
||
{
|
||
[FuncPublic ShowAlert:@"获取配置文件失败,重新连接中!" title:[NSString stringWithFormat:@"%@提醒",gamehallname] viewController:self];
|
||
prolabeltwo.alpha=1;
|
||
return;
|
||
}
|
||
[timer invalidate];
|
||
// [timertwo invalidate];
|
||
NSString *result=[[NSString alloc]initWithData:requestData encoding:NSUTF8StringEncoding];
|
||
NSString* str = [[NSString alloc]initWithFormat:@"%@",[result stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
|
||
if(str.length<=100)
|
||
{
|
||
[FuncPublic ShowAlert:str title:[NSString stringWithFormat:@"%@提醒",gamehallname] viewController:self];
|
||
return;
|
||
}
|
||
NSDictionary * obj_return = [str JSONValue];
|
||
// NSDictionary *data=[obj_return objectForKey:@"agentlist"];
|
||
self.agentlist=[obj_return objectForKey:@"agentlist"];
|
||
// self.gamelist=[obj_return objectForKey:@"gamelist"];
|
||
for (int x=0; x<[self.agentlist count]; x++) {
|
||
NSDictionary *infoagent=[self.agentlist objectAtIndex:x];
|
||
|
||
if([[infoagent objectForKey:@"agentid"] isEqualToString:self.agentinfo]){
|
||
self.gamelist = [infoagent objectForKey:@"gamelist"];
|
||
}
|
||
|
||
}
|
||
if (![self isEmptyString:[obj_return objectForKey:@"showmessage"]]) {
|
||
self.showmessage=[obj_return objectForKey:@"showmessage"];
|
||
}
|
||
[self onnet];
|
||
}
|
||
-(void)commoninit
|
||
{
|
||
// self.callCenter = [[CTCallCenter alloc] init];
|
||
//self.callWasStarted = NO;
|
||
|
||
// __typeof__(self) weakSelf = self;
|
||
//
|
||
// [self.callCenter setCallEventHandler:^(CTCall *call) {
|
||
//
|
||
// if ([[call callState] isEqual:CTCallStateIncoming] ||
|
||
// [[call callState] isEqual:CTCallStateDialing]) {
|
||
//
|
||
// if (weakSelf.callWasStarted == NO) {
|
||
// weakSelf.callWasStarted = YES;
|
||
// NSLog(@"Call was started.");
|
||
// // if ([[NSThread currentThread] isMainThread]) {
|
||
// // [backgroundPlayer pause];
|
||
// [_bridge callHandler:@"phonestate" data:[NSString stringWithFormat:@"2"] ];
|
||
// // }
|
||
// }
|
||
// } else if ([[call callState] isEqual:CTCallStateDisconnected]) {
|
||
//
|
||
// if (weakSelf.callWasStarted == YES)
|
||
// {
|
||
// weakSelf.callWasStarted = NO;
|
||
// // if ([[NSThread currentThread] isMainThread]) {
|
||
// // [backgroundPlayer play];
|
||
// NSLog(@"Call was ended.");
|
||
// [_bridge callHandler:@"phonestate" data:[NSString stringWithFormat:@"0"]];
|
||
// // }
|
||
// }
|
||
// }
|
||
// }];
|
||
[UIDevice currentDevice].batteryMonitoringEnabled = YES;
|
||
[[NSNotificationCenter defaultCenter] addObserverForName:UIDeviceBatteryLevelDidChangeNotification
|
||
|
||
object:nil queue:[NSOperationQueue mainQueue]
|
||
|
||
usingBlock:^(NSNotification *notification) {
|
||
if ([[NSThread currentThread] isMainThread]) {
|
||
NSLog(@"main");
|
||
[self changebattery];
|
||
CGFloat level=[UIDevice currentDevice].batteryLevel;
|
||
NSLog(@"电池电量:%.2f", [UIDevice currentDevice].batteryLevel);
|
||
[_bridge callHandler:@"getBattery" data:[NSString stringWithFormat:@"%.2f",level] ];
|
||
}
|
||
|
||
}];
|
||
|
||
|
||
AFNetworkReachabilityManager *manager = [AFNetworkReachabilityManager sharedManager];
|
||
//要监控网络连接状态,必须要先调用单例的startMonitoring方法
|
||
[manager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
|
||
//status:
|
||
//AFNetworkReachabilityStatusUnknown = -1, 未知
|
||
//AFNetworkReachabilityStatusNotReachable = 0, 未连接
|
||
//AFNetworkReachabilityStatusReachableViaWWAN = 1, 3G
|
||
//AFNetworkReachabilityStatusReachableViaWiFi = 2, 无线连接
|
||
// NSLog(@"%d", status);
|
||
if(status==AFNetworkReachabilityStatusNotReachable)
|
||
{
|
||
self.netstate=1;
|
||
|
||
}else if(status==AFNetworkReachabilityStatusReachableViaWiFi)
|
||
{
|
||
self.netstate=2;
|
||
}else if(status==AFNetworkReachabilityStatusReachableViaWWAN)
|
||
{
|
||
self.netstate=3;
|
||
}
|
||
if ([[NSThread currentThread] isMainThread]) {
|
||
NSLog(@"main");
|
||
[self changenetstate];
|
||
[_bridge callHandler:@"getnetwork" data:[NSString stringWithFormat:@"%d",self.netstate]];
|
||
}
|
||
}];
|
||
[manager startMonitoring];
|
||
[self changenetstate];
|
||
[self changebattery];
|
||
}
|
||
-(void)changebattery
|
||
{
|
||
NSString *filePath=[FuncPublic getFilePath:[NSString stringWithFormat:@"%@/%@/app_battery.js",self.gamedir,self.gamestart] PathType:2];
|
||
CGFloat batterylevel = [UIDevice currentDevice].batteryLevel;
|
||
NSString *info=[NSString stringWithFormat:@"var app_getbattery=%lf;",batterylevel];
|
||
NSData *txtData=[info dataUsingEncoding:NSUTF8StringEncoding];
|
||
[[NSFileManager defaultManager]createFileAtPath:filePath contents:txtData attributes:nil];
|
||
|
||
}
|
||
-(void)changenetstate
|
||
{
|
||
NSString *filePath=[FuncPublic getFilePath:[NSString stringWithFormat:@"%@/%@/app_network.js",self.gamedir,self.gamestart] PathType:2];
|
||
NSString *info=[NSString stringWithFormat:@"var app_getnetwork=%d;",self.netstate];
|
||
NSData *txtData=[info dataUsingEncoding:NSUTF8StringEncoding];
|
||
[[NSFileManager defaultManager]createFileAtPath:filePath contents:txtData attributes:nil];
|
||
|
||
}
|
||
#pragma mark - alertview delegate
|
||
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
|
||
{
|
||
if (alertView.tag == PublicTagfive)
|
||
{
|
||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:versionURL]];
|
||
}
|
||
|
||
if (alertView.tag == PublicTagfive+1)
|
||
{
|
||
|
||
alertCan=YES;
|
||
}
|
||
}
|
||
/*
|
||
notification方法
|
||
*/
|
||
-(void)stopradio
|
||
{
|
||
[_bridge callHandler:@"gameui_stop_voice" data:[NSString stringWithFormat:@"%@",self.User_id]];
|
||
|
||
}
|
||
- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer*)player successfully:(BOOL)flag{
|
||
//播放结束时执行的动作
|
||
[self stopradio];
|
||
}
|
||
- (void)audioPlayerDecodeErrorDidOccur:(AVAudioPlayer*)player error:(NSError *)error{
|
||
//解码错误执行的动作
|
||
[self stopradio];
|
||
}
|
||
- (void)audioPlayerBeginInteruption:(AVAudioPlayer*)player{
|
||
//处理中断的代码
|
||
[self stopradio];
|
||
}
|
||
- (void)audioPlayerEndInteruption:(AVAudioPlayer*)player{
|
||
//处理中断结束的代码 }
|
||
[self stopradio];
|
||
}
|
||
-(void)YLbackgameData:(NSNotification*)notification
|
||
{
|
||
if ([[NSThread currentThread] isMainThread]) {
|
||
NSLog(@"main");
|
||
dispatch_async(dispatch_get_main_queue(), ^{
|
||
NSString *data = [notification object];
|
||
//[FuncPublic ShowAlert:@"调用getWebdata"];
|
||
[_bridge callHandler:@"getWebdata" data:data ];
|
||
});
|
||
}
|
||
}
|
||
|
||
-(void)enterForeground
|
||
{
|
||
if ([[NSThread currentThread] isMainThread]) {
|
||
NSLog(@"main");
|
||
[_bridge callHandler:@"appservice" data:[NSString stringWithFormat:@"2"] ];
|
||
} else {
|
||
NSLog(@"not main");
|
||
}
|
||
}
|
||
-(void)applicationWillResignActive
|
||
{
|
||
if ([[NSThread currentThread] isMainThread]) {
|
||
NSLog(@"main");
|
||
[_bridge callHandler:@"appservice" data:[NSString stringWithFormat:@"1"] ];
|
||
} else {
|
||
NSLog(@"not main");
|
||
}
|
||
}
|
||
|
||
/* 下载更新*/
|
||
-(void)downFileFromServer:(NSString *)downstring
|
||
{
|
||
UIImage *back=[UIImage imageNamed:@"Default-568h@2x~iphone.png"];
|
||
//远程地址
|
||
background=[[UIImageView alloc]initWithImage: [UIImage imageWithCGImage:back.CGImage scale:1 orientation:UIImageOrientationLeft] ];
|
||
background.frame=CGRectMake(0,0,DEVW , DEVH);
|
||
[self.view addSubview:background];
|
||
|
||
pro_Download=[[UIProgressView alloc] initWithFrame:CGRectMake(100,DEVH-100, DEVW-200, 20)];
|
||
[pro_Download setProgress:0.0];
|
||
[background addSubview:pro_Download];
|
||
|
||
NSURL *downloadUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@",downstring,[NSString stringWithFormat:@"?v%08X%08X", arc4random(), arc4random()]]];
|
||
downLoadfile=@"gamehall.zip" ;//[NSString stringWithFormat:@"%@.zip",self.gamestart]; //
|
||
ASIHTTPRequest * requestDownload = [ASIHTTPRequest requestWithURL:downloadUrl];
|
||
[requestDownload setDelegate:self];
|
||
requestDownload.username=[NSString stringWithFormat:@"download%@",@"test"];
|
||
//设置下载路径
|
||
[requestDownload setDownloadDestinationPath:[FuncPublic getFilePath:[NSString stringWithFormat:@"zips/%@",downLoadfile] PathType:2]];
|
||
//设置缓存路径
|
||
[requestDownload setTemporaryFileDownloadPath:[FuncPublic getFilePath:[NSString stringWithFormat:@"caches/%@.tmp",downLoadfile] PathType:2]];
|
||
//设置支持断点续传
|
||
[requestDownload setAllowResumeForFileDownloads:YES];
|
||
//设置跟踪进度条
|
||
[requestDownload setDownloadProgressDelegate:pro_Download];
|
||
[requestDownload setDidFinishSelector:@selector(requestFinished:)];
|
||
[requestDownload setDidFailSelector:@selector(requestFailed:)];
|
||
[requestDownload start];
|
||
}
|
||
// 监听到了属性改变会调用这个方法
|
||
- (void)requestStarted:(ASIHTTPRequest *)request
|
||
{
|
||
NSLog(@"1");
|
||
}
|
||
- (void)requestFinished:(ASIHTTPRequest *)request
|
||
{
|
||
// stateLabel.text=@"下载完成!";
|
||
// stateLabel.text=@"正在解压...";
|
||
[NSThread detachNewThreadSelector:@selector(unzip) toTarget:self withObject:nil];
|
||
NSLog(@"2");
|
||
}
|
||
|
||
- (void)unzip
|
||
{
|
||
NSString *zipPath = [FuncPublic getFilePath:[NSString stringWithFormat:@"zips/%@",downLoadfile] PathType:2];
|
||
NSString *filePath=[FuncPublic getFilePath:[NSString stringWithFormat:@"%@",self.gamedir] PathType:2];
|
||
BOOL result = [[NSFileManager defaultManager] removeItemAtPath:filePath error:nil];
|
||
if(result)
|
||
{
|
||
ZipArchive *zip = [[ZipArchive alloc] init];
|
||
if ([zip UnzipOpenFile:zipPath])
|
||
{
|
||
if ([zip UnzipFileTo: filePath overWrite:YES])
|
||
{
|
||
//此处为空
|
||
}
|
||
}
|
||
[zip UnzipCloseFile];
|
||
[self unzipDone];
|
||
}
|
||
}
|
||
|
||
- (void)unzipDone
|
||
{
|
||
//will change
|
||
//解压完,将zip包删除 //delegate change
|
||
NSFileManager *fileManager = [[NSFileManager alloc] init];
|
||
|
||
[fileManager removeItemAtPath:[FuncPublic getFilePath:[NSString stringWithFormat:@"zips/%@",downLoadfile] PathType:2] error:nil];
|
||
[background removeFromSuperview];
|
||
[self initView];
|
||
}
|
||
|
||
- (void)requestFailed:(ASIHTTPRequest *)request
|
||
{
|
||
NSLog(@"Error %@", [request error]);
|
||
}
|
||
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{
|
||
NSLog(@"lskdjfl= %f",pro.fractionCompleted);
|
||
}
|
||
|
||
-(void)uplevel:(int )gamevers download:(NSString *)downstring
|
||
{
|
||
if (gamevers>[self.versioninfo intValue]) {
|
||
|
||
[self downFileFromServer:downstring];
|
||
return;
|
||
}else
|
||
{
|
||
[self initView];
|
||
return;
|
||
}
|
||
}
|
||
/* 录音*/
|
||
|
||
- (void)VoiceRecorderBaseVCRecordFinish:(NSString *)_filePath fileName:(NSString*)_fileName{
|
||
NSLog(@"录音完成,文件路径:%@ %@",_filePath,_fileName);
|
||
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
|
||
AVAudioPlayer *play = [[AVAudioPlayer alloc]initWithContentsOfURL:[NSURL URLWithString:_filePath] error:nil];
|
||
NSTimeInterval interval= play.duration;
|
||
NSInteger time = round(interval);
|
||
|
||
//4.播放
|
||
if (play == nil)
|
||
{
|
||
NSLog(@"ERror creating player: %@", [play description]);
|
||
}else{
|
||
|
||
}
|
||
NSString *amrPath = [FuncPublic GetPathByFileName: _fileName ofType:@"amr"];
|
||
if ([VoiceConverter ConvertWavToAmr:_filePath amrSavePath:amrPath]){
|
||
NSData *test=[NSData dataWithContentsOfFile:amrPath];
|
||
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
|
||
//接收类型不一致请替换一致text/html或别的
|
||
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json",
|
||
@"text/html",
|
||
@"image/jpeg",
|
||
@"image/png",
|
||
@"application/octet-stream",
|
||
@"text/json",
|
||
@"audio/amr",
|
||
nil];
|
||
NSString *string=@"http://gameapi.0791ts.cn/api/UpLoad/PostFile";
|
||
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
|
||
formatter.dateFormat =@"yyyyMMddHHmmss";
|
||
NSString *str = [formatter stringFromDate:[NSDate date]];
|
||
NSString *fileName = [NSString stringWithFormat:@"%@%08X.amr", str, arc4random()];
|
||
[manager POST:string parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
|
||
// NSData *imageData =UIImageJPEGRepresentation([UIImage imageNamed:@"sharelogo.jpg"],1);
|
||
//上传的参数(上传图片,以文件流的格式)
|
||
[formData appendPartWithFileData:test name:@"file" fileName:fileName mimeType:@"audio/amr"];
|
||
|
||
} success:^(NSURLSessionDataTask *_Nonnull task, id _Nullable responseObject) {
|
||
|
||
NSString *audiourl=[NSString stringWithFormat:@"http://gameapi.0791ts.cn/upload/%@",fileName];
|
||
[_bridge callHandler:@"getaudiourl" data:@{ @"audiourl":audiourl,@"time":[NSString stringWithFormat:@"%ld",(long)time]} ];
|
||
NSLog(@"上传成功");
|
||
} failure:^(NSURLSessionDataTask *_Nullable task, NSError * _Nonnull error) {
|
||
NSLog(@"上传失败");
|
||
}];
|
||
}else
|
||
NSLog(@"wav转amr失败");
|
||
|
||
}
|
||
|
||
|
||
#pragma mark - 微信回调
|
||
- (void)managerDidRecvMessageResponse:(SendMessageToWXResp *)response {
|
||
if(response.errCode==0)
|
||
{
|
||
[_bridge callHandler:@"sharesuccess" data:@{ @"success":@"2",@"type":[NSString stringWithFormat:@"%d",[self.UserType intValue]]} ];
|
||
}
|
||
|
||
}
|
||
- (void)managerDidRecvAuthResponse:(SendAuthResp *)response {
|
||
if (response.code==nil) {
|
||
[FuncPublic ShowAlert:@"授权失败"];
|
||
return;
|
||
}
|
||
//1.创建一个web路径
|
||
NSString *urlStr=[NSString stringWithFormat:@"https://api.weixin.qq.com/sns/oauth2/access_token?code=%@&secret=%@&appid=%@&grant_type=authorization_code",response.code,Appsecret,kAuthOpenID];
|
||
|
||
urlStr=[urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||
NSURL *url=[NSURL URLWithString:urlStr];
|
||
|
||
//通过URL设置网络请求
|
||
NSURLRequest *request = [[NSURLRequest alloc]initWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10];
|
||
|
||
NSError *error=nil;
|
||
//获取服务器数据
|
||
NSData *requestData= [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:&error];
|
||
if (error) {
|
||
NSLog(@"错误信息:%@",[error localizedDescription]);
|
||
[FuncPublic ShowAlert:@"授权失败"];
|
||
return;
|
||
}
|
||
NSString *result=[[NSString alloc]initWithData:requestData encoding:NSUTF8StringEncoding];
|
||
NSLog(@"返回结果:%@",result);
|
||
if (result==nil) {
|
||
[FuncPublic ShowAlert:@"授权失败"];
|
||
return;
|
||
}
|
||
NSString* stra = [[NSString alloc] initWithData:requestData encoding:NSUTF8StringEncoding]; //转换信息
|
||
//去除两边空格
|
||
NSString* str = [[NSString alloc]initWithFormat:@"%@",[stra stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
|
||
|
||
|
||
NSDictionary * obj_return = [str JSONValue];
|
||
NSString *access_token=[obj_return objectForKey:@"access_token"];
|
||
NSString *openid=[obj_return objectForKey:@"openid"];
|
||
|
||
NSString *webPath=[NSString stringWithFormat:@"https://api.weixin.qq.com/sns/userinfo?access_token=%@&openid=%@",access_token,openid];
|
||
|
||
webPath=[webPath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||
NSURL *urltwo=[NSURL URLWithString:webPath];
|
||
|
||
//通过URL设置网络请求
|
||
NSURLRequest *requesttwo = [[NSURLRequest alloc]initWithURL:urltwo cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10];
|
||
|
||
NSError *errortwo=nil;
|
||
//获取服务器数据
|
||
NSData *requestDatatwo= [NSURLConnection sendSynchronousRequest:requesttwo returningResponse:nil error:&errortwo];
|
||
if (errortwo) {
|
||
NSLog(@"错误信息:%@",[errortwo localizedDescription]);
|
||
}else{
|
||
NSString *resulttwo=[[NSString alloc]initWithData:requestDatatwo encoding:NSUTF8StringEncoding];
|
||
NSLog(@"返回结果:%@",resulttwo);
|
||
|
||
}
|
||
NSString* stra_ = [[NSString alloc] initWithData:requestDatatwo encoding:NSUTF8StringEncoding]; //转换信息
|
||
//去除两边空格
|
||
NSString* str_ = [[NSString alloc]initWithFormat:@"%@",[stra_ stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
|
||
NSDictionary * obj_returntwo= [str_ JSONValue];
|
||
NSLog(@"obj_do:%@", obj_returntwo);
|
||
NSString* nickname=[obj_returntwo objectForKey:@"nickname"];
|
||
// NSString* nickname=@"chao'chao";
|
||
nickname = [nickname stringByReplacingOccurrencesOfString:@"'" withString:@""];
|
||
|
||
[_bridge callHandler:@"sharelogin" data:@{ @"openid":[obj_returntwo objectForKey:@"openid"],@"headimgurl":[obj_returntwo objectForKey:@"headimgurl"],@"nickname":nickname ,@"sex":[obj_returntwo objectForKey:@"sex"] ,@"city":[FuncPublic danbian:[obj_returntwo objectForKey:@"city"]] ,@"Province":[FuncPublic danbian:[obj_returntwo objectForKey:@"province"]] ,@"unionid":[obj_returntwo objectForKey:@"unionid"] } ];
|
||
}
|
||
#pragma mark - 手机震动
|
||
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event
|
||
{
|
||
if (motion == UIEventSubtypeMotionShake)
|
||
{
|
||
if(canshake)
|
||
{
|
||
[_bridge callHandler:@"shakeEnd" data:nil];
|
||
if(canvoice)
|
||
{
|
||
NSURL *url_=[[NSBundle mainBundle]URLForResource:@"shake_sound_male" withExtension:@"mp3"];
|
||
AVAudioPlayer *audioPlayer=[[AVAudioPlayer alloc]initWithContentsOfURL:url_ error:Nil];
|
||
[audioPlayer prepareToPlay];
|
||
[audioPlayer play];
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
/*
|
||
地图定位
|
||
*/
|
||
- (void)configLocationManager
|
||
{
|
||
self.locationManager = [[AMapLocationManager alloc] init];
|
||
[self.locationManager setDelegate:self];
|
||
//设置期望定位精度
|
||
[self.locationManager setDesiredAccuracy:kCLLocationAccuracyHundredMeters];
|
||
//设置不允许系统暂停定位
|
||
[self.locationManager setPausesLocationUpdatesAutomatically:NO];
|
||
//设置允许在后台定位
|
||
// [self.locationManager setAllowsBackgroundLocationUpdates:YES];
|
||
//设置允许连续定位逆地理
|
||
[self.locationManager setLocatingWithReGeocode:YES];
|
||
//设置定位超时时间
|
||
[self.locationManager setLocationTimeout:DefaultLocationTimeout];
|
||
//设置逆地理超时时间
|
||
[self.locationManager setReGeocodeTimeout:DefaultReGeocodeTimeout];
|
||
|
||
}
|
||
|
||
- (void)cleanUpAction
|
||
{
|
||
//停止定位
|
||
[self.locationManager stopUpdatingLocation];
|
||
[self.locationManager setDelegate:nil];
|
||
}
|
||
- (void)reGeocodeAction
|
||
{
|
||
//进行单次带逆地理定位请求
|
||
[self.locationManager requestLocationWithReGeocode:YES completionBlock:self.completionBlock];
|
||
}
|
||
|
||
- (void)locAction
|
||
{
|
||
//进行单次定位请求
|
||
[self.locationManager requestLocationWithReGeocode:NO completionBlock:self.completionBlock];
|
||
}
|
||
|
||
#pragma mark - Initialization
|
||
|
||
- (void)initCompleteBlock
|
||
{
|
||
//__weak RootVC *weakSelf = self;
|
||
self.completionBlock = ^(CLLocation *location, AMapLocationReGeocode *regeocode, NSError *error)
|
||
{
|
||
if (error)
|
||
{
|
||
NSLog(@"locError:{%ld - %@};", (long)error.code, error.localizedDescription);
|
||
|
||
//如果为定位失败的error,则不进行后续操作
|
||
if (error.code == AMapLocationErrorLocateFailed)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
|
||
//得到定位信息
|
||
if (location)
|
||
{
|
||
if (regeocode)
|
||
{
|
||
NSLog(@"%@",[NSString stringWithFormat:@"%@ \n %@-%@-%.2fm", regeocode.formattedAddress,regeocode.citycode, regeocode.adcode, location.horizontalAccuracy]);
|
||
if(regeocode.formattedAddress!=nil)
|
||
{
|
||
@try{
|
||
[_bridge callHandler:@"getlocationinfo" data:@{@"address":regeocode.formattedAddress,@"city":regeocode.city,@"cityCode":regeocode.citycode,@"country":regeocode.country,@"district":regeocode.district,@"latitude":[NSString stringWithFormat:@"%f",location.coordinate.latitude],@"longitude":[NSString stringWithFormat:@"%f",location.coordinate.longitude],@"province":regeocode.province,@"street":regeocode.street} ];
|
||
} @catch (NSException * e) {
|
||
NSLog(@"Exception: %@", e);
|
||
}
|
||
}
|
||
|
||
|
||
}else
|
||
{
|
||
|
||
NSLog(@"%@",[NSString stringWithFormat:@"lat:%f;lon:%f \n accuracy:%.2fm", location.coordinate.latitude, location.coordinate.longitude, location.horizontalAccuracy]);
|
||
}
|
||
|
||
|
||
}
|
||
|
||
};
|
||
}
|
||
|
||
#pragma mark - AMapLocationManager Delegate
|
||
|
||
- (void)amapLocationManager:(AMapLocationManager *)manager didFailWithError:(NSError *)error
|
||
{
|
||
NSLog(@"%s, amapLocationManager = %@, error = %@", __func__, [manager class], error);
|
||
}
|
||
|
||
- (void)amapLocationManager:(AMapLocationManager *)manager didUpdateLocation:(CLLocation *)location reGeocode:(AMapLocationReGeocode *)reGeocode
|
||
{
|
||
NSLog(@"location:{lat:%f; lon:%f; accuracy:%f; reGeocode:%@}", location.coordinate.latitude, location.coordinate.longitude, location.horizontalAccuracy, reGeocode.formattedAddress);
|
||
if (reGeocode!=nil) {
|
||
if(reGeocode.formattedAddress!=nil)
|
||
{
|
||
@try{
|
||
[_bridge callHandler:@"getlocationinfo" data:@{@"address":reGeocode.formattedAddress,@"city":reGeocode.city,@"cityCode":reGeocode.citycode,@"country":reGeocode.country,@"district":reGeocode.district,@"latitude":[NSString stringWithFormat:@"%f",location.coordinate.latitude],@"longitude":[NSString stringWithFormat:@"%f",location.coordinate.longitude],@"province":reGeocode.province,@"street":reGeocode.street} ];
|
||
} @catch (NSException * e) {
|
||
NSLog(@"Exception: %@", e);
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
@end
|
||
|
||
|