Titanium JIRA Archive
Appcelerator Community (AC)

[AC-4356] LiveView: Crash receiving push notification when app is foreground IOS

GitHub Issuen/a
TypeImprovement
Priorityn/a
StatusClosed
ResolutionNot Our Bug
Resolution Date2016-08-21T22:27:44.000+0000
Affected Version/sAppcelerator Studio 4.5.0
Fix Version/sn/a
ComponentsAlloy, Appcelerator CLI, Studio, Titanium SDK & CLI
Labelsios
ReporterOscar J. Rico Reyes
AssigneeShak Hossain
Created2016-08-15T05:56:57.000+0000
Updated2016-08-22T15:13:48.000+0000

Description

It woud be nice to have a functional liveview even when receiving push notifications. Stacktrace -[TiApp application:didReceiveRemoteNotification:]: unrecognized selector sent to instance 0x147d1d650 [ERROR] : The application has crashed with an uncaught exception 'NSInvalidArgumentException'. [ERROR] : Reason: [ERROR] : -[TiApp application:didReceiveRemoteNotification:]: unrecognized selector sent to instance 0x147d1d650 [ERROR] : Stack trace: [ERROR] : [ERROR] : 0 CoreFoundation 0x00000001813fedb0 + 124 [ERROR] : 1 libobjc.A.dylib 0x0000000180a63f80 objc_exception_throw + 56 [ERROR] : 2 CoreFoundation 0x0000000181405c4c + 0 [ERROR] : 3 CoreFoundation 0x0000000181402a1c + 408 [ERROR] : 4 CoreFoundation 0x0000000181300c5c _CF_forwarding_prep_0 + 92 [ERROR] : 5 MyApp 0x00000001002707f4 MyApp + 2017268 [ERROR] : 6 UIKit 0x00000001868161a8 + 2676 [ERROR] : 7 UIKit 0x0000000186803f84 + 136 [ERROR] : 8 FrontBoardServices 0x0000000182d9f7ac + 36 [ERROR] : 9 FrontBoardServices 0x0000000182d9f618 + 168 [ERROR] : 10 FrontBoardServices 0x0000000182d9f9c8 + 56 [ERROR] : 11 CoreFoundation 0x00000001813b509c + 24 [ERROR] : 12 CoreFoundation 0x00000001813b4b30 + 540 [ERROR] : 13 CoreFoundation 0x00000001813b2830 + 724 [ERROR] : 14 CoreFoundation 0x00000001812dcc50 CFRunLoopRunSpecific + 384 [ERROR] : 15 GraphicsServices 0x0000000182bc4088 GSEventRunModal + 180 [ERROR] : 16 UIKit 0x00000001865c6088 UIApplicationMain + 204 [ERROR] : 17 Cablecol 0x0000000100089658 Cablecol + 22104 [ERROR] : 18 libdyld.dylib 0x0000000180e7a8b8 + 4 [ERROR] : *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[TiApp application:didReceiveRemoteNotification:]: unrecognized selector sent to instance 0x147d1d650' [ERROR] : *** First throw call stack: [ERROR] : (0x1813fedb0 0x180a63f80 0x181405c4c 0x181402a1c 0x181300c5c 0x1002707f4 0x1868161a8 0x186803f84 0x182d9f7ac 0x182d9f618 0x182d9f9c8 0x1813b509c 0x1813b4b30 0x1813b2830 0x1812dcc50 0x182bc4088 0x1865c6088 0x100089658 0x180e7a8b8) [LiveView] Client disconnected

Comments

  1. Hans Knöchel 2016-08-21

    Make sure you have your entitlements set correctly, e.g. UIBackgroundModes must include remote-notification. Otherwise, the delegate for receiving it will not be available (see code [here](https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/TiApp.m#L638). After you add it, you need to do a clean build at leat once. Closing for now.
  2. Oscar J. Rico Reyes 2016-08-22

    Thanks for your response @Hans Knoechel, here is the config of the application i am using. There is already remote-notification entitlements
        <ios>
               <enable-launch-screen-storyboard>true</enable-launch-screen-storyboard>
               <use-app-thinning>true</use-app-thinning>
               <plist>
                   <dict>
                       <key>UISupportedInterfaceOrientations~iphone</key>
                       <array>
                           <string>UIInterfaceOrientationPortrait</string>
                       </array>
                       <key>UISupportedInterfaceOrientations~ipad</key>
                       <array>
                           <string>UIInterfaceOrientationPortrait</string>
                           <string>UIInterfaceOrientationPortraitUpsideDown</string>
                           <string>UIInterfaceOrientationLandscapeLeft</string>
                           <string>UIInterfaceOrientationLandscapeRight</string>
                       </array>
                       <key>UIRequiresPersistentWiFi</key>
                       <false/>
                       <key>UIPrerenderedIcon</key>
                       <false/>
                       <key>UIStatusBarHidden</key>
                       <false/>
                       <key>UIStatusBarStyle</key>
                       <string>UIStatusBarStyleDefault</string>
                       <key>UIBackgroundModes</key>
                       <array>
                           <string>fetch</string>
                           <string>remote-notification</string>
                       </array>
                       <key>NSAppTransportSecurity</key>
                       <dict>
                           <key>NSAllowsArbitraryLoads</key>
                           <true/>
                       </dict>
                   </dict>
               </plist>
           </ios>
       

JSON Source