Achieve Inter-App Communication on iOS through sockets -
i wondering how inter-app communication on ios in ios 7. occurred me if foreground app bind sockets , act server, , if background app (and had background entitlement audio) can connect servers. seemed me possible inter-app communication agreeing on port between 2 apps , switching app binds port based on whether in foreground or not.
problem is, can never seem connect localhost background, example have code on loop:
truct addrinfo *server_address; int ret = getaddrinfo("localhost", "1666", null, &server_address); int connection_id = connect(self.sockethandle, server_address->ai_addr, server_address->ai_addrlen);
and connection_id -1. unsure why cannot connect given bind process not throw errors.
check answer: ios - possible communicate between apps via localhost?
also, remember make sure you're background app not stopped when other app entering in foreground (by default app stopped)
but speaking don't think it's way interapp communication: 'spirit' of ios have 1 app running in foreground. why need communicate background app? quite sure can find better way achieve result.
Comments
Post a Comment