iPhone app crashing while application running in background mode - objective-c

In my app I have implemented following main features:
Manage Contact List.
1.) Fetch the contacts from address book and save them within the app.
2.) Display the list of contacts.
3.) Link the contact with other contact to expand relationship.
Calendar Management
1.) Show the iCal Event within the app & allowing users to create new Events
2.) Show the events on calendar in Day, month & List formats
The memory may have a large memory footprint when it goes to the background. After an extended stay in the background, if I try to revive it, It crashes. This is also random and is not reproducible constantly. Also I have to open the app 2-3 time, before it actually works.
I am inclined to think that as per iOS SDK, an app in the background can be killed by iOS itself if there is a requirement to free up memory for the app which is currently in foreground, so probably that is what is happening, but when I try to relaunch it crashes again 2-3 times. Why would that be happening?
Any help would be appreciated.

try to use breakpoints at some parts of your app that might use too much memory, and you may find your problem

I suggest examining the crash log by
connecting your iOS device to your computer,
launch Xcode,
open the Organizer (Window->Organizer),
click on the Devices icon,
click on Device Logs.
It may take a few minutes for the log to be fully loaded from your device. The log should tell you where the crash occurred.
Also, if you haven't already done so, add the following code to your view controller.
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}

Related

Take pictures using camera shutter when receiving live view data

I am developing using EDSDK.
However, if I press the shutter of the camera (physical button) while receiving live view data(EVF Mode), the picture won't be taken. Is this normal?
My camera model is 200D II.
What I'm trying to do is as follows, and it's very simple.
My software activates the camera through EDSDK and receives live view data.
The person behind the camera takes a picture by pressing the camera shutter, and my software shows the picture on the screen.
The questions are as follows.
How to take pictures using physical camera shutter buttons when receiving live view data(EVF).
HDMI connections are not considered because there are features that need to be controlled directly through EDSDK.
Thank you.
Below is what I added after Johannes Bildstein's answer.
As Johannes Bildstein answered, the following code was inserted to unlock the UI.
But it still hasn't been solved.
if (!MainCamera.IsLiveViewOn) {
MainCamera.StartLiveView();
MainCamera.UILock(false);
}
Error message occurs when I try to unlock UI and get EVF data. (Shutter still doesn't work)
If I unlock UI after receiving EVF data,
When dial is in photo mode: EVF data is coming in, but the shutter still does not work.
When dial is in video mode: EVF data does not come in due to BUSY error. Is it a conflict due to UI unlocking? We check your answers and SDK documents and try in many ways, but they are still unresolved. We are currently testing the more recent model, 200D II.
"| EvfOutputDevice.Camera " should be added like below!
public void StartLiveView()
{
CheckState();
if (!IsLiveViewOn) SetSetting(PropertyID.Evf_OutputDevice, (int)(EvfOutputDevice.PC | EvfOutputDevice.Camera ));
}
The camera "UI" is probably locked. The EDSDK does that automatically when connecting and before doing certain commands. You can unlock it with EdsSendStatusCommand using kEdsCameraStatusCommand_UIUnLock.

In App Store Connect, app preview poster frame not saving

I've added some video app previews for my app on App Store Connect and when I set the video poster frame, it never saves the image that I want, it always reverts back to the one that Apple defaults to initially. Does anyone know a work around?
UPDATE: I did get in contact with App Store Connect and they told me it's a recent bug that they're actively working on fixing. I'm going to touch base with them early next week.
Issue is still happening. But if you want to be able to upload without problems try this:
Upload the screenshots of one complete language
Don't touch anything for 2-4 min once pictures are uploaded.
Then you can refresh the webpage and check if the screenshots are well uploaded.

Liveview shows no events

After creating a branch link and using it to install the app, then repeatedly tapping on the link again - that causes the app to re-open I am expecting to see events (install, open, referred session) in Dashboard > LiveView but there are no events recorded there at all.
Is there something I am missing that I need to configure to see events in LiveView?
The marketing view also only shows clicks and nothing against Installs or Re-opens?
Alex from Branch.io here: what you are doing should work as you describe, so there is probably some sort of configuration issue. Some things you can check:
Are you using the same Branch key inside your app as was used to generate the link(s)?
Try enabling debug mode to make sure the system isn't throwing out your events as fraudulent
The Marketing view sometimes has a delay, but the Live View should be at most 10-15 seconds behind. Are you seeing new data in the Clicks tab, but just not the Events tab?
Feel free to submit a ticket with additional details, so that we can help debug from the back end!

Long-running task performed in foreground is suspended when app enters background

When a user first opens my app, I need to download and install some content from a server before they can begin using the app. The problem is that this takes around 5 minutes on wifi, during which time the app goes into the background and the download is suspended.
Is there any way to either:
prevent an iOS app from entering the background whilst I perform my download
or continue peforming the task in the background (i.e. perform the task irrespective of whether the app is in the foreground or background)
Thanks
It really doesn't matter, if the user presses the home button it will go to background. Although you can do two things to mitigate the problem:
Use beginBackgroundTaskWithExpirationHandler, to give you a bit more time to download. Which you can read here.
Don't allow the device to become iddle, with [UIApplication sharedApplication].idleTimerDisabled = YES;. You can read more about that here.
Either way, the best thing you can do is to tell the user, that is an important download and he shouldn't quit the application.
Can't you include some or all of the content in your app bundle instead, and just download changes on first run?
I can't imagine this is a good first user experience, and it may not pass App Store review like this.
The only third party apps that are allowed to download in the background are newsstand apps loading issue content, and Apple are pretty strict about what they allow as newsstand apps.
You can't do what you want, in this situation. One way, and I think the best and only, is to resume your download when you app becomes active (returns to foreground state). Also, don't forget to register for connectivity notifications (Reachability class can be used for this purpose from this Apple sample app http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html). Good Luck!

how to delay application quit time in iphone sdk?

I want to register my app for push notification when my application terminates so i think if i delay my app quitting time it could be possible.Does someone knows how to delay application quitting time? I think this method
[self performSelector:(SEL)aSelector onThread:(NSThread *)thr withObject:(id)arg waitUntilDone:(BOOL)wait];
will do my job but i don't know how to use this method if someone knows please tell.I need to send some data to a server along with registering for Push Notification when my app quits.
I can't imagine why you would want to do this. If it were even possible it would be extremely annoying for a user to tap the home button and the app to take x amount of time to shut down. This time 'x' being dependent on the server connection creates even more user headache.
Apple have the home button exit apps immediately for a reason.
If you want to register the Push Notifications like you suggest, do it while the app is running. If your worrying that they won't be properly set if the user exits prematurely... don't.
As users, we all know there are sometimes consequences of exiting a program without giving it time to save your settings.
For push notification it is better to register when the app first starts and then send the push token to your server in the background. However, if you have a good reason why you need to do the registration just as the app terminates, I believe you can do this if you are using iOS 4. iOS 4 has a new feature called "task finishing" that allows an app to stay running for a few minutes after the user closes it so that it may finish up any tasks it was in the middle of (such as saving data).