Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7668131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:16:53+00:00 2026-05-31T15:16:53+00:00

I’m having issues moving a newly created SPPlaylist to a (possibly newly created) SPPlaylistFolder

  • 0

I’m having issues moving a newly created SPPlaylist to a (possibly newly created) SPPlaylistFolder.

The idea is to create a folder in the user’s Spotify account, where I can add playlists generated from my application. If no such folder has been created, I’m creating a new SPPlaylistFolder and save the folder id for later use.

This is what I’m doing (I’ve omitted parts of the code that aren’t interesting to this subject):

  1. If a folderId has been previously saved (i.e. a folder created), use that ID to load the folder instance:

    ...
    
    NSError *error = nil;
    if (folderId > 0) {
      // try to fetch folder
      folder = [[SPSession sharedSession] playlistFolderForFolderId:folderId inContainer:container];
    }
    
    if (folder == nil) {
      // create folder
      folder = [container createFolderWithName:@"My Folder" error:&error];
    
      // save a reference to the folder in an instance var
      _appFolder = [folder retain];
    
      // (also saving folder.folderId in NSUserDefaults)
    }
    
    ...
    
  2. Create an SPPlaylist: [[[SPSession sharedSession] userPlaylists] createPlaylistWithName:@"My Playlist"].

  3. Use KVO to observe the container’s playlists property and get notified when the playlist has been created: [[[SPSession sharedSession] userPlaylists] addObserver:self forKeyPath:@"playlists" options:0 context:nil].

  4. Observe the playlists property and move the created playlist to my SPPlaylistFolder (containerPlaylist is the playlist I’ve identified as the one to move):

    ...
    // identify the index of the containerPlaylist
    NSInteger playlistIndex = [[[[SPSession sharedSession] userPlaylists] playlists] indexOfObject:containerPlaylist];
    
    // move playlist
    NSError * error = nil;
    BOOL success = [container movePlaylistOrFolderAtIndex:playlistIndex ofParent:nil toIndex:0 ofNewParent:_appFolder error:&error];
    if (success) {
      // This should be a great success. But the playlist hasn't been moved, although the error variable is nil.
    }
    
    ...
    

After these steps, both the playlist and folder have been created, but the playlist hasn’t been moved. And I’m not getting any errors indicating any invalid input to the movePlaylistOrFolderAtIndex method.

Am I missing something obvious here? Or is the move functionality flawed somehow?

Note: I have also tried to use this code to move playlists that have been created previously (i.e. move all playlists named “My Playlist” to the folder).

EDIT 1: I’ve investigated this a bit further and actually got some moving action going on. But I had to rewrite some of the code and perform the move several times (or at a later stage). It seems like this is related to the data in SPSession not being entirely synced/up-to-date (?) since it’s possible to move playlists when logging later with new session.

Is it possible that it’s a syncing issue, i.e. libspotify believes that the SPPlaylistFolder is created and moves SPPlaylists to it, without it actually being created yet?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T15:16:54+00:00Added an answer on May 31, 2026 at 3:16 pm

    After having updated my code with reference to this issue on cocoalibspotify, it’s working better. What I didn’t realize at first was how the syncing with the Spotify service worked. It can easily take several minutes for the changes to be reflected in the Spotify desktop client, for example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I need to clean up various Word 'smart' characters in user input, including but
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I'm trying to create an if statement in PHP that prevents a single post
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.