The first time I run my Sticker Pack extension on a simulator, I get the following crash:
2017-10-25 14:56:10.513268-0700 MobileSMS[94610:5136614] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘attempt to scroll to invalid index path: <NSIndexPath: 0x60c00023b820> {length = 2, path = 0 - 9223372036854775807}’
I didn't see an answer for this on StackOverflow, so I'm posting this question and will answer it below. Let me know if this is incorrect!
The simulator is actually trying to scroll to the sticker pack app icon and press it. For some reason, the simulator doesn't automatically enable your sticker pack, so there isn't an icon to press.
To enable your sticker pack:
On simulator, open message thread.
Tap the ellipsis (three dot) button at bottom.
Tap edit at top-right, then enable your app.
Re-run your app and it will work! I wrote a blog post about this fix. The post is essentially the same content I've posted here.
Related
I have created a series of UI Tests that run fine on a device but when using a Simulator, I cannot tap alert view buttons.
let alert = app.alerts["Continue"]
alert.buttons["Yes"].tap()
Instead, it crashes with
Find: Descendants matching type Button
t = 10.17s Find: Elements matching predicate '"Yes" IN identifiers'
t = 10.18s Check for interrupting elements affecting "Yes" Button
t = 10.19s Requesting snapshot of accessibility hierarchy for app with pid 14120
t = 10.21s Find: Descendants matching predicate identifier == "NotificationShortLookView" OR elementType == 7
*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil (NSInvalidArgumentException)
I believe (and hope) this is an Xcode 13 bug and may be fixed in an update soon.
Does any one know a way around this?
Turns out this is only an issue when running on an iOS 12 simulator. It is ok when running on an iOS 15.4 simulator.
Before it worked, when I made the update iOS 13 and updated xCode to 11, I am not able to use the side bar. The application is using the pod SideMenuController and when I click on the icon of side menu to show it, it crashes and shows me this message:
Assertion failure in -[UIApplication _createStatusBarWithRequestedStyle:orientation:hidden:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKitCore/UIKit-3899.22.15/UIApplication.m:5311
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'App called -statusBar or -statusBarWindow on UIApplication: this code must be changed as there's no longer a status bar or status bar window. Use the statusBarManager object on the window scene instead.'
I will answer why didn't I show the code, because I didn't made it, the engineer that was before me made it with a pod named SideMenuController. So I'm not familiar with the project or the code inside. I did a lot of research and I fixed it and I wanted to share the solution with you. ( PS: I don't know how it worked ) in the description of the pod, I needed to comment this line:
SideMenuController.preferences.animating.transitionAnimator = FadeAnimator.self
and another line to change from :
SideMenuController.preferences.animating.statusBarBehaviour = .horizontalPan
To this line :
SideMenuController.preferences.animating.statusBarBehaviour = .showUnderlay
And it worked like magic, Thank you guys
My app throws the following exception error after I press a UIButton which changes from a 'play' image to a 'pause' image. It doesn't always happen immediately, sometimes it happens when I pop to my root viewcontroller.
Note: It only happens in iOS 9.x, while in iOS 10.x works perfectly
After hours of experimenting and searching, I discovered that the error was produced, because I was using vector pdf images in my project for that specific UIButton. As soon as I replaced them with their equivalent png files, the exception stopped occurring.
(Note: if someone finds out why this happens please post it)
I am trying to create the same effect that is in the Notification Centre using the following line but I keep getting an error:
UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:[UIVibrancyEffect notificationCenterVibrancyEffect]];
The Error:
2014-12-02 16:30:35.597 Trial[11543:1628621] +[UIVibrancyEffect notificationCenterVibrancyEffect]: unrecognized selector sent to class 0x10569ebe0
2014-12-02 16:30:35.602 Trial[11543:1628621] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[UIVibrancyEffect notificationCenterVibrancyEffect]: unrecognized selector sent to class 0x10569ebe0'
I have imported Notification Center Header Files, but nothing seems to solve this problem at run time:
#import <NotificationCenter/NotificationCenter.h>
Make sure you linked the NotificationCenter framework under Build Phases. To add the framework click on your project until you see the screen where you set the iOS deployment target. Once you see that screen click on the first option under targets, and you should see a screen with your app's identifier. From there click on "Build Phases" and you should see a pop down view called "Link Binary With Libraries". One you click on the pop down view, click the "+" where a search bar will popup and enter NotificationCenter. You should see the framework as an option and click on the framework so it can be added.
Happy iPhone Day everyone! I hope everyone managed to get their hands on one.
I have a strange issue. In my code, I have a UITableView and if the user selects the Email icon in the UINavigationBar, it does two things:
1) Opens up the MFMailComposer
2) Creates a PDF in the background of the contents of the UITableView and attaches it to the email
This has so far been working very well in iOS 7. With iOS 8, if I set an exception breakpoint in my code and run it on an iOS 8 device, it will crash when I click the email icon (iPhone 5s), pointing to the code below:
[strheader drawWithRect:CGRectMake(65, -670, 1024, 100) options:NSStringDrawingUsesLineFragmentOrigin attributes:#{NSFontAttributeName:headerFont} context:nil];
It doesn't let me jump in or out of this breakpoint or do anything to find out what's going on. If I remove the Exception breakpoint, there's no crash. If I run the app on my device and disconnect the device from Xcode, run it again, there's no crash.
So ultimately, there's no crash when running my app, but it makes me extremely nervous that with an exception breakpoint, it crashes at that code above which means something isn't right somewhere.
There are no warnings in my code. The method that does the saving of the PDF to the email (which contains that code) is extremely long; if it's required, I'll paste it here but I don't want to make this question longer than it needs to be.
If I remove the exception breakpoint from that line and just set a regular breakpoint, as expected, it stops at that point. I run through and there are no errors at all. If I run through the whole breakpoint, it does what it needs to and then shows the MFMailComposer in the App. So it's not actually "crashing", but the exception breakpoint clearly has a problem with it.
How can I find out WHY it's crashing? More importantly, how can I fix it? (which will probably only be answerable after the first question gets answered).