---
title: "Checking asset existance of ALAasset in iOS."  
description: "Checking asset existance of ALAasset in iOS."  
author: "Jayden Bell"  
published: 2016-01-14  
updated: 2016-01-14  
canonical: https://www.mindstick.com/forum/33874/checking-asset-existance-of-alaasset-in-ios  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 1 minute  

---

# Checking asset existance of ALAasset in iOS.

I have an [array](https://www.mindstick.com/articles/335/jagged-array-in-c-sharp-dot-net) of urls that contains ALAsset urls. I want to [check](https://yourviews.mindstick.com/story/2248/never-forget-to-check-these-specifications-before-buying-a-mobile-phone) existance of any specific url.\
I tried this [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii):

```
NSData *assets = [[NSData alloc] initWithContentsOfFile:@"asset-library://asset/asset.PNG?id=0X32031&ext=JPG"];
```

but the nsdata [variable](https://www.mindstick.com/articles/1807/objective-c-data-types-variables-object-creation) [assets](https://yourviews.mindstick.com/view/88517/modern-approaches-to-organizing-and-tracking-property-assets) is always nil. So, how can I [solve this problem](https://answers.mindstick.com/qa/94681/my-google-assistant-shows-completely-different-search-results-from-what-i-ask-how-can-i-solve-this-problem)?

## Replies

### Reply by Tarun Kumar

Here I am providing the code, which helps you to check existance of any specific url.\
this is the code:

```
ALAssetsLibrary *assetLibrary = [[ALAssetsLibrary alloc] init];[assetLibrary assetForURL:imageUrl resultBlock:^(ALAsset *asset){ if(asset){    NSLog(@"Image Exists");    ALAssetRepresentation *assetRepresentation = [asset defaultRepresentation];    UIImage *urlImage = [UIImage imageWithCGImage:[assetRepresentation fullResolutionImage]]; } else {    NSLog(@"Image Does't Exist"); }} failureBlock:^(NSError *error) { NSLog(@"Failure");});
```


---

Original Source: https://www.mindstick.com/forum/33874/checking-asset-existance-of-alaasset-in-ios

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
