ios - 如何保存NSMutableArray来解析?

标签 ios swift parse-platform nsmutablearray

我有一个名为 thePlaylistNSMutableArray,它包含 MPMediaCollection 列表。我尝试将其保存以进行解析,但该列保持空(未定义),并且解析时该列的类型是Array。我怎样才能正确地做到这一点?

这是我的代码:

let user = PFUser.currentUser()

var thePlaylistData: NSData = NSKeyedArchiver.archivedDataWithRootObject(thePlaylist)

user?.setObject(thePlaylistData, forKey: "userPlaylist")

任何评论或建议都会很棒。

最佳答案

From Parse Documentation:

We do not recommend storing large pieces of binary data like images or documents using NSData fields on PFObject. PFObjects should not exceed 128 kilobytes in size. To store more, we recommend you use PFFile. See the guide section for more details.

您可以使用 PFFile:

 var thePlaylistData: NSData = NSKeyedArchiver.archivedDataWithRootObject(thePlaylist)
 var music= PFObject(className:"Music")
 music["userPlaylist"] = thePlaylistData
 jobApplication.saveInBackground()

关于ios - 如何保存NSMutableArray来解析?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30636031/

相关文章:

ios - 将字符串从 CoreData 转换为 CLLocationDegrees/CLLocationCoordinate2D

ios - 如何在按下按钮时扫描二维码?

ios - 使用尺寸类别在单元格中具有不同布局的 Controller View

ios - 当我只允许保存当前登录的用户时,如何为用户创建逆关系?

ios - 将数百个 PFObject 保存到 Parse 云

ios - 在非父 View 的 UIView 中获取 View 的框架

iPhone OpenGL ES Paint App 笔刷效果

swift - SKLabelNode 非常模糊 [包括屏幕截图]

javascript - parse.com javascript从单个字符串显示一系列扑克牌图像

ios - 检查respondsToSelector 中的属性