This is more a general question of whether it is possible to share persistent/coredata from the main app to Screentime-related extensions such as DeviceActivityReportExtension.
I've set my code up (e.g., App Groups, files to different targets, using nspersistentcontainer with app group url, etc.) in a way that it builds, and the extension seems to recognize my CoreData schema (able to query using fetchrequest). But the data returned is always null. So i'm wondering if it is even possible to READ app data from the extension.
I understand it is not possible to write or pass data from the extension back to the app. I've also been able to read data that was saved in main app from UserDefaults in my extension.
Post
Replies
Boosts
Views
Activity
I have an existing app with a target of iOS 13.2. After upgrading to MacOS 11.0 Big Sur, I can't distribute the app using Xcode 11.6 or Xcode 12.
When I attempt to distribute with Xcode 11.6, I get this error: https://developer.apple.com/forums/thread/650438
When I try to distribute using Xcode 12, I get these errors:
App Store Connect Operation Error. Communication error. Please use diagnostic mode to check connectivity. You need to have outbound access to TCP port 443.
App Store Connect Operation Error. An exception has occurred: java.security.DigestException: partial digests not returned
App Store Connect Operation Error. Could not connect to Apple's web service.
When I export to distribute manually using Transporter, I get an "Invalid toolchain" error.
Any help would be appreciated ...
I have a naive implementation of the new PHPicker in SwiftUI (code below). When running on a separate device (iPhone 6s, iOS 14.0), I am able to load some images, but not others.
The images that do not load seem to encounter a permissions error:
// [...] indicates redacted content for brevity
[...] [default] [ERROR] Could not create a bookmark: NSError: Cocoa 257 "The file couldn’t be opened because you don’t have permission to view it." }
[...] [claims] Upload preparation for claim [...] completed with error: Error Domain=NSCocoaErrorDomain Code=260 "The file “[...].jpeg” couldn’t be opened because there is no such file." UserInfo={NSURL=[...]{Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
I'm a little confused because I thought a core value proposition of the new PHPicker was that it automatically allowed access to selected photos.
When I try selecting an image using Simulator, I just get the second error (does not exist), but not the first.
I'm also noticing that the main photos grid does not seem to automatically update with new photos, even though the "Recent" album does. I have to force quit and restart the app to see the latest photos appear, though I have not been able to load any of them due to the issue described above.
//
// PhotoPicker.swift
// NewParis
//
// Created by Yihwan Kim on 7/12/20.
//
import SwiftUI
import UIKit
import PhotosUI
struct PhotoPicker: UIViewControllerRepresentable {
@Binding var isPresented: Bool
@Binding var selectedImage: Image?
func makeUIViewController(context: Context) -> PHPickerViewController {
var configuration = PHPickerConfiguration(photoLibrary: PHPhotoLibrary.shared())
configuration.filter = .images
let controller = PHPickerViewController(configuration: configuration)
controller.delegate = context.coordinator
return controller
}
func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) { }
func makeCoordinator() -> Coordinator {
Coordinator(self)
}
class Coordinator: PHPickerViewControllerDelegate {
private let parent: PhotoPicker
init(_ parent: PhotoPicker) {
self.parent = parent
}
func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
parent.isPresented = false
if let itemProvider = results.first?.itemProvider, itemProvider.canLoadObject(ofClass: UIImage.self) {
itemProvider.loadObject(ofClass: UIImage.self) { [weak self] uiImage, error in
DispatchQueue.main.async {
guard let self = self, let uiImage = uiImage as? UIImage else { return }
self.parent.selectedImage = Image(uiImage: uiImage)
}
}
}
}
}
}