The memory used jumps to 498 megs when image is loaded but not displayed and drops to 242 megs when viewcontroller is
dropped with nav controllers back button.
UIImage(contentsOfFile: is not supposed to cache, i assume that is where the 240 meg drop is from, but why is half of memory used, 240 megs, being retained?
func save_ImageJPG() -> Bool {
// load tif from app folder image approx 8000 x 6000 pixels
let s = currentMap_Name.replacingOccurrences(of: " ", with: "%20")
let filePath = getDocumentsDirectory().appendingPathComponent("Folder" ).appendingPathComponent(s)
let image = UIImage(contentsOfFile: filePath.path)
// change file type to jpg
let f = URL(string: s)?.deletingPathExtension().absoluteString
let e = URL(string: f! + ".jpg")?.absoluteString
let path = getDocumentsDirectory().appendingPathComponent("TempFolder"
).appendingPathComponent(e!)
if !FileManager.default.fileExists(atPath: path.path) {
let jpgData = (image!.jpegData(compressionQuality: 1.0)!)
try? jpgData.write(to: path)
return true
}
return false
}
or is the let jpgData = (image!.jpegData(compressionQuality: 1.0)!) retaining memory?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I am downloading image files which are in the zip format to a folder in my app files folder.
When the folder is opened the file is shown as .zip and when selected it unzips and creates a new file. In my case it creates a jpg. leaving the zip file also.
My question is, how do I unzip the file with swift since iOS appears to have the capability?
This is a simple test file sharing which I cannot find info on.
the
"(This will become a fault soon.)" from xcode is what is the worrisome, it seems to have developed recently with xcode update?
I don't want to release an app which may soon fail.
class ShareFile_ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Share", style: .plain, target: self, action: #selector(shareFile))
}
@objc func shareFile() {
if let fileURL = Bundle.main.url(forResource: "Skiing", withExtension: "gpx") {
let ac = UIActivityViewController(activityItems: [fileURL], applicationActivities: nil)
present(ac, animated: true, completion: nil)
}
}
}
// this error has been beat to death as don't worry about it.
2022-02-19 16:28:47.644274-0800 ShareFile_Learn[36671:12674168] [db] Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]}
// this warning is my concern since it says it become a fault soon, should I worry about this?
2022-02-19 16:28:47.644370-0800 ShareFile_Learn[36671:12674168] [default] -imageForImageDescriptor: can do IO please adopt -imageForDescriptor: for IO free drawing or -prepareImageForDescriptor: if IO is allowed. (This will become a fault soon.)
Why, when I open an Tiff image in an UIImage I get memory leaks? Leaks shows
"+0xd0 cbz x0, "TIFFReadPlugin::DecodeBlockTiled(IIOImageReadSession*, GlobalTIFFInfo*, ReadPluginData const&, TIFFPluginData const&, IIODecodeFrameParams&)+0x94c"
Anyone have an idea?
my iphone app downloads maps from a website which uses the following for the download link.
col3 recImageMini lazy" style="background-image: url(/img4/usTopo_icons/Browse/ID/ID_Oden_Bay_20200415_TM_tn.jpg);
Apparently fetch won't let my app download without the http(s) prefix.
How can the link be captured so I can add a http prefix?
The links work okay when using a browser on iPad/phone/imac but not when using WKWebkit.
Thanks