Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-25842

iOS: Cannot remove Ti.App.iOS.handleurl event-listener

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: Release 6.3.0, Release 7.0.2
    • Fix Version/s: Release 7.3.0
    • Component/s: iOS
    • Labels:
    • Story Points:
      5

      Description

      In my app Titanium.App.iOS.addEventListener("handleurl", iosHandleUrl) can successfully register an event listener for the handle url event. Titanium.App.iOS.addEventListener("handleurl", iosHandleUrl) fails to remove the event listener resulting in the iosHandleUrl function being called multiple times in my app, when redirected back to the app from the browser.

      To reproduce this I've create a sample project with the following code in index.js

      function iosHandleUrl(e) {
      	console.log("redirected to app from URL");
      }
       
      Ti.App.iOS.addEventListener("handleurl",iosHandleUrl);
      Ti.App.iOS.removeEventListener("handleurl",iosHandleUrl);
      Ti.App.iOS.addEventListener("handleurl",iosHandleUrl);
      Ti.App.iOS.removeEventListener("handleurl",iosHandleUrl);
      Ti.App.iOS.addEventListener("handleurl",iosHandleUrl);
       
      Ti.UI.createWindow({
         backgroundColor: '#fff'
      }).open();
      

      And added the following to the plist in tiapp.xml.

      <key>CFBundleURLTypes</key>
      <array>
      	<dict>
      		<key>CFBundleURLName</key>
      		<string>com.ideagen.handleurltest</string>
      		<key>CFBundleURLSchemes</key>
      		<array>
      			<string>handleurltest</string>
      		</array>
      	</dict>
      </array>
      

      When I launch the app then open a browser and open handleurltest:// the expected behaviour is that "redirected to app from URL" should be logged once but the actual behaviour is that it's logged three times.

      The app was built against version 6.3.0.GA of the SDK.

        Attachments

          Activity

            People

            • Assignee:
              hknoechel Hans Knöchel
              Reporter:
              donald.anderson Donald Anderson
              Reviewer:
              Vijay Singh
              Tester:
              Samir Mohammed
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-6233
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code