{"action":"created","issue":{"url":"https://api.github.com/repos/adamhartford/SwiftR/issues/8","labels_url":"https://api.github.com/repos/adamhartford/SwiftR/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/adamhartford/SwiftR/issues/8/comments","events_url":"https://api.github.com/repos/adamhartford/SwiftR/issues/8/events","html_url":"https://github.com/adamhartford/SwiftR/issues/8","id":103818417,"number":8,"title":"complexHub.invoke ---> fatal error: unexpectedly found nil while unwrapping an Optional value","user":{"login":"pwr7549","id":1859394,"avatar_url":"https://avatars.githubusercontent.com/u/1859394?v=3","gravatar_id":"","url":"https://api.github.com/users/pwr7549","html_url":"https://github.com/pwr7549","followers_url":"https://api.github.com/users/pwr7549/followers","following_url":"https://api.github.com/users/pwr7549/following{/other_user}","gists_url":"https://api.github.com/users/pwr7549/gists{/gist_id}","starred_url":"https://api.github.com/users/pwr7549/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pwr7549/subscriptions","organizations_url":"https://api.github.com/users/pwr7549/orgs","repos_url":"https://api.github.com/users/pwr7549/repos","events_url":"https://api.github.com/users/pwr7549/events{/privacy}","received_events_url":"https://api.github.com/users/pwr7549/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-08-29T00:55:48Z","updated_at":"2015-09-01T01:41:03Z","closed_at":null,"body":"I tried to follow your ways of writing in that page also I tried to applied without :[String, AnyObject] to this message or with it.. I tried with many various possible to assign this. I always end up with this same fatal error like this.. \r\n\r\nfatal error: unexpectedly found nil while unwrapping an Optional value\r\n\r\nfunc adamsWay() {\r\n        SwiftR.connect(\"http://neverland.com:8080/configserver/signalr/hubs\") { [weak self] connection in\r\n            self?.complexHub = connection.createHubProxy(\"lPConfigServer\")\r\n            \r\n            self?.complexHub.on(\"getNewOnlineUser\") { args in\r\n                let m: AnyObject = args![\"0\"] as AnyObject!\r\n                println(m)\r\n            }\r\n        }\r\n        \r\n        let message: [String: AnyObject] = [\r\n            \"messageId\": 1,\r\n            \"message\": \"Complex Test\",\r\n            \"detail\": \"This is a complex message\",\r\n            \"items\": [\"foo\", \"bar\", \"baz\"]\r\n        ]\r\n\r\n       // Invoke server method\r\n        complexHub.invoke(\"getConnected\", arguments: [message])  <<<< Something is going on with issue of [AnyObject]? here within that argument part.. Any suggest to resolve that? \r\n    }"},"comment":{"url":"https://api.github.com/repos/adamhartford/SwiftR/issues/comments/136547188","html_url":"https://github.com/adamhartford/SwiftR/issues/8#issuecomment-136547188","issue_url":"https://api.github.com/repos/adamhartford/SwiftR/issues/8","id":136547188,"user":{"login":"pwr7549","id":1859394,"avatar_url":"https://avatars.githubusercontent.com/u/1859394?v=3","gravatar_id":"","url":"https://api.github.com/users/pwr7549","html_url":"https://github.com/pwr7549","followers_url":"https://api.github.com/users/pwr7549/followers","following_url":"https://api.github.com/users/pwr7549/following{/other_user}","gists_url":"https://api.github.com/users/pwr7549/gists{/gist_id}","starred_url":"https://api.github.com/users/pwr7549/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pwr7549/subscriptions","organizations_url":"https://api.github.com/users/pwr7549/orgs","repos_url":"https://api.github.com/users/pwr7549/repos","events_url":"https://api.github.com/users/pwr7549/events{/privacy}","received_events_url":"https://api.github.com/users/pwr7549/received_events","type":"User","site_admin":false},"created_at":"2015-09-01T01:41:03Z","updated_at":"2015-09-01T01:41:03Z","body":"\r\nThis is Server Side here.........\r\nnamespace MonkeyServer\r\n{\r\n    /// <summary>\r\n    /// SignalR Server : Complete Server for Video Conferencing, JavaScript Client and iOS client access it control Monkey call operations.\r\n    /// </summary>\r\n    public class MonkeyServer: Hub \r\n    {\r\n        /// <summary>\r\n        /// All online users dictionary\r\n        /// </summary>\r\n        public static ConcurrentDictionary<string, User> Users = new ConcurrentDictionary<string, User>();\r\n        /// <summary>\r\n        /// All online Connections array\r\n        /// </summary>\r\n        public static Connections connections = new Connections();\r\n\r\n        public User GetConnected(string username, string usertype, string loginid, string entityIDOfCallingInterpreter, string REMOTE_ADDR, string timeZone, string usercreationdatetime, string userregistrationstatus, int freeSessions, bool reconnect)\r\n        {\r\n\r\n            return GetConnectedInternal(username, usertype, loginid, entityIDOfCallingInterpreter, REMOTE_ADDR, timeZone, usercreationdatetime, userregistrationstatus, freeSessions, false, reconnect,false);\r\n        }\r\n    \r\n        \r\n/// <summary>\r\n/// Login in signalr and database user login event will be registered\r\n/// </summary>\r\n/// <param name=\"username\"></param>\r\n/// <param name=\"usertype\"></param>\r\n/// <param name=\"loginid\"></param>\r\n/// <param name=\"entityIDOfCallingInterpreter\"></param>\r\n/// <param name=\"REMOTE_ADDR\"></param>\r\n/// <param name=\"timeZone\"></param>\r\n/// <param name=\"usercreationdatetime\"></param>\r\n/// <param name=\"userregistrationstatus\"></param>\r\n/// <param name=\"freeSessions\"></param>\r\n/// <returns></returns>\r\npublic User GetConnected(string username, string usertype, string loginid, string entityIDOfCallingInterpreter,string REMOTE_ADDR, string timeZone, string  usercreationdatetime, string userregistrationstatus, int freeSessions)\r\n        {a\r\n            \r\n            return GetConnectedInternal(username, usertype, loginid, entityIDOfCallingInterpreter, REMOTE_ADDR, timeZone, usercreationdatetime, userregistrationstatus, freeSessions, false, false, true);\r\n            }\r\n\r\n/// <summary>\r\n/// Old connect method \r\n/// </summary>\r\n/// <param name=\"username\"></param>\r\n/// <param name=\"usertype\"></param>\r\n/// <param name=\"loginid\"></param>\r\n/// <param name=\"entityIDOfCallingInterpreter\"></param>\r\n/// <param name=\"REMOTE_ADDR\"></param>\r\n/// <returns></returns>\r\npublic User GetConnected(string username, string usertype, string loginid, string entityIDOfCallingInterpreter, string REMOTE_ADDR)\r\n{\r\n    return GetConnectedInternal(username, usertype, loginid, entityIDOfCallingInterpreter, REMOTE_ADDR, \"0\", DateTime.Now.ToString(),\"\", 0, true,false, true);\r\n}\r\n\r\n/// <summary>\r\n/// This function is responsible to connect a new user to SignalR Server, It logs Login log entry in event log table. It provides the current user list of all available users and let other users know entry of a new user. It also create opentok session for a new user., \r\n/// </summary>\r\n/// <param name=\"username\"></param>\r\n/// <param name=\"usertype\"></param>\r\n/// <param name=\"loginid\"></param>\r\n/// <param name=\"entityIDOfCallingInterpreter\"></param>\r\n/// <param name=\"REMOTE_ADDR\"></param>\r\n/// <param name=\"timeZone\"></param>\r\n/// <param name=\"usercreationdatetime\"></param>\r\n/// <param name=\"userregistrationstatus\"></param>\r\n/// <param name=\"freeSessions\"></param>\r\n/// <param name=\"IsBackward\"></param>\r\n/// <returns></returns>\r\n/// \r\nprivate User GetConnectedInternal(string username, string usertype, string loginid, string entityIDOfCallingInterpreter, string REMOTE_ADDR, string timeZone, string usercreationdatetime, string userregistrationstatus, int freeSessions, bool IsBackward, bool reconnect=false, bool OLD_IOSVerison=false)\r\n{  \r\n    User user=new User();\r\n    try\r\n    {\r\n        UserType Usertype = helper.ParseEnum<UserType>(usertype);\r\n        D2D d2d = new D2D();\r\n        connections.Add(Context.ConnectionId);\r\n\r\n        EventLogUserDetails userdetail = new EventLogUserDetails();\r\n        EventLog eventlog = new EventLog();\r\n        eventlog.EventType = EventType.User_Login;\r\n        eventlog.InitiatorID = long.Parse(loginid);\r\n        eventlog.InitiatorType = Usertype;\r\n        eventlog.InitiatorName = username;\r\n         if (reconnect )\r\n        userdetail.UserLogin = EventsLogWrraper.GetEvent(eventlog);\r\n         else\r\n        userdetail.UserLogin = EventsLogWrraper.GetEventStart(eventlog);\r\n        Opentok opentok = OpentokWrapper.getOpentok(Context.ConnectionId, REMOTE_ADDR);\r\n\r\n        user = new User(username, helper.ParseEnum<UserType>(usertype), Context.ConnectionId.ToString(), opentok, loginid, entityIDOfCallingInterpreter, userdetail, int.Parse(timeZone), DateTime.Parse(usercreationdatetime), userregistrationstatus, freeSessions, IsBackward );\r\n\r\n        Users.TryAdd(Context.ConnectionId, user);\r\n        Clients.Clients(connections.AllExcept(Context.ConnectionId)).getNewOnlineUser(user);\r\n        if (OLD_IOSVerison )\r\n                  Clients.Client(Context.ConnectionId).getOnlineUsers(Users, d2d);\r\n        else\r\n             Clients.Client(Context.ConnectionId).getOnlineUsers(Users, d2d, reconnect );\r\n       \r\n        ExceptionalManager.WriteInfo(\"User Successfully connected to SignalR - UserName :\" + username + \"| Reconnected : \" + reconnect + \"| User type :\" + Usertype + \"| ConnectionId : \" + Context.ConnectionId + \"| Logid:\" + loginid + \"| Opentok Appkey:\" + opentok.ApiKey + \"| Opentok SessionId:\" + opentok.SessionId + \"| Opentok TokenID:\" + opentok.Token , \"GetConnected\", GetFileName()); \r\n\r\n    }\r\n\r\n   \r\n\r\n    catch (Exception exp)\r\n    { ExceptionalManager.LogError(user, exp);  }\r\n    return user;\r\n}"}}