我正在尝试获取PhAsset对象.我想隔离iCloud资产.这是我的代码,
PHFetchResult *cloudAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeAny options:nil];
[cloudAlbums enumerateObjectsUsingBlock:^(PHAssetCollection *collection, NSUInteger idx, BOOL *stop){
if(collection != nil){
PHFetchResult *result = [PHAsset fetchAssetsInAssetCollection:collection options:fetchOptions];
[result enumerateObjectsUsingBlock:^(PHAsset *asset, NSUInteger idx, BOOL *stop)
{
// check asset is iCloud asset
}];
}
}];
Run Code Online (Sandbox Code Playgroud)
请告诉我如何找到PHAsset是iCloud资产?
class XYActivity: UIActivity,YouTubeHelperDelegate
{
var youTubeHelper:YouTubeHelper
var uploadURL: String!
override init() {
self.youTubeHelper = YouTubeHelper()
}
override func activityType() -> String? {
return nil
}
//
}
Run Code Online (Sandbox Code Playgroud)
我想将uploadURL公开,即在其他类中分配.当我添加公共领域时,var uploadURL:String!它建议我将其作为内部.我想把它公之于众.请帮忙
我创建了一个NSIndexPath对象但是当我打印其length属性的值时,它总是将值显示为2.
NSIndexPath *index = [NSIndexPath indexPathForItem:0 inSection:4];
Run Code Online (Sandbox Code Playgroud)
{length = 2,path = 4 - 0}
为什么长度总是2?
CGLayer、CALayer 和 CGContext 有什么区别?
我在服务器上注册设备数据,以获得推送通知.这是代码,
[NSURLConnection sendAsynchronousRequest: request
queue: _postQueue
completionHandler: ^(NSURLResponse *response, NSData *responseData, NSError *connectionError) {
if (connectionError) {
//
} else {
NSError *error = nil;
NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData: responseData options: NSJSONReadingMutableContainers error: &error];
}
}];
Run Code Online (Sandbox Code Playgroud)
我得到的错误是
Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (JSON text did not start with array or object and option to allow fragments not set.) UserInfo=0x17057f60 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments …Run Code Online (Sandbox Code Playgroud)