uiimage - UIDevice.currentDevice().model not returning as a simulator anymore -


i have image i'm generating in app, , trying save in simulator examine after generation. in previous versions of app, save image computer while running on simulator, use following code:

    let img = self.getimagefromdrawingview()     uiimagewritetosavedphotosalbum(img, self, "image:didfinishsavingwitherror:contextinfo:", nil)      let string = uidevice.currentdevice().model     if ( string nsstring).containsstring("simulator")     {          let documentsdirectoryurl = nsfilemanager().urlsfordirectory(.documentdirectory, indomains: .userdomainmask).first nsurl!          let fileurl = documentsdirectoryurl.urlbyappendingpathcomponent("image" + savedimagecounter.description + ".jpg")         nslog("doc url " + documentsdirectoryurl.description)         uiimagejpegrepresentation(img, 1.0)!.writetourl(fileurl, atomically: true)     } 

the following line :

let string = uidevice.currentdevice().model 

used return "ipad simulator" , able save photos known location on computer. however, call returns "ipad" or 'iphone' , simulator portion isn't there anymore. how know image saved locally on computer can't tell simulator saves them?

would love input.

don't things @ runtime. there's no reason @ runtime can @ build time. use targetconditionals.h , like:

#if target_os_simulator     nslog(@"this simualtor."); #else     nslog(@"this device."); #endif 

as determining container on disk, run:

xcrun simctl get_app_container booted com.mycompany.myapp 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -