0

私はQuickBloxのChattAr-iOSプロジェクトに基づいたアプリに取り組んでいます。そのため、次のコードを使用してアプリからWazeアプリを開こうとするたびに、別のアプリと通信できませんUIWebViewController

 - (void) navigateToLatitude:(double)latitude
              longitude:(double)longitude
{
  if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"waze://"]]) {
    //Waze is installed. Launch Waze and start navigation
    NSString *urlStr = [NSString stringWithFormat:@"waze://?ll=%f,%f&navigate=yes", latitude, longitude];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlStr]];
} else {
    //Waze is not installed. Launch AppStore to install Waze app
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.apple.com/us/app/id323229106"]];
    }
}

そこに移動しUIWebViewます。ChatARApplicationそのプロジェクトには、問題を引き起こしている可能性のあるクラスがあります。

ChattARApplication.h

#import <UIKit/UIKit.h>

@interface ChattARApplication : UIApplication

@end

ChattARApplication.m

#import "ChattARApplication.h"
#import "WebViewController.h"
#import "AppDelegate.h"

@implementation ChattARApplication

 -(BOOL)openURL:(NSURL *)url{
    UITabBarController *tabBarControlelr = ((AppDelegate *)self.delegate).tabBarController;
if(tabBarControlelr.selectedIndex != 1){
    return [super openURL:url];
    }

    // handle chat messages' links
    WebViewController *webViewControleler = [[WebViewController alloc] init];
    webViewControleler.urlAdress = [url absoluteString];
    webViewControleler.webView.scalesPageToFit = YES;
    UINavigationController *chatViewController = [tabBarControlelr.viewControllers objectAtIndex:1];
    [chatViewController pushViewController:webViewControleler animated:YES];
    [webViewControleler autorelease];

    return NO;
}

@end
4

2 に答える 2

1

問題を解決しました

この小さなコードの平和はトリックをしました

 if ([[url scheme] isEqualToString:@"waze"]) {
    return [super openURL:url];
}

-(BOOL)openURL:(NSURL *)url

于 2013-01-29T11:15:42.970 に答える
0

main.m

int main(int argc, char *argv[]){
    @autoreleasepool {
        return UIApplicationMain(argc, argv, NSStringFromClass([ChattARApplication class]), NSStringFromClass([AppDelegate class]));
    }
}

問題だと思います。アプリケーションの設定を維持したい場合は、-(BOOL)openURL:(NSURL *)url;

それがあなたを助けることができることを願っています~~

于 2013-01-25T07:07:21.140 に答える