Ticking down timer that gets updated automatically on firestore [closed] - swift

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I am currently writing an IOS app that uses Cloud Firestore as a database. One of the app's functions is a ticking down timer that needs to be shown on the screen for users to show how much time is left for a function. Problem is I am currently using a timer, but that doesn't work as when I exit the app it will stop updating the database on how much time is left . Any suggestions on how I could solve this problem?

There's no way you would be able to interact with your code while your app is closed. iOS is strict, once your app is closed, you have 30 seconds to process anything necessary. your app is suspended from regular activities,
As #matt mentioned:
A timer can run in the background only if both the following are true:
Your app for some other reason runs in the background. (Most apps
don't; most apps are suspended when they go into the background.) And:
The timer was running already when the app went into the background.
I also suggest a look over here:
Swift 3 - How to make timer work in background

Set a date and time in Database when the function for Timer is called.
You can then check whenever the app is open to calculate the amount of time taken.

Related

Swift - Bluetooth write characteristic in Background [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'm developing an App in Swift 5 that connects to a wearable device that measure body information (temperature, heart rate, etc.)
For measure this information, I have to write a Data object in one characteristic of the device (and receive the information in other characteristic with notifications activated), and now i have to measure it every 30 minutes, so I have to create a timer with repeat every 30 minutes to execute that "write" in the BLE characteristic. (All the options in Capabilities are already activated - bluetooth-central, bluetooth-peripheral, background-processing, background-fetch)
I've read a lot of topics in Stack Overflow and there are people that says that you can't write to BLE in background and other that say that you can.
Before to implement all the possibilities I've read: It's possible to execute every 30 minutes a task to connect to a device, set notification to true to one characteristic, and write a Data object in one characteristic in Background Mode?
If the response is "Yes", is there any code that I have to implement apart from the corresponding bluetooth methods that already work in the foreground?
I've not attach my BLEManager class (centralManager) because is the "standard" from the Apple Documentation, but if you need, ask me and I'll attach it.
It's possible to use CoreBluetooth in background mode: https://developer.apple.com/library/archive/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/CoreBluetoothBackgroundProcessingForIOSApps/PerformingTasksWhileYourAppIsInTheBackground.html
Note a few caveats here:
To perform certain peripheral role tasks while in the background, you must include the UIBackgroundModes key with the bluetooth-peripheral value in your app’s Info.plist file. When this key-value pair is included in the app’s Info.plist file, the system wakes up your app to process read, write, and subscription events.
I think you can wake the app directly with the peripheral, but scheduling probably won't work.
Upon being woken up, an app has around 10 seconds to complete a task
Not sure what you're trying to do, but you're time limited so keep that in mind as well.

Wrap an app in another app [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I was curious as to whether it's possible or not to "wrap" and app inside another. For example, insert the code of YOUR app (hereafter referred to as cookie cutter) into an existing app (hereafter referred to as wrapper) with the wrapper app designer's permission, of course. and have your app sit latent for x amount of time. After x amount of time, the cookie cutter app pulls up and initiates its code. From that point on, the cookie cutter app is accessible by pressing a button in the top left corner of the wrapper app, which will switch views to the cookie cutter. My question comes in two parts.
Part A: is this something that apple would allow? I know there's a certain level of red tape regarding what apple allows and doesn't allow
Part B: Would this be possible, even if Apple allowed it? Would the way that apps are designed allow for this functionality to be part of an app in the first place?
By asking this question, i'm more looking for articles on the subject. It's hard to fit this entire question into a couple words that can be searched for on google. Any ideas? Thanks for the help.
I think this is not possible (I don't know whether it is possible in Jailbroken devices). In iOS each app is sandboxed, so you can't run an app inside an app.
Also running app, terminating it these kind of things are managed by SpringBoard (Simply os). So you can't do this.
Suggestion:
Why can't you simply display the Second app's icon (in imageView or in button) inside the First app ? When useer tap on that icon open that app using URLScheme.
Like:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:yourSecondAppURL]];

Apple reject iPad app [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
We have developed an iPad application and submited it to the apple store for review after properly testing at our end. Apple rejected our app giving the following reason:-
We found that your app failed to launch on iPad running iOS 5.0.1, on
both Wi-Fi and cellular networks
We encountered the issue when selecting the application on the Home
screen - the app displayed a launch image then quit unexpectedly. This
may be because iOS 5 uses a watchdog timer for applications; if an
application takes too long to complete its initial startup, the
operating system terminates the application.
For information about the watchdog timer, please see Technical Q&A:
Application does not crash when launched from debugger but crashes
when launched by user..
Another possibility could be a missing entitlement. For more
information, please see the Technical Note: Resolving "0x800003A",
applications not launching and "missing entitlement".
We are not able to understand why Apple has rejected the app since we are not able to reproduce this issue at our end, and Apple's feedback is not very descriptive.
So what can we do to workaround this problem and resubmit it to apple store?
When Apple tested your app, they tried to launch it, and it never finished launching. If it takes too long to launch (5-10 seconds) it will be terminated by springboard and never finish. That's likely what happened. It's also possible that you had bad entitlements, but you probably would have run into that problem sooner.
Is there any chance you're doing synchronous network access on the main thread when your app is launched? This could easily cause this problem. If so, you should fix your app to never do synchronous network access on the main thread.
you need to remove all the synchronous UI/WEB update calls which blocks applicationDidFinishLaunching:
to return YES;
applicationDidFinishLaunching must return asap without blocking application thread for lets say - 1 second.
move your blocking code to a method and use performSelector afterDelay for that.

How to detect an incoming call and start my app? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I want to develop an iPhone callerID application. I have following challenges to develop
How to detect incoming call?
Need to start my app when an incoming call occurs
Please help me out..I am new to iPhone development.
Thanks,
Srikanth
You can't do this. iOS apps cannot launch themselves without direct user interaction, and incoming calls suspend any apps that are already running.
I'm fairly certain this would be impossible in the iOS framework. Incoming calls suspend any active application and take priority over other operations. Further more even if you did manage the overwrite the iOS app lifecycle I think it is highly unlikely that Apple would approve the application because it attempts to replicate the functionality of the Phone app's caller ID. Apple doesn't like it when you try to replace their products (Ask Google Voice). They may have started to loosen up a little on this (See Opera browser and Skype apps) but I think this one would get flagged and rejected.
Short answer: you can't.
Apps are started when a user requests it, so you can't tell an app to start when a call comes in.
And an already running app is suspended when a call comes in. You can't pick up any detail about the call.
No. Simply you cannot do that. There is no public API is available to do that. Your app will be in sandbox environment and your app will be suspended when a call comes in. You cannot access them in anyway.

Shutdown IPhone when an application hangs [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
My application hangs. Pressing the home button doesn't return to the springboard anymore. Additionally pressing the power button for 10 seconds doesn't turn the iphone off at all.
Is there any way to force a shutdown?
1 - To 'Force Quit' an iPhone application, hold down the Home button for up to 5 seconds.
2 - To force a reset (in rare occassions when 1 does not work), hold down the Power and Home buttons together for 10 seconds.
(this is documented in a Apple Support article - http://support.apple.com/kb/HT1430)
To force shutdown the iPhone 3G, just press down the power button first, followed by the home button. Hold the 2 buttons down until your screen changes.
That's it... A simple, but undocumented solution. Oh well. So far my iPhone has crashed in a few ways and this worked all the time.
If your application reproducibly hangs the phone, please file a bug report at bugreport.apple.com and attach a copy of your application. This is something Apple would be very interested in debugging. Thanks!
My iPhone hanged during boot when it tried to reset & erase all the iphoe contents.
Following are the steps to get your iPhone booting in Recovery Mode:
Step 1: Before getting the iphone in recovery mode, Open iTunes on your MAC or PC & attach the cable to iPhone.
Step 2: Hold down the Power & Home buttom simultaneously until the screen changes (around 10 secs.).
Step 3: Release the Power Button and keep pressing the Home Button for at least 30 secs.
Folow the instructions on your iTunes to restore the firmware of iPhone.
Hope, that this solution works for all who had problems like me.
Thankfully my problem is Solved.