Cannot remove an observer <MKUserTrackingBarButtonItem - ipad

- (void)viewWillAppear:(BOOL)animated
{
MKUserTrackingBarButtonItem *trackingBarButtonItem = [[MKUserTrackingBarButtonItem alloc]initWithMapView:_mapView];
NSArray *barButtonItems = [NSArray arrayWithObjects:trackingBarButtonItem, nil];
mapToolbar.items = barButtonItems;
...
}
Code works fine on iPhone, but on iPad when view is unloading I get an error:
Cannot remove an observer <MKUserTrackingBarButtonItem 0x9cc0930> for the key path
"controlSize" from <UIButton 0x991b420> because it is not registered as an observer.'

I contacted Apple DTS and their answer was:
"To the best of my knowledge there is no workaround for this in the current shipping SDK. I would check the latest iOS SDK beta though and see if this is still an issue."

Related

Why does my NSUserActivity not show up in the Shortcuts app?

I've defined 3 different NSUserActivitys in my iOS app to allow shortcuts to launch my app in different views. These worked just fine.
For example:
userActivityGo = [[NSUserActivity alloc] initWithActivityType:SIRI_MAIN_ACTIVITY_ID];
userActivityGo.title = #"Launch App";
userActivityGo.eligibleForPrediction = YES;
userActivityGo.eligibleForSearch = YES;
userActivityGo.userInfo = #{#"action" : #"go"};
userActivityGo.requiredUserInfoKeys = [NSSet setWithArray:userActivityGo.userInfo.allKeys];
self.userActivity = userActivityGo;
Recently (maybe due to iOS recent updates?) I've noticed these shortcuts are missing from the Shortcuts app.
When I enter the "apps" section in Shortcuts, my app is not listed there, but I can still see my predefined shortcuts and see them under "Siri Suggestions".
I did not implement intents since I don't have any special UI or input I need from the user, but as I've already said - it worked before.
Were there any related changes that could cause this?

add stamp annotation using PSPDFKit iOS objective-c

