Posts

Post marked as solved
2 Replies
1.5k Views
Hi! I'm exploring options to prevent date tampering on my app. One of those options involves obtaining the uptime of the device using sys/sysctl.h which I understand is an approved and supported way to do for macOS but I'm not sure if it would be approved during an Apple Review for my iOS app. Does anyone know or have experience with this? Is it ok or will it get my app rejected? I leave my code as reference here: #include <sys/types.h> #include <sys/sysctl.h> + (time_t)uptime {     struct timeval boottime;     int mib[2] = {CTL_KERN, KERN_BOOTTIME};     size_t size = sizeof(boottime);     time_t now;     time_t uptime = -1;     (void)time(&now);     if (sysctl(mib, 2, &boottime, &size, NULL, 0) != -1 && boottime.tv_sec != 0) {         uptime = now - boottime.tv_sec;     }     return uptime; } Thanks for any help you could provide
Posted Last updated
.
Post marked as solved
2 Replies
1.7k Views
Hi! I've been required to show signal strength of the network a device is connected to (cellphone data or wifi), just like the image above. Is there a way to obtain the signal strength (how many bars) or a way to calculate it? (with dBm values maybe) that is approved by Apple? I know there are a lot of posts already asking this but most are about 6 years old and I don't know if anything has changed since that. I read that at some point you could do it with Core Telephony but not anymore. Then I read something about Network Extensions Entitlement but posts about that were about 4 to 6 years old. If Apple is not allowing that, I'm going to need documentation or something official to back me up when I inform this, so if anyone knows if it exists and can share, it would be much appreciated.
Posted Last updated
.
Post marked as solved
2 Replies
767 Views
Hi, I think I never thought about this but... let's say I have my iOS app (swift) and I have a ViewController with a WKWebView. If I open a link of a page with a pdf, where are the pdf and that page's files stored? Is there a way to clean the directory in which those files get stored? Is it something I shouldn't worry about? Thanks in advance
Posted Last updated
.
Post marked as solved
1 Replies
3.1k Views
Hi, I have a ViewController that presents another ViewController as a modal over full screen when a button is touched. let vc = UIStoryboard(name: "***", bundle: nil).instantiateViewController(withIdentifier: "OverFullScreenModalViewController") as! OverFullScreenModalViewController vc.modalPresentationStyle = .overFullScreen vc.modalTransitionStyle = .crossDissolve self.present(vc, animated: true, completion: nil) Then, on my modal ViewController I have a button that, when touched, I want to present a confirmation alert @IBAction func handleDelete(_ sender: Any) {         let negativeHandler:((Any) -> ()) = {(_) in             //do nothing         }         let handler:((Any) -> ()) = {(_) in             // Delete         }         DispatchQueue.main.async {             let alert = UIAlertController(title: "Please confirm", message: "Are you sure?", preferredStyle: .alert)             let positiveAction = UIAlertAction(title: "yes", style: .default, handler: handler)             alert.addAction(UIAlertAction(title: "no", style: .cancel, handler: negativeHandler))             alert.addAction(positiveAction)             alert.preferredAction = positiveAction             self.present(alert, animated: true)         } } But what happens is that the modal is dismissed and I get this error on the console: [Presentation] Attempt to present <UIAlertController: 0x7ff78d37cc00> on <OverFullScreenModalViewController: 0x7ff792814200> (from <OverFullScreenModalViewController: 0x7ff792814200>) whose view is not in the window hierarchy. I've tried with and without DispatchQueue.main.async, nothing is trying to be presented on viewDidLoad, viewWillAppear or viewDidAppear Any ideas?
Posted Last updated
.
Post not yet marked as solved
0 Replies
867 Views
Hi, I have an app that uses AVPlayer to stream and play videos (HLS) but I'm struggling to find a way to do the same with fmp4. This is what I use to play my HLS stream. I tried just to replace the url with the fmp4 one but it does not work. private func connect() {         let stringUrl = "https://wolverine.raywenderlich.com/content/ios/tutorials/video_streaming/foxVillage.m3u8"         let url = URL(string: stringUrl)!         let asset = AVURLAsset(url: url)         let item = AVPlayerItem(asset: asset)         if #available(iOS 10.0, *) {             item.preferredForwardBufferDuration = Double(50000) / 1000         }         if #available(iOS 13.0, *) {             item.automaticallyPreservesTimeOffsetFromLive = true         }         self.player = AVPlayer(playerItem: item)         let playerLayer = AVPlayerLayer(player: self.player)         playerLayer.frame = self.playerView.bounds         playerLayer.videoGravity = .resizeAspect         self.playerView.layer.addSublayer(playerLayer)         self.videoLayer = playerLayer         self.videoLayer?.frame = self.playerView.bounds         player?.play()     } I haven't got any luck looking for a possible solution and I'm out of ideas. I'll be really grateful if anyone of you could point me to a good direction.
Posted Last updated
.