0

MKMapView を持つ ViewController でいくつかの単体テストを行っています。

mapview が nil でないかどうかをテストしたい場合は、明示的に初期化する必要があります。それ以外の場合は mapview を使用する必要はありません。

#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import <CoreLocation/CoreLocation.h>

@interface HomeVC : UIViewController <UIImagePickerControllerDelegate, CLLocationManagerDelegate, MKMapViewDelegate> {

  MKMapView* mapView;
  CLLocationManager* locationManager;
  CLLocationCoordinate2D currentLocation;

}
@property (nonatomic, strong) IBOutlet MKMapView* mapView;
@property(nonatomic, strong)CLLocationManager* locationManager;
@property(nonatomic)CLLocationCoordinate2D currentLocation;
@end 

@implementation HomeVC
@synthesize mapView, cameraButton,cameraView, locationManager, currentLocation;


- (void)viewDidLoad
{
  [super viewDidLoad];   
  self.mapView = MKMapView.new;
  self.mapView.mapType = MKMapTypeStandard;
}

マップの初期化後にブレークポイントを配置すると、UIView プロパティのみで初期化された mapView が表示されます。ストーリーボード ファイルに適切に接続されています。うまく動作しますが、プロパティをテストすることはできません。

4

0 に答える 0