<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: iOS Spotify SDK Problem when using StoryBoard (Scenes) in Xcode. Swift demo scenario works thoug in Spotify for Developers</title>
    <link>https://community.spotify.com/t5/Spotify-for-Developers/iOS-Spotify-SDK-Problem-when-using-StoryBoard-Scenes-in-Xcode/m-p/4987476#M625</link>
    <description>&lt;P&gt;Well, thanks for the reply but actually it's a storyboard scene so that method is never called, only the equivalent ini SceneDelegate.swift is called.&lt;/P&gt;</description>
    <pubDate>Tue, 30 Jun 2020 18:46:11 GMT</pubDate>
    <dc:creator>NRJMons</dc:creator>
    <dc:date>2020-06-30T18:46:11Z</dc:date>
    <item>
      <title>iOS Spotify SDK Problem when using StoryBoard (Scenes) in Xcode. Swift demo scenario works though.</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/iOS-Spotify-SDK-Problem-when-using-StoryBoard-Scenes-in-Xcode/m-p/4984767#M598</link>
      <description>&lt;P&gt;&lt;U&gt;My info&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Plan: Premium&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Country: Belgium&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Device: iPhone 11 Pro Max&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Operating System: iOS 13.5 + macOS Catalina&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Dear all&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I installed and the iOS SDK properly in Xcode and set up the server token swap and refresh properly =&amp;gt; demo swift login works nicely.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Now I'm trying to integrate that into my iOS application and it doesn't work at all. I tested everything that was possible and I broke it down to the least changes to the demo to better understand what could cause it to fail. See hereunder:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1) I set up a basic&amp;nbsp;Xcode iOS app&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2) I don't use create the views using programmation as in your demo, I use the Storyboard (only&amp;nbsp;difference with the demo code)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;3) I set everything exactly the same, it builds and it runs on the iPhone device nicely without any error or any alert message&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;4) when I click "Connect", it asks permission to use "Spotify" as expected, I answer yes, it&amp;nbsp;switches to Spotify and starts playing the song&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;5) it switches back to my app and still shows the "Connect" button&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When debugging, I set up breakpoints at every sessionManager, application methods and appRemote event functions, none of them is apparently caught.&lt;/P&gt;&lt;P&gt;When I do the same in the demo project, it stops at breakpoints&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My conclusions:&lt;/P&gt;&lt;P&gt;- the delegates do not work and seem not to be assigned correctly because no event is caught&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is strange? It's line per line EXACTLY the same code as the demo project, only I use Scenes so I have a SceneDelegate.swift file in my project.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to transfer some of the code like the delegate assignment to the SceneDelegate file to the corresponding events but it doesn't work well and the openURL method is not the same as in the application open url method so I don't know how to translate the openURL call at scene level.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm lost, I spent 3 days trying everything and nothing works. BTW, I use regularly the Web API without any problem so I understand pretty well the Spotify auth process.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anybody help me? Because the iOS examples, to be honest, they are pretty thin to find solutions. Can't you at least have one example that uses the StoryBoard or SwiftUI, building the views programmatically do not really help people that want to start programming.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or at least give me tips please, I'm stuck..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thx a lot, Nico&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jun 2020 08:07:57 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/iOS-Spotify-SDK-Problem-when-using-StoryBoard-Scenes-in-Xcode/m-p/4984767#M598</guid>
      <dc:creator>NRJMons</dc:creator>
      <dc:date>2020-06-26T08:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: iOS Spotify SDK Problem when using StoryBoard (Scenes) in Xcode. Swift demo scenario works thoug</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/iOS-Spotify-SDK-Problem-when-using-StoryBoard-Scenes-in-Xcode/m-p/4986927#M622</link>
      <description>&lt;P&gt;You forget one thing in AppDelegate.m. Add the code to process the response from spotify. After this process , delegate of&amp;nbsp;&lt;SPAN&gt;sessionManager will be called.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -&amp;gt; Bool {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; rootViewController.sessionManager.application(app, open: url, options: options)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return true&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2020 01:40:50 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/iOS-Spotify-SDK-Problem-when-using-StoryBoard-Scenes-in-Xcode/m-p/4986927#M622</guid>
      <dc:creator>ouml</dc:creator>
      <dc:date>2020-06-30T01:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: iOS Spotify SDK Problem when using StoryBoard (Scenes) in Xcode. Swift demo scenario works thoug</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/iOS-Spotify-SDK-Problem-when-using-StoryBoard-Scenes-in-Xcode/m-p/4987476#M625</link>
      <description>&lt;P&gt;Well, thanks for the reply but actually it's a storyboard scene so that method is never called, only the equivalent ini SceneDelegate.swift is called.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2020 18:46:11 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/iOS-Spotify-SDK-Problem-when-using-StoryBoard-Scenes-in-Xcode/m-p/4987476#M625</guid>
      <dc:creator>NRJMons</dc:creator>
      <dc:date>2020-06-30T18:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: iOS Spotify SDK Problem when using StoryBoard (Scenes) in Xcode. Swift demo scenario works thoug</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/iOS-Spotify-SDK-Problem-when-using-StoryBoard-Scenes-in-Xcode/m-p/4987878#M627</link>
      <description>You are right. This issue is caused by SceneDelegate. Two ways to solve this problem.&lt;BR /&gt;1. Add openURLContexts func in SceneDelegate file to process the same thing of openURL in appdelegate.&lt;BR /&gt;- (void)scene:(UIScene *)scene openURLContexts:(NSSet&amp;lt;UIOpenURLContext *&amp;gt; *)URLContexts {&lt;BR /&gt;UIOpenURLContext *ctx = [URLContexts allObjects][0];&lt;BR /&gt;ViewController *rootVC = [UIApplication sharedApplication].keyWindow.rootViewController;&lt;BR /&gt;[rootVC.sessionManager application:[UIApplication sharedApplication] openURL:ctx.URL options:ctx.options];&lt;BR /&gt;}&lt;BR /&gt;2. remove UISceneConfigurations section from info.plist. Then it will callback to openurl.&lt;BR /&gt;</description>
      <pubDate>Wed, 01 Jul 2020 08:36:33 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/iOS-Spotify-SDK-Problem-when-using-StoryBoard-Scenes-in-Xcode/m-p/4987878#M627</guid>
      <dc:creator>ouml</dc:creator>
      <dc:date>2020-07-01T08:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: iOS Spotify SDK Problem when using StoryBoard (Scenes) in Xcode. Swift demo scenario works thoug</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/iOS-Spotify-SDK-Problem-when-using-StoryBoard-Scenes-in-Xcode/m-p/4988109#M629</link>
      <description>&lt;P&gt;Hi Ouml&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Fantastic, it works fine now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just another problem now, it seems that my IBOutlets are not accessible when the interface has to be refreshed with the playing song.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I instantiate the Viewcontroller in SceneDelegate and keep a reference as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;let&lt;/STRONG&gt;&lt;/SPAN&gt; rootViewController&lt;SPAN&gt; : &lt;/SPAN&gt;&lt;SPAN&gt;ViewController&lt;/SPAN&gt;&lt;SPAN&gt; = {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;return&lt;/STRONG&gt;&lt;/SPAN&gt; (&lt;SPAN&gt;UIStoryboard&lt;/SPAN&gt;.&lt;SPAN&gt;init&lt;/SPAN&gt;(name: &lt;SPAN&gt;"Main"&lt;/SPAN&gt;, bundle: &lt;SPAN&gt;&lt;STRONG&gt;nil&lt;/STRONG&gt;&lt;/SPAN&gt;).&lt;SPAN&gt;instantiateViewController&lt;/SPAN&gt;(identifier: &lt;SPAN&gt;"ViewController"&lt;/SPAN&gt;) &lt;SPAN&gt;&lt;STRONG&gt;as&lt;/STRONG&gt;&lt;/SPAN&gt;? &lt;SPAN&gt;ViewController&lt;/SPAN&gt;)!&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;}()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have outlets as such:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;@IBOutlet&lt;/STRONG&gt; &lt;STRONG&gt;weak&lt;/STRONG&gt; &lt;STRONG&gt;var&lt;/STRONG&gt; &lt;SPAN&gt;imgCover&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;UIImageView&lt;/SPAN&gt;&lt;SPAN&gt;!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;STRONG&gt;@IBOutlet&lt;/STRONG&gt; &lt;STRONG&gt;weak&lt;/STRONG&gt; &lt;STRONG&gt;var&lt;/STRONG&gt; &lt;SPAN&gt;btnPausePlay&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;UIButton&lt;/SPAN&gt;&lt;SPAN&gt;!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;STRONG&gt;@IBOutlet&lt;/STRONG&gt; &lt;STRONG&gt;weak&lt;/STRONG&gt; &lt;STRONG&gt;var&lt;/STRONG&gt; &lt;SPAN&gt;lblTrack&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;UILabel&lt;/SPAN&gt;&lt;SPAN&gt;!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;STRONG&gt;@IBOutlet&lt;/STRONG&gt; &lt;STRONG&gt;weak&lt;/STRONG&gt; &lt;STRONG&gt;var&lt;/STRONG&gt; &lt;SPAN&gt;btnConnect&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;UIButton&lt;/SPAN&gt;&lt;SPAN&gt;!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;STRONG&gt;@IBOutlet&lt;/STRONG&gt; &lt;STRONG&gt;weak&lt;/STRONG&gt; &lt;STRONG&gt;var&lt;/STRONG&gt; &lt;SPAN&gt;btnDisconnect&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;UIButton&lt;/SPAN&gt;&lt;SPAN&gt;!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The outlets are connected&amp;nbsp;and they are accessible when I am in viewDidLoad function of the view controller.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But, as soon as I want to change them in other functions, it returns "&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Fatal error: Unexpectedly found nil while unwrapping an Optional value"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As if the outlets are not initialised in the class (although using self. )&lt;/P&gt;&lt;P&gt;What is strange is that the initialise above is called TWICE when I debug, I have the feeling that I have two instances of the same view controller active at some points&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Well, that's another issue, thanks for your precious help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2020 13:24:59 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/iOS-Spotify-SDK-Problem-when-using-StoryBoard-Scenes-in-Xcode/m-p/4988109#M629</guid>
      <dc:creator>NRJMons</dc:creator>
      <dc:date>2020-07-01T13:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: iOS Spotify SDK Problem when using StoryBoard (Scenes) in Xcode. Swift demo scenario works thoug</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/iOS-Spotify-SDK-Problem-when-using-StoryBoard-Scenes-in-Xcode/m-p/4988565#M633</link>
      <description>&lt;P&gt;Add a log in File ViewController-&amp;gt;ViewDidLoad() to see whether the ViewController has been init twice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If Yes, Check [General]-&amp;gt;[Deployment Info]-&amp;gt;"Main Interface". Has the value of this option been removed?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If not this problem, which func do you put your init code in? Try to find why it has been init twice.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jul 2020 01:43:34 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/iOS-Spotify-SDK-Problem-when-using-StoryBoard-Scenes-in-Xcode/m-p/4988565#M633</guid>
      <dc:creator>ouml</dc:creator>
      <dc:date>2020-07-02T01:43:34Z</dc:date>
    </item>
  </channel>
</rss>

