xcode iOS cannot connect to firebase server to get token

rijotech6 years ago

Hi, I'm trying to get the iOS version of Traccar manager to received push notifications from firebase but for some unknown reason to my knowledge I can't get it to work I'm getting this error message.

2019-01-12 20:14:04.481223-0500 GPS Tracker[9105:2525264]  - <AppMeasurement>[I-ACS036002] Analytics screen reporting is enabled. Call +[FIRAnalytics setScreenName:setScreenClass:] to set the screen name or override the default screen class name. To disable screen reporting, set the flag FirebaseScreenReportingEnabled to NO (boolean) in the Info.plist
2019-01-12 20:14:04.607009-0500 GPS Tracker[9105:2525145] You've implemented -[<UIApplicationDelegate> application:didReceiveRemoteNotification:fetchCompletionHandler:], but you still need to add "remote-notification" to the list of your supported UIBackgroundModes in your Info.plist.
2019-01-12 20:14:27.160129-0500 GPS Tracker[9105:2525145] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2019-01-12 20:14:27.161396-0500 GPS Tracker[9105:2525145] [MC] Reading from public effective user settings.
2019-01-12 20:15:55.260814-0500 GPS Tracker[9105:2525145] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
    (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x2833e32f0 h=-&- v=-&- _UIToolbarContentView:0x10dd5ce10.width == UIToolbar:0x10dd5a000.width   (active)>",
    "<NSLayoutConstraint:0x2833f9d60 H:|-(0)-[_UIButtonBarStackView:0x10de4a880]   (active, names: '|':_UIToolbarContentView:0x10dd5ce10 )>",
    "<NSLayoutConstraint:0x2833f9db0 _UIButtonBarStackView:0x10de4a880.trailing == _UIToolbarContentView:0x10dd5ce10.trailing   (active)>",
    "<NSLayoutConstraint:0x2833e12c0 H:|-(20)-[_UIModernBarButton:0x10de6da40]   (active, names: '|':_UIButtonBarButton:0x10de6d5f0 )>",
    "<NSLayoutConstraint:0x2833e1310 H:[_UIModernBarButton:0x10de6da40]-(>=8)-|   (active, names: '|':_UIButtonBarButton:0x10de6d5f0 )>",
    "<NSLayoutConstraint:0x2833e1900 H:|-(>=5)-[_UIModernBarButton:0x10de6e9b0]   (active, names: '|':_UIButtonBarButton:0x10de6e360 )>",
    "<NSLayoutConstraint:0x2833e1950 H:[_UIModernBarButton:0x10de6e9b0]-(>=5)-|   (active, names: '|':_UIButtonBarButton:0x10de6e360 )>",
    "<NSLayoutConstraint:0x2833e2300 H:|-(8)-[_UIModernBarButton:0x10de6f810'Done']   (active, names: '|':_UIButtonBarButton:0x10de60200 )>",
    "<NSLayoutConstraint:0x2833e2350 H:[_UIModernBarButton:0x10de6f810'Done']-(20)-|   (active, names: '|':_UIButtonBarButton:0x10de60200 )>",
    "<NSLayoutConstraint:0x2833e2710 'UISV-canvas-connection' UILayoutGuide:0x2829d15e0'UIViewLayoutMarginsGuide'.leading == _UIButtonBarButton:0x10de6d5f0.leading   (active)>",
    "<NSLayoutConstraint:0x2833e28f0 'UISV-canvas-connection' UILayoutGuide:0x2829d15e0'UIViewLayoutMarginsGuide'.trailing == _UIButtonBarButton:0x10de60200.trailing   (active)>",
    "<NSLayoutConstraint:0x2833e2940 'UISV-spacing' H:[_UIButtonBarButton:0x10de6d5f0]-(0)-[UIView:0x10de6e180]   (active)>",
    "<NSLayoutConstraint:0x2833e2990 'UISV-spacing' H:[UIView:0x10de6e180]-(0)-[_UIButtonBarButton:0x10de6e360]   (active)>",
    "<NSLayoutConstraint:0x2833e29e0 'UISV-spacing' H:[_UIButtonBarButton:0x10de6e360]-(0)-[UIView:0x10de6ecf0]   (active)>",
    "<NSLayoutConstraint:0x2833e2a30 'UISV-spacing' H:[UIView:0x10de6ecf0]-(0)-[_UIButtonBarButton:0x10de60200]   (active)>",
    "<NSLayoutConstraint:0x2833e3480 'UIView-Encapsulated-Layout-Width' UIToolbar:0x10dd5a000.width == 0   (active)>",
    "<NSLayoutConstraint:0x2833f9c20 'UIView-leftMargin-guide-constraint' H:|-(0)-[UILayoutGuide:0x2829d15e0'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':_UIButtonBarStackView:0x10de4a880 )>",
    "<NSLayoutConstraint:0x2833f9cc0 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x2829d15e0'UIViewLayoutMarginsGuide']-(0)-|(LTR)   (active, names: '|':_UIButtonBarStackView:0x10de4a880 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x2833e1310 H:[_UIModernBarButton:0x10de6da40]-(>=8)-|   (active, names: '|':_UIButtonBarButton:0x10de6d5f0 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2019-01-12 20:15:55.275034-0500 GPS Tracker[9105:2525145] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
    (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x2833e32f0 h=-&- v=-&- _UIToolbarContentView:0x10dd5ce10.width == UIToolbar:0x10dd5a000.width   (active)>",
    "<NSLayoutConstraint:0x2833f9d60 H:|-(0)-[_UIButtonBarStackView:0x10de4a880]   (active, names: '|':_UIToolbarContentView:0x10dd5ce10 )>",
    "<NSLayoutConstraint:0x2833f9db0 _UIButtonBarStackView:0x10de4a880.trailing == _UIToolbarContentView:0x10dd5ce10.trailing   (active)>",
    "<NSLayoutConstraint:0x2833e1900 H:|-(>=5)-[_UIModernBarButton:0x10de6e9b0]   (active, names: '|':_UIButtonBarButton:0x10de6e360 )>",
    "<NSLayoutConstraint:0x2833e1950 H:[_UIModernBarButton:0x10de6e9b0]-(>=5)-|   (active, names: '|':_UIButtonBarButton:0x10de6e360 )>",
    "<NSLayoutConstraint:0x2833e2300 H:|-(8)-[_UIModernBarButton:0x10de6f810'Done']   (active, names: '|':_UIButtonBarButton:0x10de60200 )>",
    "<NSLayoutConstraint:0x2833e2350 H:[_UIModernBarButton:0x10de6f810'Done']-(20)-|   (active, names: '|':_UIButtonBarButton:0x10de60200 )>",
    "<NSLayoutConstraint:0x2833e2710 'UISV-canvas-connection' UILayoutGuide:0x2829d15e0'UIViewLayoutMarginsGuide'.leading == _UIButtonBarButton:0x10de6d5f0.leading   (active)>",
    "<NSLayoutConstraint:0x2833e28f0 'UISV-canvas-connection' UILayoutGuide:0x2829d15e0'UIViewLayoutMarginsGuide'.trailing == _UIButtonBarButton:0x10de60200.trailing   (active)>",
    "<NSLayoutConstraint:0x2833e2940 'UISV-spacing' H:[_UIButtonBarButton:0x10de6d5f0]-(0)-[UIView:0x10de6e180]   (active)>",
    "<NSLayoutConstraint:0x2833e2990 'UISV-spacing' H:[UIView:0x10de6e180]-(0)-[_UIButtonBarButton:0x10de6e360]   (active)>",
    "<NSLayoutConstraint:0x2833e29e0 'UISV-spacing' H:[_UIButtonBarButton:0x10de6e360]-(0)-[UIView:0x10de6ecf0]   (active)>",
    "<NSLayoutConstraint:0x2833e2a30 'UISV-spacing' H:[UIView:0x10de6ecf0]-(0)-[_UIButtonBarButton:0x10de60200]   (active)>",
    "<NSLayoutConstraint:0x2833e3480 'UIView-Encapsulated-Layout-Width' UIToolbar:0x10dd5a000.width == 0   (active)>",
    "<NSLayoutConstraint:0x2833f9c20 'UIView-leftMargin-guide-constraint' H:|-(0)-[UILayoutGuide:0x2829d15e0'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':_UIButtonBarStackView:0x10de4a880 )>",
    "<NSLayoutConstraint:0x2833f9cc0 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x2829d15e0'UIViewLayoutMarginsGuide']-(0)-|(LTR)   (active, names: '|':_UIButtonBarStackView:0x10de4a880 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x2833e1950 H:[_UIModernBarButton:0x10de6e9b0]-(>=5)-|   (active, names: '|':_UIButtonBarButton:0x10de6e360 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2019-01-12 20:15:55.279677-0500 GPS Tracker[9105:2525145] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
    (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x2833e32f0 h=-&- v=-&- _UIToolbarContentView:0x10dd5ce10.width == UIToolbar:0x10dd5a000.width   (active)>",
    "<NSLayoutConstraint:0x2833f9d60 H:|-(0)-[_UIButtonBarStackView:0x10de4a880]   (active, names: '|':_UIToolbarContentView:0x10dd5ce10 )>",
    "<NSLayoutConstraint:0x2833f9db0 _UIButtonBarStackView:0x10de4a880.trailing == _UIToolbarContentView:0x10dd5ce10.trailing   (active)>",
    "<NSLayoutConstraint:0x2833e2300 H:|-(8)-[_UIModernBarButton:0x10de6f810'Done']   (active, names: '|':_UIButtonBarButton:0x10de60200 )>",
    "<NSLayoutConstraint:0x2833e2350 H:[_UIModernBarButton:0x10de6f810'Done']-(20)-|   (active, names: '|':_UIButtonBarButton:0x10de60200 )>",
    "<NSLayoutConstraint:0x2833e2710 'UISV-canvas-connection' UILayoutGuide:0x2829d15e0'UIViewLayoutMarginsGuide'.leading == _UIButtonBarButton:0x10de6d5f0.leading   (active)>",
    "<NSLayoutConstraint:0x2833e28f0 'UISV-canvas-connection' UILayoutGuide:0x2829d15e0'UIViewLayoutMarginsGuide'.trailing == _UIButtonBarButton:0x10de60200.trailing   (active)>",
    "<NSLayoutConstraint:0x2833e2940 'UISV-spacing' H:[_UIButtonBarButton:0x10de6d5f0]-(0)-[UIView:0x10de6e180]   (active)>",
    "<NSLayoutConstraint:0x2833e2990 'UISV-spacing' H:[UIView:0x10de6e180]-(0)-[_UIButtonBarButton:0x10de6e360]   (active)>",
    "<NSLayoutConstraint:0x2833e29e0 'UISV-spacing' H:[_UIButtonBarButton:0x10de6e360]-(0)-[UIView:0x10de6ecf0]   (active)>",
    "<NSLayoutConstraint:0x2833e2a30 'UISV-spacing' H:[UIView:0x10de6ecf0]-(0)-[_UIButtonBarButton:0x10de60200]   (active)>",

    "<NSLayoutConstraint:0x2833e3480 'UIView-Encapsulated-Layout-Width' UIToolbar:0x10dd5a000.width == 0   (active)>",
    "<NSLayoutConstraint:0x2833f9c20 'UIView-leftMargin-guide-constraint' H:|-(0)-[UILayoutGuide:0x2829d15e0'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':_UIButtonBarStackView:0x10de4a880 )>",
    "<NSLayoutConstraint:0x2833f9cc0 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x2829d15e0'UIViewLayoutMarginsGuide']-(0)-|(LTR)   (active, names: '|':_UIButtonBarStackView:0x10de4a880 )>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x2833e2350 H:[_UIModernBarButton:0x10de6f810'Done']-(20)-|   (active, names: '|':_UIButtonBarButton:0x10de60200 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2019-01-12 20:16:13.188076-0500 GPS Tracker[9105:2525320] 5.8.0 - [Firebase/InstanceID][I-IID003009] Failed to fetch default token Error Domain=com.firebase.iid Code=1003 "(null)"
2019-01-12 20:16:26.281167-0500 GPS Tracker[9105:2525321] 5.8.0 - [Firebase/InstanceID][I-IID003009] Failed to fetch default token Error Domain=com.firebase.iid Code=1003 "(null)"
Anton Tananaev6 years ago

From what I can tell, you have some UI issue. Also, have you included plist file?

rijotech6 years ago

Yes I did.

rijotech6 years ago

The app runs but It doesn't connect to the firebase server.

rijotech6 years ago

Finally I managed to get push notifications on my IOS app and i can send notifications from my firebase console but not from my traccar server. Any idea why I may be experiencing this also I have check my Traccar server log file and i see no errors.
I'm using my firebase project Server key API on my traccar config file.
I have to say it was not easy wow.

rijotech6 years ago

This is my config i have changed the values for security reasons.

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>

<properties>

    <entry key='config.default'>./conf/default.xml</entry>

    <!--

    This is the main configuration file. All your configuration parameters should be placed in this file.

    Default configuration parameters are located in the "default.xml" file. You should not modify it to avoid issues
    with upgrading to a new version. Parameters in the main config file override values in the default file. Do not
    remove "config.default" parameter from this file unless you know what you are doing.

    For list of available parameters see following page: https://www.traccar.org/configuration-file/

    -->

    <entry key='database.driver'>com.mysql.jdbc.Driver</entry>
    <entry key='database.url'>jdbc:mysql://localhost/traccar?allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=yes&amp;characterEncoding=UTF-8&amp;sessionVariables=sql_mode=''</entry>
    <entry key='database.user'>traccar</entry>
    <entry key='database.password'>burner</entry>
    
    <entry key='database.positionsHistoryDays'>7</entry>
    
    <entry key='server.timeout'>120</entry>

    
    <entry key='mail.smtp.host'>smtp.gmail.com</entry>
    <entry key='mail.smtp.port'>465</entry>
    <entry key='mail.smtp.ssl.enable'>true</entry>
    <entry key='mail.smtp.from'>rtech@gmail.com</entry>
    <entry key='mail.smtp.auth'>true</entry>
    <entry key='mail.smtp.username'>rtech@gmail.com</entry>
    <entry key='mail.smtp.password'>rnero</entry>
    
    <entry key='notificator.types'>web,mail,sms</entry>
    
    <entry key='sms.enable'>true</entry>
    
    <entry key='sms.smpp.enable'>true</entry>
    
    <entry key='notificator.types'>web,mail,firebase</entry>
    <entry key='notificator.firebase.key'>AAAA3ERyKUk:APA91bGbmF_tWm5O0MZ1QeUP_YxVoHTkpL2tLSZsnXLQqJya1YV1XQzNEWqw16Vp_KsA8tl2Q76hb2zB94kJyxtOS9VMYmsxzD8u4NEM_d2ymu3IlsySimjjF7nl_ouog2vzJy</entry>
    
    <entry key='sms.smpp.host'>smpp.smsglobal.com</entry>
    <entry key='sms.smpp.port'>1775</entry>
    <entry key='sms.smpp.username'>s0gz8o</entry>
    <entry key='sms.smpp.password'>Z2Ftz3</entry>
    <entry key='sms.smpp.notificationsCharset'>GSM</entry>
    <entry key='sms.smpp.notificationsDataCoding'>0</entry>
    <entry key='sms.smpp.sourceAddress'>+1347421305</entry>
    
    <entry key = 'geocoder.enable'>true</entry>
    <entry key = 'geocoder.type'>google</entry>
    <entry key = 'geocoder.key'>AIzaSyBh3x2NicvfxDD8igwusYlvO4gPwXw</entry>
    




</properties>
Anton Tananaev6 years ago

Check device token in user attributes.

rijotech6 years ago

I have a token under user attribute.
https://imgur.com/a/KOcPfTm

Anton Tananaev6 years ago

Then it should be working, assuming that everything else is configured correctly.

rijotech6 years ago

I did the normal on a ubuntu server setup apache with ssl, configured the system to work with mysql on traccar.xml, I don't really know what else i should do to get it to work.

rijotech6 years ago

I realized I'm not supposed to have SMS enable if I have firebase enable on my config, I fixed that but still cannot receive notification via Traccar Server. I can only receive push notifications via Firebase console on my Android and IOS apps.

Everything is setup correctly I assumed, I have user notification token under Attributes, I have my Firebase Cloud Server API Key, I have try so many stuff I can't think of what could be wrong.

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>

<properties>

    <entry key='config.default'>./conf/default.xml</entry>

    <!--

    This is the main configuration file. All your configuration parameters should be placed in this file.

    Default configuration parameters are located in the "default.xml" file. You should not modify it to avoid issues
    with upgrading to a new version. Parameters in the main config file override values in the default file. Do not
    remove "config.default" parameter from this file unless you know what you are doing.

    For list of available parameters see following page: https://www.traccar.org/configuration-file/

    -->

    <entry key='database.driver'>com.mysql.jdbc.Driver</entry>
    <entry key='database.url'>jdbc:mysql://localhost/traccar?allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=yes&amp;characterEncoding=UTF-8&amp;sessionVariables=sql_mode=''</entry>
    <entry key='database.user'>traccar2</entry>
    <entry key='database.password'>1burner</entry>
    
    <entry key='database.positionsHistoryDays'>7</entry>

    <entry key='mail.smtp.host'>smtp.gmail.com</entry>
    <entry key='mail.smtp.port'>465</entry>
    <entry key='mail.smtp.ssl.enable'>true</entry>
    <entry key='mail.smtp.from'>ritech@gmail.com</entry>
    <entry key='mail.smtp.auth'>true</entry>
    <entry key='mail.smtp.username'>rtech@gmail.com</entry>
    <entry key='mail.smtp.password'>1nero</entry>
    
    
    <entry key='notificator.types'>web,mail,firebase</entry>
    <entry key='notificator.firebase.key'>AAAAu4piSK4:APA91bEvR8AV00XhS62W-3YdEDBAUVJQkM8TqbdERrgKq_WkPtvWuZXEH0QFuG6d0dX9fZx1T8tpi4h7AX1b3t_0nc_2kYksmscsdl8L7L-Cpyp6oqk699q--is87qBo-9sBW5W9I3AI</entry>

</properties>
Anton Tananaev6 years ago

You can have SMS enabled, if it's configured correctly. It should not conflict with Firebase.