In Xcode, I keep getting a strange error. I am using this github library: https://github.com/tapsquare/TSLibraryImport
And I am using the example code in my mediaPicker delegate method like so:
- (void)mediaPicker: (MPMediaPickerController *)mediaPicker didPickMediaItems:(MPMediaItemCollection *)mediaItemCollection {
for (MPMediaItem *item in mediaItemCollection.items) {
NSURL* assetURL = [item valueForProperty:MPMediaItemPropertyAssetURL];
NSURL* destinationURL = nil; //file URL for the location you'd like to import the asset to.
TSLibraryImport *import = [[TSLibraryImport alloc] init];
[import importAsset:assetURL toURL:destinationURL completionBlock:^(TSLibraryImport *theImport) {
}];
}
[mediaPicker dismissViewControllerAnimated:YES completion:nil];
}
On the importAsset line, I keep getting the error: Parse Issue: Module 'importAsset' not found.
Now I have dragged in TSLibraryImport.h/.m in and made sure the .m was in the compile sources but still it shows the error.
Does anyone know why this is happening? It doesn't seem to happen in the library's sample project.
I found this question after encountering the same problem. For anyone else who runs into this issue, it turns out that recent versions of XCode (I'm using XCode 5) use import as a global variable for automatic memory management. You can fix it by renaming the TSLibraryImport pointer something else.
TSLibraryImport *tsImport = [[TSLibraryImport alloc] init];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With