Skip to content

nerdsRob/NBSoundCloudActivity

 
 

Repository files navigation

#NBSoundCloudActivity


NBSoundCloudActivity is a simple subclass of UIActivity that allows you to post audio content to SoundCloud via the UIActivityViewController introduced in iOS 6. It wraps the SoundCloud sharing SDK to display a posting user interface and to actually send the data.

#Setup


First, clone or download the Git repository to your local disk.

The sample project uses CocoaPods to manage dependencies, so you'll need to install it and run the following command within the project root directory to get the dependent code

pod install

Now you're ready to open the sample project and run it. Make sure you open the NBSoundCloudActivity.xcworkspace in order to get the Pods dependencies. In "ViewController.m" you'll also need to set the Client ID, Client Secret, and Redirect URL for your SoundCloud account in order for the demo to work.

Once you're satisfied, you can copy the source and assets from the "NBSoundCloudActivity" group into your own project. Keep in mind you'll also need the SoundCloud SDK dependencies in your own project as well.

#Usage


Using NBSoundCloudActivity couldn't be easier. All you have to do is create an instance using your SoundCloud API Client ID and Secret and pass it along to an instance of UIActivityViewController along with an AVURLAsset object representing the audio file you'd like to share.

NSURL* sampleURL = [[NSBundle mainBundle] URLForResource:@"sample" withExtension:@"caf"];
AVURLAsset* asset = [AVURLAsset assetWithURL:sampleURL];

NBSoundCloudActivity* scActivity = [[NBSoundCloudActivity alloc] initWithClientId:kSoundCloudClientId
											secret:kSoundCloudClientSecret 
											redirectURL:[NSURL URLWithString:@"myapp://soundcloudlogin"]];

UIActivityViewController* avc = [[UIActivityViewController alloc] initWithActivityItems:@[asset]
                                                                  applicationActivities:@[scActivity]];
avc.excludedActivityTypes = @[ UIActivityTypePostToWeibo, UIActivityTypeMessage, UIActivityTypeCopyToPasteboard ];

[self presentViewController:avc animated:YES completion:nil];

iOS will present the user with a standard activity view where the user can select "SoundCloud" as an option and be brought through the standard SoundCloud sharing UI.

#Contact


##Creators This library was created and is maintained by Nick Bonatsakis.

Nick Bonatsakis

@nickbona

##Feedback Feedback via suggestions or pull requests is strongly encouraged. Please do not submit any pull requests without accompanying unit tests.

#License


NBSoundCloudActivity is available under the MIT license. See the LICENSE file for more info.

About

A simple iOS UIActivity subclass for sharing audio to SoundCloud.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published