I updated my app to run on iOS 8 sdk, and looks like camera and photos attachment stopped working. Action sheet shows up when tapping add attachment, but nothing happens when tapping take picture or pick from photo library. It's giving a warning "Warning: Attempt to present <UIImagePickerController: 0x171c8200> on <AGSAttachmentCollectorViewController: 0x1ac979a0> which is already presenting <UIAlertController: 0x1abbfda0>"
I'm also having this problem. Have you found a work around?
Can you try setting the modalPresenter property (10.2.4: AGSPopupsContainerViewController Class Reference ) to the app's view controller that is displaying the popups vc? You might need to tweak your app's vc hierarchy a little to make it work correctly on iOS 8 because of some changes to how alert views are displayed.
I have the same issue.
Does anyone has a solution yet?
This issue is being looked into - I'll post an update soon.
Thanks,
Suganya
I have the same problem and created a ticket to ESRI tech support but no solution yet.
"Warning: Attempt to present <UIImagePickerController: 0x1302c7000> on <AGSAttachmentCollectorViewController: 0x1335051b0> which is already presenting <UIAlertController: 0x12f69f340>"
You can use the sample project from https://github.com/Esri/arcgis-runtime-samples-ios
The project name is "OfflineFeatureEditingSample"
To add attachment function works in simulator but not in iPad Air 8.1 device. Thanks!
All,
Here's a workaround
By implementing popupsContainer:wantsToShowViewController:ofType:fromViewController:atRect: method of AGSPopupsContainerDelegate, you can present popupsContainer's different view controllers. Check if the view about to be presented in UIImagePicker, and delay the presentation. This ensures the UIAlertController that displays the action sheet in iOS8 is dismissed before the image picker is displayed.
The actual issue will be fixed in the next release of the SDK.
- (void) popupsContainer: (id< AGSPopupsContainer >) popupsContainer
wantsToShowViewController: (AGSViewController *) svc
ofType: (AGSPopupViewType) viewType
fromViewController: (AGSViewController *) fvc
atRect: (CGRect) rect {
svc.modalPresentationStyle = UIModalPresentationFormSheet; //Your preferred presentation style
if (viewType == AGSPopupViewTypeUIImagePicker) {
//Delay runloop so UIAlertController is dismissed before image picker is presented.
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
[fvc presentViewController:svc animated:YES completion:^{
NSLog(@"Presenting Image Picker");
}];
}];
}
else {
//This is necessary as you will have to present all other view controllers too.
[fvc presentViewController:svc animated:YES completion:^{
}];
}
}
//You will have to implement this method to dismiss the view controllers.
- (void) popupsContainer: (id< AGSPopupsContainer >) popupsContainer
wantsToHideViewController: (AGSViewController *) vc
ofType: (AGSPopupViewType) viewType {
[vc dismissViewControllerAnimated:YES completion:^{
}];
}
Thanks,
Suganya
Hi
Do you have a swift solution for the above problem?
Thanks.
Margit
When using the patch codes from above to take photo attachment, if we take only one photo then maybe less percentage to crash. When taking more than two then high percentage to crash the whole app. Thanks!
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
[fvc presentViewController:svc animated:YES completion:^{
NSLog(@"Presenting Image Picker");
}];
}];
}
I record some log messages for your reference. Hopefully this can be fixed.
2015-02-12 10:48:17.968 NewSDSI[3399:662257] Presenting view controllers on detached view controllers is discouraged <AGSPopupsContainerViewController: 0x1349c3e00>.
2015-02-12 10:48:22.903 NewSDSI[3399:662257] Presenting view controllers on detached view controllers is discouraged <AGSPopupsContainerViewController: 0x1349c3e00>.
2015-02-12 10:48:26.275 NewSDSI[3399:662257] Presenting view controllers on detached view controllers is discouraged <AGSPopupsContainerViewController: 0x1349c3e00>.
2015-02-12 10:50:14.792 NewSDSI[3399:662257] Presenting view controllers on detached view controllers is discouraged <AGSAttachmentCollectorViewController: 0x134641c50>.
2015-02-12 10:50:22.953 NewSDSI[3399:662257] Presenting view controllers on detached view controllers is discouraged <AGSAttachmentCollectorViewController: 0x134641c50>.
2015-02-12 10:50:23.003 NewSDSI[3399:662257] Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before
snapshotting or snapshot after screen updates.
2015-02-12 10:50:23.006 NewSDSI[3399:662257] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code
that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the
UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x1746837f0 UIView:0x17438e450.height == 0.454545*CAMModeDial:0x1346abd40.height - 4.09091>",
"<NSLayoutConstraint:0x1742971b0 CAMShutterButton:0x1345a14c0.centerY == CAMBottomBar:0x1346ab9b0.centerY>",
"<NSLayoutConstraint:0x1742929d0 V:[CAMShutterButton:0x1345a14c0]-(0)-[CAMModeDial:0x1346abd40]>",
"<NSLayoutConstraint:0x174294d70 CAMModeDial:0x1346abd40.bottom == UIButton:0x134596410'Cancel'.top>",
"<NSLayoutConstraint:0x1742925c0 V:[UIButton:0x134596410'Cancel']-(31)-| (Names: '|':CAMBottomBar:0x1346ab9b0 )>",
"<NSLayoutConstraint:0x174294910 'UIView-Encapsulated-Layout-Height' V:[PLImagePickerCameraView:0x134a56a00(0)]>",
"<NSLayoutConstraint:0x174296d00 CAMBottomBar:0x1346ab9b0.height == PLImagePickerCameraView:0x134a56a00.height>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x1746837f0 UIView:0x17438e450.height == 0.454545*CAMModeDial:0x1346abd40.height - 4.09091>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2015-02-12 10:50:23.008 NewSDSI[3399:662257] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code
that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the
UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x1742971b0 CAMShutterButton:0x1345a14c0.centerY == CAMBottomBar:0x1346ab9b0.centerY>",
"<NSLayoutConstraint:0x1742929d0 V:[CAMShutterButton:0x1345a14c0]-(0)-[CAMModeDial:0x1346abd40]>",
"<NSLayoutConstraint:0x174294d70 CAMModeDial:0x1346abd40.bottom == UIButton:0x134596410'Cancel'.top>",
"<NSLayoutConstraint:0x1742925c0 V:[UIButton:0x134596410'Cancel']-(31)-| (Names: '|':CAMBottomBar:0x1346ab9b0 )>",
"<NSLayoutConstraint:0x174294910 'UIView-Encapsulated-Layout-Height' V:[PLImagePickerCameraView:0x134a56a00(0)]>",
"<NSLayoutConstraint:0x174296d00 CAMBottomBar:0x1346ab9b0.height == PLImagePickerCameraView:0x134a56a00.height>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x1742929d0 V:[CAMShutterButton:0x1345a14c0]-(0)-[CAMModeDial:0x1346abd40]>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2015-02-12 10:50:23.519 NewSDSI[3399:662257] Presenting Image Picker