2010-08-25 74 views
0

請確定我可以如何與iPhone進行通話。如何以編程方式實例化來自iPhone的電話

下面是我寫的代碼,但點擊按鈕時沒有任何反應。這是模擬器的問題,它會在電話上工作,還是在代碼中有任何錯誤?

- (void)applicationDidFinishLaunching:(UIApplication *)application { 

    UIButton *uiButton_G_obj = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 
    uiButton_G_obj.frame = CGRectMake(80, 30, 80, 30); 
    [uiButton_G_obj addTarget:self action:@selector(buttonAction:)forControlEvents:UIControlEventTouchUpInside]; 
    [self.view addSubview:uiButton_G_obj]; 
    [window addSubview:self.view]; 

    // Override point for customization after application launch 
    [window makeKeyAndVisible]; 
} 
-(void)buttonAction:(id)sender{ 
    NSLog(@"Inside button action"); 
    [[UIApplication sharedApplication]openURL:[NSURLURLWithString:@"tel:12125551212"]]; 
} 

因此,在按鈕的點擊只

「內部按鈕動作」

線印刷......但沒有電話呼叫業務實例:(請幫助我出局了。

我只想知道,我怎樣才能以編程方式實例化一個通話服務?

回答

0

是的,這顯然不適用於模擬器。它應該在一個真實的設備上正常工作,在那裏它會彈出一個對話框並詢問用戶是否要開始撥號。

+0

好的感謝YOu .... – VinuthnaS 2010-08-26 08:45:07

相關問題