My question is how can I disable confirmation on delete request on [PHAssetChangeRequest deleteAssets:assets], if my application created that assets , so my app should able to delete assets without confirmation?
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{ [PHAssetChangeRequest deleteAssets:assets];
} completionHandler:^(BOOL success, NSError *error)
{
NSLog(#"Finished deleting asset. %#", (success ? #"Success." : error.description));
}];
Thanks..
At the moment where the file is saved, it belongs to the system.
So if you want to remove this file later, the user will always be informed by a message.
It's part of the PHPhotoLibrary.. I know it's suck.
Related
I am looking for a way to post 360 photos on Facebook through my iOS app.
I have been searching on google and couldn't find any useful answer.
Could anyone please clarify about the possibility?
Ok, finally I found this thread.
It seems Facebook reads metadata to recognize 360 degree photos.
I've created a framework that does exactly this.
Given that you've got the permission successfully, here's what you would do:
[[Facebook360Manager sharedInstance] shareImage:[UIImage imageNamed:#"cylindrical360.jpg"]
userCaption:#"Example caption..."
horizontalFOV:360.0
sharePreference:FacebookShareManagerPreferenceCylindricalImage
completionBlock:^(NSError * _Nullable error, NSString * _Nullable postID) {
if (error) {
NSLog(#"Error: %#",error);
}else{
NSLog(#"Shared successfully. Post ID: %#",postID);
}
}];
Here's a link to the framework: https://github.com/AppCoders-io/Facebook360
I'm trying to use ODR in my game which doesn't use xcassets.
So, I've got a texture with a tag (e.g. "tutorial"), made it ODR in project settings and used the code below the get it downloaded:
NSBundleResourceRequest *resourceRequest = [[NSBundleResourceRequest alloc] initWithTags:tags];
[resourceRequest conditionallyBeginAccessingResourcesWithCompletionHandler:^(BOOL resourcesAvailable) {
if (resourcesAvailable) {
// Upload the texture
}
else
{
[resourceRequest beginAccessingResourcesWithCompletionHandler:^(NSError * _Nullable error) {
if (error) {
NSLog(#"Failed to load assets pack");
}
else
{
// Upload the texture
}
}];
}
}];
The main bundle doesn't contain the texture in question (I've looked the bundle through in simulator folder). After calling the code above XCode and logs report that it was successfully downloaded and is ready to use.
Where the comment // Upload the texture is I need to call my code for uploading the texture into video memory, but the problem is - I can't get exact location of the downloaded file to do so.
Is there any way to know the location of downloaded assets?
This happened to me today, it was asset image that was linked under
TARGET -> Resource Tags check if any image from assets is added there or not. If its there than remove and rebuild.
There is a bundle provided in NSBundleResourceRequest which you can use to get the resources. See Apple's Docs on NSBundleResourceRequest
I want to pack a lot of products into one for Black Friday.
The upload limit # Parse is 10 MB and I need to upload 145 MB. How can I re-route a download to an external hosted content without releasing a new version of my app?
I Hope you can Answer this soon.
It's really important for us to put this Black Friday offer in place.
EDIT:
OK, now I Know I'll Need to Update my App to Download the Content externally. Does Anyone have the Code on how to Download the Content From an External Host Instead of Parse once the Purchase is Approved? THANKS
What I'm Doing now is:
// FOR THE PURCHASE:
[PFPurchase buyProduct:<ProductID> block:^(NSError *error) {
if (!error) {
// run UI logic that informs user the product has been purchased, such as displaying an alert view.
[SVProgressHUD showWithStatus:#"Downloading..."];
}else
{
NSLog(#"ERROR: %#", error);
[SVProgressHUD showErrorWithStatus:#"Error"];
}
}];
// AND EARLIER....
// adding the Purchase Observer
[PFPurchase addObserverForProduct:<ProductID> block:^(SKPaymentTransaction *transaction) {
[PFPurchase downloadAssetForTransaction:transaction completion:^(NSString *filePath, NSError *error) {
if (!error) {
// Unzipping
//...... AND SAVING THE FILES, ETC.....
}
}];
// Thanks Stack-Overflowers
If your App is actually getting the images out of Parse, then you are stuck with the 10 MB limit unfortunately. In order to get around that you would need to store the URL to the image in Parse and host the image somewhere else. Unfortunately you would need to modify your App in the code to handle the URL which will require another release.
It seems like the only thing you can do at this point is to reduce the quality or dimensions of your images to shrink the file size to < 10 MB.
I have a feature in my iOS application. The user has the option to save photo or video to the iPhoto app. When the user presses the 'Save' button, it saves the photo or video again. Is there a way to overwrite the existing file instead of saving it again.
[self writeVideoAtPathToSavedPhotosAlbum:url completionBlock:^(NSURL* assetURL, NSError* error) {
//error handling
if (error!=nil) {
completionBlock(error);
return;
}
//add the asset to the custom photo album
[self addAssetURL: assetURL
withCompletionBlock:completionBlock];
}];
Any suggestion on this? Using checksum?
Looks like you can't, either you disable your Save button after click once or save to document directory and do checksum algorithm. Please check this answer check image exist
I have some issue creating a note in a linked notebook with the iOS evernote SDK.
I've tried to simply get the noteStore in question by
EvernoteNoteStore* noteStore = [EvernoteNoteStore noteStoreForLinkedNotebook:self.linkedNotebook];
I've then attempted to create a note with
[noteStore createNote:note success:success failure:^(NSError *error) {
NSLog(#"%#", error);
}];
This always ends in an error saying I don't have permission to create the note.
I have further tried to authenticate with the shared key in my linked notebook but have there also been stopped with the same error in the failure block.
[noteStore authenticateToSharedNotebookWithShareKey:self.linkedNotebook.shareKey success:^(EDAMAuthenticationResult *result) {
[noteStore createNote:note success:success failure:^(NSError *error) {
NSLog(#"%#", error);
}];
} failure:^(NSError *error) {
NSLog(#"%#", error);
}];
How can I go about the issue of creating a note in a linked notebook?
OK. So if your permissions are correct, I guess there's an error in the process.
I just published a blog post on this : http://laurent.sarrazin.io/2014/05/evernote-api-create-notes-in-a-linked-notebook.html It's in PHP but the process would be the same in other languages.
I guess you're not setting the notebook guid when creating the note. You can obtain this guid by calling the getSharedNotebookByAuth method. Don't use the linked notebook guid ! It would result in an EDAMNotFoundException.
Are you sure that you have the right permissions ? i.e. write permissions on the notebook.