I am using PSPDFKit framework, and I am unable to add stamp annotation, using this I have implemented following:
[pdfController.annotationStateManager toggleState:PSPDFAnnotationStringStamp];
NSMutableArray<PSPDFStampAnnotation *> *defaultStamps = [NSMutableArray array];
for (NSString *stampSubject in #[#"Great!", #"Stamp", #"Like"]) {
PSPDFStampAnnotation *stamp = [[PSPDFStampAnnotation alloc] initWithSubject:stampSubject];
stamp.boundingBox = CGRectMake(0.f, 0.f, 200.f, 70.f);
[defaultStamps addObject:stamp];
}
PSPDFStampAnnotation *imageStamp = [[PSPDFStampAnnotation alloc] init];
imageStamp.image = [UIImage imageNamed:#"abc.jpg"];
imageStamp.boundingBox = CGRectMake(0.f, 0.f, imageStamp.image.size.width/4.f, imageStamp.image.size.height/4.f);
[defaultStamps addObject:imageStamp];
[PSPDFStampViewController setDefaultStampAnnotations:defaultStamps];
but I have no output.
Peter here, Founder and CEO of PSPDFKit, the PDF SDK for iOS, Android, Web, macOS and (soon) Windows. The best way to reach our support is reaching out directly to our support page. Support is part of your license subscription.
You're setting default stamps for the PSPDFStampViewController. Can you post a screenshot how things look? You're changing the default here (APPROVED, REJECTED and so on and replacing this with your own images, which is valid and works.)
Note that you only need to call this once and it needs to be called before you switch/toggle the stamp mode, so your current code will not work.
Please also make sure you use the latest version so we can rule out any old bugs or incompatibilities. As of writing this, it's Xcode 8.3 and PSPDFKit 6.6 (click for release blog post).
Stamps only show up if you have the annotation component licensed - if you ping us on support my team can check what components you have to make sure that's not the problem here.
If you're just trying to programmatically add annotations via our framework, check out this guide article instead.

UIDocumentInteractionController presentOptionsMenuFromBarButtonItem error in ios8- Unknown activity items supplied

UIDocumentInteractionController presentOptionsMenuFromBarButtonItem gives me a console error in ios8 hardware (and not on 7.1 hardware or earlier):
Unknown activity items supplied: (
{
"com.adobe.pdf" = ;
},
""
)
In my official App Store version of my app, the app crashes at this point. When I compile and run on my iPad it just gives the error but does not crash.
My code:
In the .h:
UIDocumentInteractionController *docInteractionController;
In the .m:
self.docInteractionController = [UIDocumentInteractionController interactionControllerWithURL:fileURL];
self.docInteractionController.delegate = self;
//UIBarButtonItem *element is an element in my toolbar
[self.docInteractionController presentOptionsMenuFromBarButtonItem:element animated:YES];
If I do a NSLog of docInteractionController.UTI I see "com.adobe.pdf" at the console, so the UTI is being recognized properly.
I can get around the "Unknown activity items" by using presentOpenInMenuFromBarButtonItem instead of presentOptionsMenuFromBarButtonItem for the UIDocumentInteractionController call, but I want to show the user the print and email options as well, not only the external app opening options.
Tested on iPad version 8.0.2. Xcode version 6.0.1, deployment target 6.0 (also tested with deployment target 8.0). All objective-c. Running on iPad version 7.1 does not produce the error.
See radar: http://openradar.appspot.com/radar?id=5800473659441152
As noted you can use presentOpenInMenu instead of presentOptionsMenu. You will loose the mail option but you can do it yourself with MFMailComposeViewController with a dedicated mail button.
Or use UIActivityViewController with an "Open In" activity item.
Or just a UIActivityViewController without an "Open In" activity item if that is enough
Or do presentOptionsMenu on iOS7 runtime and UIActivityViewController on iOS8+ runtime (where share extensions exist)
For people not wanting to use UIActivityViewController because the document controller is what we want (all actions show up): you can get around the crash by retaining the UIDocumentInteractionController, e.g. by assigning it to a property and releasing when the document interaction finishes:
- (void)share:(id)sender
{
self.documentInteraction = [UIDocumentInteractionController interactionControllerWithURL:_shareURL];
_documentInteraction.delegate = self;
_documentInteraction.name = self.title;
[_documentInteraction presentOptionsMenuFromBarButtonItem:_actionItem animated:YES];
}
- (void)documentInteractionControllerDidDismissOptionsMenu:(UIDocumentInteractionController *)controller
{
if (controller == _documentInteraction) {
self.documentInteraction = nil;
}
}
The log will still show up, at least in debug, haven't checked with a release build. But it all works.
This solved the problem for me:
dispatch_async(dispatch_get_main_queue(), ^() {
[_docController presentOptionsMenuFromRect:button.bounds inView:button animated:YES];
});
I was getting the same console logs, but only in debug builds. Try creating a release build and you should see it still prints the "Unknown activity items supplied" error, but without the entire contents of the file.

CrashReporter symbolication client side in ios

i'm new of using PLCrashReport and i whant to make symbolication client side. I khnow that there is many disadvantages but i want to try it, can you help me please.
I used the last version of CrashReporter and this what i done in the appDelegate class refering to this example http://plcrashreporter.googlecode.com/svn/tags/plcrashreporter-1.1-rc1/Documentation/API/example_usage_iphone.html.
The is a topic that talk about this here
PLCrashReporter - How to symbolicate crash data in-process?
Link to the library:
https://www.plcrashreporter.org/.
(void) applicationDidFinishLaunching: (UIApplication *) application {
PLCrashReporter *crashReporter = [PLCrashReporter sharedReporter];
NSError *error;
if ([crashReporter hasPendingCrashReport])
[self handleCrashReport];
if (![crashReporter enableCrashReporterAndReturnError: &error])
NSLog(#"Warning: Could not enable crash reporter: %#", error);
You are linking to an old repository and documentation. The website of PLCrashReporter is https://www.plcrashreporter.org/ and the documentation is https://www.plcrashreporter.org/documentation/api/v1.2/
To enable client side symbolication you need to initialize it with a configuration like this:
PLCrashReporterSignalHandlerType signalHandlerType = PLCrashReporterSignalHandlerTypeBSD;
PLCrashReporterSymbolicationStrategy symbolicationStrategy = PLCrashReporterSymbolicationStrategyNone;
PLCrashReporterConfig *config = [[PLCrashReporterConfig alloc] initWithSignalHandlerType: signalHandlerType
symbolicationStrategy: symbolicationStrategy];
PLCrashReporter *crashReporter = [[PLCrashReporter alloc] initWithConfiguration: config];
This is based on the latest version 1.2 available on the download page: https://www.plcrashreporter.org/download
But you are right, you should not do this:
It is slow, caused the device to lock up when the crash happens for a few seconds
It requires your app to include symbols which increased the app size by 30-50% (on average)
You won't get line number information for your code.
You should instead symbolicate the crash reports using the dSYM, e.g. on your Mac.

facebook ios sdk log : strange message

I've got a button to share an image and every times I click it, I've got this message in the log, I dont understand :
2012-08-12 19:21:30.511 AvisOcean[2239:707] An instance 0xe6b8fe0 of class FBSessionManualTokenCachingStrategy was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info:
(
Context: 0xa5e90, Property: 0x245310>
Context: 0xa5e90, Property: 0x28c400>
)
Any ideas?
The Facebook SDK is leaking observers. I am using SDK v3.1.
This shouldn't be an issue if you are using the SDK without the deprecated headers (ie Facebook.h). But to use native dialogs you need to include the deprecated headers (source: https://developers.facebook.com/docs/howtos/feed-dialog-using-ios-sdk/) which leads to this error when closing/cleaning the active session.
Here is a pull request to fix it: https://github.com/facebook/facebook-ios-sdk/pull/474
You can then rebuild the SDK using Facebook SDK for iOS6/Xcode 4.5 not working
I was having the same problem. I think what had happend is I had initialized Facebook else where and it was giving me errors when I tried to re-initialize it and again invoke a dialog delegate from a different instance.
The instance where i was keeping actual app initialization and accesstoken were different from the one which was invoking the dialog. When I corrected that after going over the documentation, it was solved.
if (nil == self.facebook) {
self.facebook = [[Facebook alloc]
initWithAppId:FBSession.activeSession.appID
andDelegate:nil];
// Store the Facebook session information
self.facebook.accessToken = FBSession.activeSession.accessToken;
self.facebook.expirationDate = FBSession.activeSession.expirationDate;
}
[self.facebook dialog:#"feed" andParams:params andDelegate:self];
Do a quick logout prior to assigning accessToken and expirationDate, that will help clean up some nasty error that you had seen. I'm sure this is just a temporary solution for those using deprecated Facebook headers.
// Initiate a Facebook instance
if(!_facebook)
_facebook = [[Facebook alloc] initWithAppId:FBSession.activeSession.appID andDelegate:nil];
// Store the Facebook session information
[_facebook logout];
_facebook.accessToken = FBSession.activeSession.accessToken;
_facebook.expirationDate = FBSession.activeSession.expirationDate;
I see this message when my Facebook object is dealloc'ed. I'm using the 3.0.8 SDK. In my case I'm thinking that the Facebook object should remove itself as an observer of its tokenCaching before releasing it in its dealloc. Your case might be different since it doesn't sound like you'd be clearing the FB object. Perhaps the suggestions here would help.

Resources