Unrecognized selector sent to instance

Hi guys , i’m working on the integration of the sumup android and iOS sdk in fusetools.
the repository of the module can be found bellow.

i managed to get the android part fully working.
in the iOS part the payment process works pretty well in the Xcode simulator (see the code below), but when i test it with real device (iPod touch) , the checkout process freeze , and it gives me this error '-[uAppDelegate window]: unrecognized selector sent to instance 0x149e02d20'

  [Require("Xcode.Framework", "@('SumupSDK.embeddedframework/SumupSDK.framework':Path)")]
  [Require("Xcode.Framework", "Accelerate")]
  [Require("Xcode.Framework", "AVFoundation")]
  [Require("Xcode.Framework", "MapKit")]
  [Require("Source.Import", "SumupSDK/SumupSDK.h")]
   class PayWithToken: Promise<string>

    public  PayWithToken(string accessToken, string productAmount, string productTitle, string foreignRef)

      [SumupSDK loginWithToken:accessToken
                       completion: ^(BOOL success, NSError *error) {
                           if (error) {
                            @{PayWithToken:Of(_this).Reject(string):Call(@"token non obtenu")};                          

                                  [SumupSDK prepareForCheckout];
      SMPCheckoutRequest *request = [SMPCheckoutRequest requestWithTotal:[NSDecimalNumber decimalNumberWithString:productAmount]
                                                            currencyCode:[[SumupSDK currentMerchant] currencyCode]

              [request setForeignTransactionID:foreignRef];

              [SumupSDK checkoutWithRequest: request
                          fromViewController: [UIApplication sharedApplication].keyWindow.rootViewController
                                    completion: ^(SMPCheckoutResult *result, NSError *error) {
                                          @{PayWithToken:Of(_this).Reject(string):Call(@"Vous devez etre connecter")};
                                          @{PayWithToken:Of(_this).Resolve(string):Call(@"Le paiement a été effectué")};

        // something went wrong checkout was not started
        if (![SumupSDK checkoutInProgress]) {
           @{PayWithToken:Of(_this).Reject(string):Call(@"Une erreur de connard s'est produite")};




    void Resolve(string message)

      void Reject(string reason)
        Reject(new Exception(reason));


I think it has something to do with [UIApplication sharedApplication].keyWindow.rootViewController, but didn’t find any solution to sort this out.
anyone can help me ?

I don’t have an immediate solution for you, but the top one and top two results on Google should get you going.

First of all, enable exception breakpoints in XCode and see where it crashes. Then take it from there.

enabling exception breakpoints doesn’t help much further to debug this http://prntscr.com/gfcjgp (maybe i’m too weak),

it is complaining about main.mm

#include <Uno/Uno.h>
#include <UIKit/UIKit.h>

#include <Uno-iOS/AppDelegate.h>

int main(int argc, char **argv)
    // TODO: Report unhandled exceptions.
    // Can't rely on exceptions propagating outside UIApplicationMain as it
    // won't work with latest arm64 ABI

        return UIApplicationMain(
            argc, argv, nil, NSStringFromClass([uAppDelegate class]));

and fromViewController:[UIApplication sharedApplication].keyWindow.rootViewController is this part of the code who crash.

Hi prince, you have 3 instances of fromViewController: [UIApplication sharedApplication].keyWindow.rootViewController in that file. Which one is the issue? Do the others work?

I got your code to build but don’t know how to replicate the issue.

all the

fromViewController: [UIApplication sharedApplication].keyWindow.rootViewController

works on simulation without any problem, the issues occur with real devices, and only on the payment process with my functions Pay and PaywithToken.

Thanks for narrowing down that first part, but the buttons in the app don’t seem to do anything when clicked, please describe the process to follow to cause the error to happen.

its a working example, https://www.dropbox.com/s/t8yfy1fohiwu8h8/Archive.zip?dl=0
please add -ObjC to “Other Linker Flags”
Add the bundles provided in SumupSDK.embeddedframework/Resources to your app target.


you have to specify the 3 input (the first is the amount) before pressing the bouton PayWithToken.

That archive looks very similar to the github repo you linked at the top. Are they the same? If so can’t I just use the repo?

You can use the repo , but the archive have all credentials needed already filled , so its ready to go.

Excellent, thanks

It ran but the button just logs haha i started to the console and nothing else happens. I am happy to test other versions you provide (especially if it was a more minimal test case).

the token take a bit time to be retrieved.
but it should work normally, hum i’m building a minimal test case

ok this is the minimal test case.

for the price I entered 100, for the foreigncode I enetered ‘a’, for the title I entered ‘b’

This is the result on the iPhone 6plus running iOS 9.3.2

2017-09-01 13:45:34.670 test[540:313470] "haha i started"
2017-09-01 13:45:35.006 test[540:313470] {"type":"default","status":200,"ok":true,"statusText":"OK","headers":{"map":{"status":["200 OK"],"x-content-type-options":["nosniff"],"content-type":["application/json; charset=utf-8"],"server":["nginx"],"connection":["keep-alive"],"date":["Fri, 01 Sep 2017 11:45:34 GMT"],"x-download-options":["noopen"],"x-frame-options":["SAMEORIGIN"],"x-xss-protection":["1; mode=block"],"content-length":["303"],"etag":["W/\"12f-XTnIGBvMCwYrRS1VhojLTMAVk9Y\""]}},"url":"","_bodyInit":"{\"access_token\":\"3067c162c3893489c62ede3c716ee9e343a52d56460b9df1cec66f4f8acff1e1\",\"token_type\":\"Bearer\",\"expires_in\":3600,\"refresh_token\":\"c288e6ab55bc7e8d4097705622ee9aa1898bec074c063855fd72e98d0247b3a1\",\"scope\":\"payments user.app-settings transactions.history user.profile_readonly user.subaccounts\"}","_bodyText":"{\"access_token\":\"3067c162c3893489c62ede3c716ee9e343a52d56460b9df1cec66f4f8acff1e1\",\"token_type\":\"Bearer\",\"expires_in\":3600,\"refresh_token\":\"c288e6ab55bc7e8d4097705622ee9aa1898bec074c063855fd72e98d0247b3a1\",\"scope\":\"payments user.app-settings transactions.history user.profile_readonly user.subaccounts\"}"}
2017-09-01 13:45:36.332 test[540:313470] "token non obtenu"

This is the result on the iPhone 6 running iOS 10.3.2

2017-09-01 13:47:23.162153+0200 test[1747:1492477] "haha i started"
2017-09-01 13:47:23.785709+0200 test[1747:1492477] {"type":"default","status":200,"ok":true,"statusText":"OK","headers":{"map":{"status":["200 OK"],"x-content-type-options":["nosniff"],"content-type":["application/json; charset=utf-8"],"server":["nginx"],"etag":["W/\"12f-F9JdF/rOlQB/0gr3UuI0EEfg7jk\""],"date":["Fri, 01 Sep 2017 11:47:23 GMT"],"x-download-options":["noopen"],"x-frame-options":["SAMEORIGIN"],"x-xss-protection":["1; mode=block"],"content-length":["303"],"connection":["keep-alive"]}},"url":"","_bodyInit":"{\"access_token\":\"95764a94dc65d2d951f82f439a1b2bc2793b8f4efc349b124792951e4b36fc8d\",\"token_type\":\"Bearer\",\"expires_in\":3600,\"refresh_token\":\"ed17db8c203e74e0ad54feb67ed401548d290339e53e281640b1ab64764990e9\",\"scope\":\"payments user.app-settings transactions.history user.profile_readonly user.subaccounts\"}","_bodyText":"{\"access_token\":\"95764a94dc65d2d951f82f439a1b2bc2793b8f4efc349b124792951e4b36fc8d\",\"token_type\":\"Bearer\",\"expires_in\":3600,\"refresh_token\":\"ed17db8c203e74e0ad54feb67ed401548d290339e53e281640b1ab64764990e9\",\"scope\":\"payments user.app-settings transactions.history user.profile_readonly user.subaccounts\"}"}
2017-09-01 13:47:33.710413+0200 test[1747:1492477] "token non obtenu"

Sadly not the crash you mentioned before. Any ideas?

token non obtenu is my error when login with token fails, seems like you are already logged in, as sumup dont provide a good error to manage this (the error is null),
the best to do for testing here is to change my line 54 in iOSImpl.uno to if (error == NULL)
the first payment will fail but next ones will works.
this is a video of my test on simulation.

as you can see , it works pretty well on simulation , in the device , it freeze when the modal payment open

I just see that i didn’t uploaded the good link of my video. sorry, updated the link

anyone to help me on this today ?

Hi prince, I will try to have a look at this tomorrow.

thank you , appreciate it

Changling like 54 to if (error==NULL) { just causes a different exception:

2017-09-07 11:25:28.273 test[795:1054760] SumupSDK: Ignoring 'prepareForCheckout'. Not logged in.
2017-09-07 11:25:28.273 test[795:1054760] SumupSDK: Not presenting checkout as user is not logged in.
libc++abi.dylib: terminating with uncaught exception of type uThrowable: Uno.Exception

Which makes a lot of sense to be honest.