Posts

Post not yet marked as solved
2 Replies
881 Views
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.)
Posted
by TerryB77.
Last updated
.
Post marked as solved
3 Replies
3.7k Views
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?
Posted
by TerryB77.
Last updated
.
Post not yet marked as solved
0 Replies
683 Views
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?
Posted
by TerryB77.
Last updated
.
Post not yet marked as solved
0 Replies
366 Views
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
Posted
by TerryB77.
Last updated
.
Post not yet marked as solved
1 Replies
718 Views
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?
Posted
by TerryB77.
Last updated
.
Post not yet marked as solved
0 Replies
423 Views
I have a list of images from my app budle in a tableview, when I select one a view controller/imageview opens with the image. When the view is closed via navcontroller back button I am getting serious memory leaks. The leaks are in the 100mb size. I have used instruments leaks and it seems to only leak when a large Tiff image is rendered and then closed. The call to " 1 ImageIO invocation function for block in TIFFReadPlugin::DecodeBlocks(IIOImageRead*, GlobalTIFFInfo*, ReadPluginData const&, TIFFPluginData" seems to be the culprit. JPG and PNG and small Tif files don't seem to leak. Any Ideas?
Posted
by TerryB77.
Last updated
.
Post marked as solved
2 Replies
526 Views
Searching for tif files in my project bundle was only returning one of 5 files using this code: var pictures = [String]() let fm = FileManager.default let path = Bundle.main.resourcePath! let items = try! fm.contentsOfDirectory(atPath: path) var url: URL? for item in items { url = URL(string: item) if url?.pathExtension == "tif" { print("tif found") print(item) pictures.append(item) } } These five files are in resource folder of project.["ID_Dodge Peak_235936_1967_24000_geo.tif", "Base.lproj", "LargeImages", "ID_Benning Mountain_235241_1996_24000_geo.tif", "_CodeSignature", "META-INF", "Frameworks", "ID_Colburn_235747_1996_24000_geo.tif", "Info.plist", "libswiftRemoteMirror.dylib", "ID_Clark Fork_235695_1996_24000_geo.tif", "PkgInfo", "Assets.car", "embedded.mobileprovision", "ID_Clifty_Mountain_235717_1996_24000_geo.tif"]The search was only finding "ID_Colburn_235747_1996_24000_geo.tif".After looking at other files, I realized the other file names had spaces, so they weren't being found.When I added an underscore to complete other names, they were also found.Question is why?
Posted
by TerryB77.
Last updated
.
Post marked as solved
2 Replies
665 Views
Trying to fmod with a swift function, but my result isn't correct.Result of d should be 1.7 but I am getting 1.699999999999999.This is in both the playground and xcode.It is in the b - (z * c) formula it occurs, any ideas?func Fmod(b: Double, c: Double) -> Double{ let x:Double = b / c //4.404761904761904 let y:Double = x.truncatingRemainder(dividingBy: 1) //0.404761904761904 let z:Double = x - y // 4 print(" zxc = \(z * c)") // 16.8 print("b-zxc = \(b - z * c)") // 1.699999999999999 print(" b = \(b)") " b = 18.5\n" return b - (z * c) // 1.699999999999999}var d = Fmod(b:18.5, c:4.2) //1.699999999999999
Posted
by TerryB77.
Last updated
.