Ios 按钮未运行Xcode

Ios 按钮未运行Xcode,ios,objective-c,Ios,Objective C,我在视图控制器中有此代码,但拨号按钮未运行,图像视图未显示任何内容 // // ViewController.m // EasyBuy // // Created by Moments on 9/2/15. // Copyright (c) 2015 Moments. All rights reserved. // #import "ViewController.h" @interface ViewController () @end @implementation Vi

我在视图控制器中有此代码,但拨号按钮未运行,图像视图未显示任何内容

    //
//  ViewController.m
//  EasyBuy
//
//  Created by Moments on 9/2/15.
//  Copyright (c) 2015 Moments. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    imageview.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@" http://93.95.207.34/easybuy.com/car/car2.png "]]];

    // Do any additional setup after loading the view, typically from a nib.
}
- (IBAction)callus:(id)sender {

    [[ UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel:00962796880853"]];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

您能帮我一下吗?

在您的情况下,字符串中有空格,不能将字符串转换为url
@”http://93.95.207.34/easybuy.com/car/car2.png “
所以这个形象实际上并没有被创造出来

对于ImageView,请使用此代码

NSURL *url = [NSURL URLWithString:@"http://93.95.207.34/easybuy.com/car/car2.png"];

NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *image = [UIImage imageWithData:data];

[imageview setImage:image];   
对于调用过程,请使用以下命令

NSString *phoneStr = @"telprompt://00962796880853";
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneStr]];
并确保已将图像视图和uibutton操作附加到interfaceBuilder(storyboard或.xib)

希望对您有所帮助

在真实设备上检查它

[[ UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://00962796880853"]];

对于ImageView,您添加了空白。你应该修剪一下那个空间。另一件事是你应该在编码后调用url。为了顺利加载图像,您应该使用
dispatch\u get\u global\u queue
在后台队列中调用url。检查()

电话费

NSURL *url = [NSURL URLWithString:[NSString  stringWithFormat:@"telprompt://00962796880853"]];

if ([[UIApplication sharedApplication] canOpenURL:url]) {
    [[UIApplication sharedApplication] openURL:url];
} else
{
    //Call functionality not available.
}

这在interfaceBuilder上是正确的????{@interface ViewController:UIViewController{IBOutlet UIImageView*imageview;u弱IBOutlet UIButton*callus;}@end}所以在设备上检查它,而不是在模拟器上调用模拟器不起作用,您的问题将得到解决
NSURL *url = [NSURL URLWithString:[NSString  stringWithFormat:@"telprompt://00962796880853"]];

if ([[UIApplication sharedApplication] canOpenURL:url]) {
    [[UIApplication sharedApplication] openURL:url];
} else
{
    //Call functionality not available.
}