I am having a strange issue when using the iTunes plugin. I cannot seem to retrieve the url of media that has been selected from the iTunes library. I have tried building my app using Corona build 2014.2594 and build 2015.2626, and the device I am testing on is an iPhone 3GS model MC640LL/A.
local iTunes = require( "plugin.iTunes" ) local iTunesSelectedTrackUrl local iTunesMediaChosen local mediaItem local trackName = display.newText( row, "No Song Selected", .5\*display.contentWidth, .5\*display.contentWidth, native.systemFontBold, 16 ) local function onMediaChosen( event ) -- If a song was picked, print it's details if event.data then iTunesMediaChosen = true iTunesSelectedTrackUrl = event.data.url trackName.text = event.data.url mediaItem = event.data -- end -- Play the first item chosen iTunes.play( mediaItem.url ) else trackName.text = "Sorry, no media was chosen" end end iTunes.show( { promptTitle = "Select a Track" }, onMediaChosen ) local function play\_iTunesMedia() iTunes.play( mediaItem.url ) end
The trackName text displays no text ("") and returns nil after selecting iTunes media, when it should display the url of the track selected by the user. Also, an error occurs when I try to play the url of the track chosen, which says that the mediaItem.url is nil. Is this a bug or is there something wrong with my code or the device I am using to test?