airsdk / Adobe-Runtime-Support

Report, track and discuss issues in Adobe AIR. Monitored by Adobe - and HARMAN - and maintained by the AIR community.
206 stars 11 forks source link

Crash on iOS with Distriqt Push Notifications FCM (unrecognized selector sent to class) #2963

Closed rdefalco closed 11 months ago

rdefalco commented 11 months ago

Hello @marchbold, we are using AIR 50.2.3.6 overlaid on a FeathersUI/Flex installation Distriqt ANEs downloaded mid-november via apm subscription active for Master Collection.

On iOS we get a crash when trying to do PushNotifications.service.register();

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Reason: +[%s %s]: unrecognized selector sent to class 0x10423e508
Termination Reason: SIGNAL 6 Abort trap: 6
Terminating Process: Ordy [770]

The order of operations we do: PushNotifications.service.isServiceSupported( Service.FCM ) returns TRUE

Then we setup the service as follows:

Core.init();
var service:Service = new Service( Service.FCM );
service.channels.push(
  new ChannelBuilder()
  .setId( "catalogo" )
  .setName( "Informazioni catalogo" )
  .build()
 );
service.sandboxMode = false;
service.setNotificationsWhenActive( true );         
PushNotifications.service.setup( service );

Then we check for authorization and authorisationStatus() returns AuthorisationStatus.AUTHORISED

Finally we try to register() and the app crashes. Any suggestion?

rdefalco commented 11 months ago

If could be relevant, the manifest additions were originally created by apm and edited by us

<InfoAdditions><![CDATA[

<key>ITSAppUsesNonExemptEncryption</key>
<false/>

<key>MinimumOSVersion</key>
<string>11.0</string>

<key>NSContactsUsageDescription</key>
<string>Non è necessario accedere ai contatti</string>

<key>NSCalendarsUsageDescription</key>
<string>Non è necessario accedere al calendario</string>

<key>NSPhotoLibraryUsageDescription</key>   
<string>Per allegare documenti e' necessario consentire l'uso della libreria</string>

<key>NSPhotoLibraryAddUsageDescription</key>
<string>Per allegare documenti e' necessario consentire l'uso della libreria</string>

<key>NSCameraUsageDescription</key>         
<string>Per leggere i codici a barre e' necessario consentire l'uso della fotocamera</string>

<key>NSMicrophoneUsageDescription</key>     
<string>Per leggere i codici a barre e' necessario consentire l'uso della fotocamera</string>

<key>NSLocationAlwaysUsageDescription</key> 
<string>Per la funzione mappa clienti occorre conoscere la posizione</string>   

<key>NSLocationWhenInUseUsageDescription</key>
<string>Per la funzione mappa clienti occorre conoscere la posizione</string>   

<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Per la funzione mappa clienti occorre conoscere la posizione</string>   

<key>FirebaseAppDelegateProxyEnabled</key>
<false/>

<key>UIBackgroundModes</key>
<array> <string>remote-notification</string>    </array>

<key>UIDeviceFamily</key>
<array> <string>1</string> <string>2</string> </array>
    ]]></InfoAdditions>
    <Entitlements><![CDATA[
        <key>aps-environment</key> <string>production</string>
        <key>com.apple.developer.team-identifier</key> <string>EDITED</string>
        <key>get-task-allow</key> <false/>
        <key>application-identifier</key> <string>EDITED.com.edminformatica.ordy</string>
        <key>keychain-access-groups</key> <array>   <string>EDITED.*</string>   </array>
    ]]></Entitlements>
  </iPhone>
rdefalco commented 11 months ago

Also compiling the app with AIR 50.2.4.1 upgrading the minimum iOS version to 12 does NOT solve the problem

rdefalco commented 11 months ago

Found online that sometimes NSTimer on iOS could cause this issue, and we are executing the Push Notifications initialization after certain time using a flash.Timer, I'm investigating this

ajwfrost commented 11 months ago

Hi

I don't suppose there's any more information the crash log about this:

Exception Reason: +[%s %s]: unrecognized selector sent to class 0x10423e508

Ideally, the selector name or the class type! Or any call stack for the crashed thread?

thanks

rdefalco commented 11 months ago

Here is a complete crash report, should it contain private information let me know and I will delete the comment/attachment

testflight_feedback (7).zip

rdefalco commented 11 months ago

Also we are cleaning the code (business app built over the years) to make sure that the Firebase initialization is not called more than once

EDIT: it seems that the initialization is started only once.

Also, to clarify: we are migrating to Distriqt FCM ANEs recently, so we don't have a "previous working configuration" of our app and their ANEs. Since we were using Myflashlabs before, we removed several ".framework" from the stub folder of the AIR/Flex SDK because apparently they are not needed anymore. If I remember correctly, leaving these ".framework" folders in place caused build errors when exporting to IPA.

rdefalco commented 11 months ago

Oook we rebuilt from scratch FeathersSDK, overlaid it with latest AIR and the crash didn't happen, let me analyze more details and confirm the issue was caused by some dirty/residual library in the SDK folder...

marchbold commented 11 months ago

@rdefalco I can't see anything related to the push notifications extension in that crash log, but if you do manage to reproduce it again let me know.