In iOS6 I can specify the timeout that the next player must complete his turn, using this function:
endTurnWithNextParticipants:turnTimeout:matchData:completionHandler.
However, the timeout property doesn't exist in iOS5.
Since I want to support iOS5 as well, how can I specify that timeout in iOS5? Without this, the player can simply not play forever, and the game will be stuck without ending properly.
Thanks.
So far as I know, you are stuck if you’re supporting iOS 5.
One thing that might help is to use a local notification to remind a player to take their turn. (You’d cancel it when they do.) This won’t give quite the same user experience, but since most of your players will be on iOS 6, you could assume that at twice the timeout value, the iOS 5 player should have moved, and remind them to check on their current match.
Related
I've been googling for a long time about how to run code in the background for IOS, and for what I have come up with the short answer is that you can't. And the long answer that you can but is limited. I've seen similar apps to the one I am creating so I feel like there should be a way to make it.
So on to the actual app I want to create. I want to create an application that will continuously play a random sound from a list in between a set interval, let's say for this example 30-60 seconds. So randomly every 30<t<60 seconds a sound should play. You can think of it as a positive affirmations app that should play positive affirmations throughout the day. I've seen such apps exist for IOS, I haven't tried them but I assume they should work like that? And when the app is firing the code to play the sound, Ideally I also want it to send information to a server.
I am using "Flutter Background Service" and "AudioPlayer" packages and have gotten a very very early demo version to work on android where it plays the sound after a random amount of time. And now I want it to work for Iphones also. Since it's not a playlist, I can't use the inbuilt functions for IOS that allows media players to run in the background. For what I can understand is that no code can run for longer then 30 seconds on IOS from when the app goes to the background, or the screen locks. And you can't run background tasks more often then every 15 minutes, or 3 minutes for small work. But that is way to long for the use case I want. I'd want to be able to run the function every 10 seconds to maybe 1 minute at the latest.
So I am wondering, is there a way to get such an application to work for IOS? It feels like it should be possible somehow. I don't really care if you have to "play dirty" to achieve it, and I don't know if it matters or not but I am not planning on publishing the app to the app store. It will only be a private app for me and a few friends.
One way I've been thinking about is maybe use push notifications from a server to trigger it. But I'd rather not have to resort to this if I can help it, if it even is possible to have a push notification to run code/trigger functions in the background?
We're using the iOS Spotify sdk to play Spotify tracks via SPTAudioStreamingController. I'm playing a track via playURIs:fromIndex:callback but the goal is to play it back starting from a given time offset (vs the start of the track).
I've tried passing a callback to playURIs:fromIndex:callback that calls seekToOffset:callback to the desired time index but that fails or is otherwise ignored (presumably because the Spotify player internals aren't yet set up in a state to perform the seek).
I would even consider initiating a seek via dispatch_get_main_queue() with a delay, but that makes me (a) want to take a shower and (b) has the gross side effect of hearing the first second or two of audio before the seek is executed. Yikes!
If there's any devs who know the internals that could hit tip a quality way to do this, that'd be awesome!
You need to call
- (void)playURIs:(NSArray *)uris withOptions:(SPTPlayOptions *)options callback:(SPTErrorableOperationCallback)block
If you read up on SPTPlayOptions, one of them is startTime which you can configure in seconds.
I'm trying to create a little reminder-app for my special needs ;-)
Is there a way to tell iOS to wake my app up from the background at a specific time/in regular intervals?
The app would then decide to turn on the screen or play a sound, if required.
So far I can't figure out how to do this. All I can find on iOS 7 multitasking is about playing music, downloading data etc. Nothing time based...
As far as I know, it is not possible.
The closest you can get to that is by sending either a local or a push notification.
Take a look at local notifications: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Introduction.html
The main class is UILocalNotification, documented at https://developer.apple.com/library/ios/documentation/iphone/Reference/UILocalNotification_Class/Reference/Reference.html
I am finishing up an update to a 4 player Game Center enabled game and am suddenly having issues with spurious player disconnection messages that I did not have in the previous version. What is more odd is that not all devices connected to the match are receiving the message. One device will think the player is disconnected, but there is still messaging passing from the (supposedly) disconnected player to the other players.
These messages are coming straight from the match instance via match:player:didChangeState: messages so I don't think it would be anything in my code, but it doesn't make much sense. The game can progress for 10+ minutes with no problems and once one errant disconnect comes it, the rest fall out pretty quickly.
I have searched the web with every search term I can think of to see if others have seen this kind of behaviour and it appears that it is unique. It has to be something in my code, but I can't even think of how to get to the bottom of it.
Any help would be GREATLY appreciated,
Cameron
Make sure to call this:
//Finalize
[[GKMatchmaker sharedMatchmaker] finishMatchmakingForMatch:match];
After all players have connected. I was having this problem and it seems to have stopped the spurrious disconnects in my case.
I have a Application on a PC which displays time-information for a mp3 song that is played. I now need to display this time information within an iPad App. The counting timers for remaining time, player position and song length must be in sync between iPad an PC.
I thought about using a socket connection (AsyncSocket on iPad) to keep the counters in sync.
Is there a better way doing this? I don't want to run in the wrong direction...
Additional, it should be possible to have more than one iPad showing the Information in future. That's a "nice to have" feature...
I don't need ready to use code snippets, it's more a theoretical question. (if someone has a ready to use code snippet, that's also good for me :-) )
MadMaxApp
i now used the AsyncSocket to solve the requirements. It works perfectly. Don't forget the handling of closing the socket connection if the app goes in background. Depending on the server the app is talking with, not closing the socket can lead to a problem in reconnecting.