Questions tagged [ckasset]

CKAsset is a class of the CloudKit Framework

A CKAsset object represents a large file associated with a record. Use asset objects to incorporate external files—such as image, sound, video, text, and binary data files—into your app’s records.

Reference

39 questions
1
vote
1 answer

How do I store mp4 file as Data or NSData object in iOS?

How would I store media of type mp4 as an object of Data or NSData in iOS? I need to do this as a step toward saving the mp4 file as a CKAsset in CloudKit. I would like to do what this post on stackoverflow does with an image object, except I want…
daniel
  • 1,446
  • 3
  • 29
  • 65
1
vote
1 answer

Saving CloudKit Record to Local File Saves all fields Except CKAsset

I am trying to save an array of CKRecords to the documents directory in order to have fast startup and offline access. Downloading the CKRecords from CloudKit works fine and I am able to use the CKAsset in each record without issue. However, when I…
JohnSF
  • 3,736
  • 3
  • 36
  • 72
1
vote
0 answers

Crash on accessing CKAsset fileURL property on Swift 3 on iOS 9

Accessing CKAsset fileURL property using Swift 3 on a iOS 9 device (or macOS 10.11) for a synced asset on CloudKit crashes with error URL._unconditionallyBridgeFromObjectiveC(NSURL?) -> URL (). when the records are fetched using…
Mihai Panţiru
  • 513
  • 3
  • 16
1
vote
3 answers

NSData - Write to temporary file / directory

I am a little lost on my quest to - Download a CKAsset (PDF File) Assign a Temporary Filename Write the contents of the CKAsset to the filename I have managed to download the CKAsset and display the contents in a UIWebView, however I am stumbling…
Bowcaps
  • 127
  • 2
  • 11
1
vote
0 answers

CloudKit won't play CKAsset Song Swift 3

I have a song stored in CloudKit as a CKAsset. I successfully retrieve the song and get no error but it just won't play. Any help would be appreciated, thanks. My AVPlayer is lazily instantiated within the class. //Create song player to play song,…
Clayton C.
  • 863
  • 1
  • 8
  • 17
1
vote
1 answer

How to avoid the retransfer of large CKAssets, following other data updates

I have a large image stored as a CKAsset, as part of a record that also contains a date and other details which may potentially change. The image and other details are all stored locally in my app. If I change the date (say) and try to resubmit the…
Peter Johnson
  • 3,764
  • 1
  • 23
  • 27
1
vote
0 answers

CKAsset screwing up file url in Xcode 8 beta 6 / Swift 3

I am trying to upload an UIImage to CloudKit in two steps: get a file URL for my UIImage get an CKAsset for my file URL However, when debugging the CKAsset I create in the second step I noticed that the file path to my image doesn't exist and…
MarkyMark
  • 11
  • 3
1
vote
2 answers

How to Initialize a CKAsset?

I have a class that has a CKAsset (image file) that pulls data from CloudKit. However, I can't figure out how to initialize the CKAsset. I don't have the data at the time of initialization. The class has strings as well, but I can use "" to…
ALTVisual
  • 116
  • 10
1
vote
0 answers

CloudKit giving "Asset File Not Found" error

I'm using this code to upload an asset, given a path: func uploadFile(filePath: String) { let fileURL = NSURL(fileURLWithPath: filePath) let asset = CKAsset(fileURL: fileURL) let assetRecord = CKRecord(recordType:…
Andrew
  • 7,693
  • 11
  • 43
  • 81
1
vote
1 answer

Are there issues with an array of CKAssets in a single CKRecord?

The app I'm writing will let people store several photos, and associate them with a single object. I thought I would use CloudKit, to store these images, as CKAssets. In CloudKit, besides the other property-list types, I can create a CKAsset, and…
Dan Morrow
  • 4,433
  • 2
  • 31
  • 45
1
vote
1 answer

How to check CKAsset changes with CKSubscription?

How do you check whether an image stored with CKAsset has changed in CloudKit? CKNotification doc says about desiredKeys: You can include a maximum of three keys in the array. For the keys you specify, the allowable values are NSString, NSNumber,…
János
  • 32,867
  • 38
  • 193
  • 353
0
votes
1 answer

Created record in CloudKit with CKAsset but the asset is always nil when fetching, other attributes are ok

I create a record in CloudKit using the CloudKit Dashboard. The record also contains an attribute for a photo, which I upload before saving the record. The photo data is stored in an attribute of the type CKAsset. In the entity core data date model…
Frank Marx
  • 151
  • 11
0
votes
0 answers

Is CKAsset image metdata preserved?

Just making sure I'm not missing something before I go implementing another way to store metadata for the images I upload as CKAssets. Right now I've added an extension to CKAsset like so: extension CKAsset { func getMetadata() ->…
Chris
  • 7,830
  • 6
  • 38
  • 72
0
votes
1 answer

Storing media to CloudKit as CKAsset works for images only, no longer for videos

I am having an issue with saving videos to CloudKit as CKAsset. While the example code below works for saving images only (set videoSelection to false), I was able to use it in the past also for storing videos to CloudKit. I am currently using XCode…
Carl
  • 21
  • 3
0
votes
1 answer

CKAsset fetch PDF and present in UIWebView Swift3

A have a CKRecord which contains details of a course, I can fetch all the records and manipulate them as required within a particular view. I am having a little problem with the CKAsset, which is a pdf. My image CKAsset fetch and display in a…
Bowcaps
  • 127
  • 2
  • 11