I have a game with SpriteKit for iPhone, iPad and Mac. I am gonna make for Apple TV. But I take it override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { doesn't work for tvOS. Then what I am supposed to use to make my buttons selectable and I can press ones?
Post
Replies
Boosts
Views
Activity
I am done with my tvOS app. But I don't have physical Apple TV. However, it is necessary if I want to distribute my app. Currently, Apple TV has already sold out in my country. Can anybody borrow the UDID of Apple TV? 😅
I have an error Cannot assign value of type '[CKRecord]' to type '[CKRecord.ID : Int]'.
Is it possible to convert [CKRecord] to [CKRecord.ID : Int]?
I am using the CloudKit cursor in my app and the cursor works because I can see it from the print (cursor code: https://controlc.com/0d42933b). However, I see nothing on the map (I am using MapKit, CloudKit, and SwiftUI in my project). Below is my View Model:
…
func fetchLocations() {
ckController.database.fetchRecords(with: RecordType.location) { (results, moreComing, error) in
print("fetchRecords: results.count = \(results.count), moreComing = \(moreComing), error = \(String(describing: error))")
if !moreComing {
DispatchQueue.main.async { [self] in
objects = results
}
}
}
}
…
Below is my implementation in the view:
…
.task {
if locationManager.locations.isEmpty {
viewModel.fetchLocations()
}
}
…
Print (I have 155 records):
fetchRecords: results.count = 1, moreComing = true, error = nil
fetchRecords: results.count = 2, moreComing = true, error = nil
…
fetchRecords: results.count = 155, moreComing = true, error = nil
fetchRecords: results.count = 155, moreComing = false, error = nil
Somebody knows solutions? Where is a mistake and how I can see all my elements on the map finally?
I’m trying to make cursor the right way. But it doesn’t work. If I set limit 5, then I can see only 5 records, even I move my finger on the map (I’m using MapKit with CloudKit). If 200 then 200, but have to wait for very long time. I’m sure my cursor is wrong. Who can help me?
func getLocation(completed: @escaping (Result<[AppLocation], Error>) -> Void) {
let sortDescriptor = NSSortDescriptor(key: AppLocation.kName, ascending: true)
let query = CKQuery(recordType: RecordType.location, predicate: NSPredicate(value: true))
query.sortDescriptors = [sortDescriptor]
let operation = CKQueryOperation(query: query)
operation.resultsLimit = 5
operation.query = query
operation.queuePriority = .veryHigh
operation.qualityOfService = .userInteractive
var locations = [AppLocation]()
operation.recordFetchedBlock = { record in
let location = AppLocation(record: record)
locations.append(location)
}
operation.queryCompletionBlock = { (cursor, error) in
DispatchQueue.main.async {
if let error = error {
completed(.failure(error))
} else {
completed(.success(locations))
}
}
}
CKContainer.default().publicCloudDatabase.add(operation)
}
I can see App Clips banner only when app is installed. But see nothing when isn't installed.
My .well-known/apple-app-site-association file:
	"applinks": {
			"apps": [],
			"details": [
					 {
						 "appID":	"ABCDEFG.com.mywebsite.MYAPP",
						 "components": [
							 {
									"/": "/abc",
									"comment": "Matches any URL"
							 }
							 ]
					 }
			 ]
	 },
	 "webcredentials": {
			"apps": [ "ABCDEFG.com.mywebsite.MYAPP" ]
	 },
		"appclips": {
				"apps": ["ABCDEFG.com.mywebsite.MYAPP.Clip"]
		}
}
Associated Domains in the app target and App Clips target are the same: webcredentials, applinks and appclips with my domain.
On the App Store Connect domain Validated and Advanced App Clip Experiences is created.
Banner on the website:
<meta name="apple-itunes-app" content="app-id=1234567890, app-clip-bundle-id=com.mywebsite.MYAPP.Clip">
Where can be a problem?