Post

Replies

Boosts

Views

Activity

Where do files, airdropped onto an iPad, end up?
Friends I have buiIt an app for iPadOS using Swift. I am sharing data with the iPad using Air Drop (or email attachments). CSV, or JSON, formatted files I have set the XML in Info.plist. My question is: Where does it end up on the iPad? Using FileManager, how do I read it? <key>LSItemContentTypes</key> <array> <string>public.comma-separated-values-text</string> <string>public.json</string> <string>org.openxmlformats.spreadsheetml.sheet</string> </array>
0
0
360
May ’23
Software updated - Xcode will no longer do iPad development
I was prompted to update system software on Mac and iPad. Now at: iPad OS "16.4.1" MacOS "13.3.1" When I try to debug my app in Xcode I get: "This operation can fail if the version of the OS on the device is incompatible with the installed version of Xcode. You may also need to restart your Mac and device in order to correctly detect compatibility." I have restarted both machines, and it stays the same. I am quite grumpy about this
3
0
577
Apr ’23
Sending a text file to an iOS app
Friends I need to send a text file of CSV data to my iOS app. I cannot find any example code for how to do it, and I am stumped. I imagining the user will be on a device that can send the file to my iOS app using Air Drop. I have seen a lot of partial information about: UIActivityViewController: I am using this to go in the opposite direction. Getting a PDF file generated in my app off the iPad UIFileSharingEnabled and LSSupportsOpeningDocumentsInPlace. This suggests that if I set these to true in info.plist then my apps document directory will show up in the files app. Not as far as I can tell. Perhaps I am doing it wrong?
3
0
1.4k
Apr ’23
Memeory leaks in regular expressions
Hi let regex1 = #"^[0-9]{4}-[0-9][0-9]?-[0-9][0-9]?$"# let range1 = input.range(of: regex1, options: .regularExpression) let string1:String if range1 != nil { string1 = input + "T00:00:00.000" }else{ let range = NSRange(location: 0, length: input.utf8.count) let pattern = "^([0-9]{4}-[0-9][0-9]-[0-9][0-9]).([0-2][0-9]:[0-5][0-9]:[0-6][0-9]\\.[0-9][0-9][0-9])$" let regEx = try! NSRegularExpression( pattern: pattern, options: [] ) if let match = regEx.firstMatch(in: input, options: [], range: range){ let d1 = Range(match.range(at: 1), in: input) let d2 = Range(match.range(at: 2), in: input) if d1 != nil && d2 != nil { string1 = input[d1!] + "T" + input[d2!] }else{ string1 = "" } } } Called that < 1_000_000 times and used up 5G of memory
3
0
576
Feb ’23
What is the propper procedure for using an iOS app on a private network?
There is a difficulty is when using a HTTP connection. It must be HTTPS (with some exceptions that I will not bother with). It is not possible to use certificates signed be a known authority on internal networks. The approach we are taking is to create our own signing authority, install the root certificate on the iPads using the network, and issue our own (our customers own) certificates. On another post here I am advised: Using a self-signed leaf certificate puts you far off the well-trodden path, and it’s something I actively recommend against. What is the proper, "Apple way" to achieve this? Using the self-signed certificate root is causing some of our customers conniptions. They are not sure if they have the correct root certificates installed, and the connections are failing. There must be a better way.
1
0
555
Nov ’22
Xcode/GitHub integration broken
As of yesterday I cannot push/pull from GitHub using Xcode. I can still push/pull from command line. I get the error (in Xcode) ERROR: You're using an RSA key with SHA-1, which is no longer allowed. Please use a newer client or a different key type I am using MacOS 12.2.1 Xcode: 13.2.1
4
4
7.5k
Mar ’22
How can folders visible to FIles app be created by App?
Using the Files app on iOS I can see folders created by Apps I installed from the App store. How can I create such a folder in my app? I can create folders in the app's bundle, I can share files into the file system where the Files app can find them. But I cannot create folders that the files app can see, or set that folder as the default place to save files Setting Supports Document Browser and in Custom iOS Target Properties is not sufficient
0
0
603
Jan ’22
UIActivityViewController: Changing default file name
When I use UIActivityViewController to share a PDF file (or save it to the file system) the default file name is: PDF document when saved to file or something like PDF document-3A147CA34B5F when air dropped. Is there a way I can change the default file name? Can I set the default folder when using "Save to files"? I am using: struct PDFSaveController: UIViewControllerRepresentable { // https://stackoverflow.com/a/58341956/16675319 var activityItems: [Any] var applicationActivities: [UIActivity]? = nil func makeUIViewController(context: UIViewControllerRepresentableContext<PDFSaveController>) -> UIActivityViewController { let controller = UIActivityViewController(activityItems: activityItems, applicationActivities: applicationActivities) return controller } func updateUIViewController(_ uiViewController: UIActivityViewController, context: UIViewControllerRepresentableContext<PDFSaveController>) {} }
1
0
2.3k
Jan ’22
UIImageWriteToSavedPhotosAlbum unreliable
UIImageWriteToSavedPhotosAlbum is not working reliably for me. It seems to work about a third of the times I call it. When I say does not work, I mean the callback is not called, and it silently returns When I use the code snipped below I get the results: Call UIImageWriteToSavedPhotosAlbum Called UIImageWriteToSavedPhotosAlbum If I call it twice in a row sometimes the first call works, never the second. Neither of the print statements in the callback are executed class ImageSaver: NSObject { func writeToPhotoAlbum(image: UIImage) { print("Call UIImageWriteToSavedPhotosAlbum") UIImageWriteToSavedPhotosAlbum(image, self, #selector(image(_:didFinishSavingWithError:contextInfo:)), nil) print("Called UIImageWriteToSavedPhotosAlbum") } // https://www.hackingwithswift.com/example-code/media/uiimagewritetosavedphotosalbum-how-to-write-to-the-ios-photo-album @objc func image(_ image: UIImage, didFinishSavingWithError error: NSError?, contextInfo: UnsafeRawPointer) { if let error = error { // we got back an error! print("Error: \(error.localizedDescription)") } else { print ("Image saved") } } }
2
0
1.6k
Dec ’21
What are the meanings of the fields in mach_task_basic_info()
tl;dr Where is there documentation for the implementation of mach_task_basic_info on iOS? There is a lot of conflicting information out there, a lot of micro kernels that use a structure named like this. https://developer.apple.com/documentation/kernel/mach_task_basic_info_data_t lists the fields (and gives types) as: policy: int resident_size: uint64_t resident_size_max suspend_count system_time user_time virtual_size What are the relative meanings of the *_size variables? resident_size is that the number of bytes used? Number of pages? Is it a total for all processes? The calling process? And so on.
1
0
1k
Nov ’21
iPad has stopped running programmes I develop on Mac/xcode
iPad Pro (11-inch) (2nd generation) Software 14.6 macOS Big Sur Version 11.3.1 Xcode Version 12.0 (12A7209) I have joined a team, I have the iPad logged in to iCloud, I have same credentials in xcode (it is all very complex, I am happy to delve into more details if it will help clear up this problem) I have been having a good run for the past few months, very few problems. Switched teams, new Apple accounts etcetera. Yesterday the App on the iPad/ xcode combination would crash if I set break points, but it ran. Today I get the error: "To run on this device, please update to a version of Xcode that supports iOS 14.6. You can download Xcode from the Mac App Store or the Apple Developer website" I got that message from Windows -> Devices This is costing me a lot of time and effort and my employer a tonne of money.
3
0
674
Aug ’21