tigase / beagle-im

(M) XMPP client for macOS based on TigaseSwift XMPP library
GNU General Public License v3.0
182 stars 21 forks source link

Beagle IM crashes on launch when not in Applications folder (was: Cannot open Xcode project on Mojave) #45

Closed sideeffect42 closed 3 years ago

sideeffect42 commented 4 years ago

Describe the bug I cannot open the Xcode project in the master branch with Xcode 11.3 on macOS Mojave.

To Reproduce Steps to reproduce the behavior:

  1. Check out master branch.
  2. Double click on BeagleIM.xcodeproj
  3. Get error message:

    The project at '/Users/user/Development/beagle-im/BeagleIM.xcodeproj' cannot be opened because it is in a future Xcode project file format. Adjust the project format using a compatible version of Xcode to allow it to be opened by this version of Xcode.

Expected behavior Xcode opens the project.

Desktop:

Additional context Xcode 11.3 is the last version available for Mojave.

PS: I don't think the BeagleIM.xcodeproj/xcuserdata folder should be checked in to Git.

hantu85 commented 4 years ago

We are using current version of macOS (Catalina) for development and current version of XCode for this OS is 11.6. We do not manually change project format, it was update by XCode and we decided to keep it updated. Due to that it may not be possible to use older XCode versions to build BeagleIM.

sideeffect42 commented 4 years ago

Changing the compatibility level would be one click in Xcode.

It would be very useful to me if I could build Beagle IM on my local system and thus test beta versions. I cannot currently update to 10.15 because I rely on 32-bit software that I could not yet replace.

hantu85 commented 4 years ago

You can test beta versions without building them. We provide those beta versions using Homebrew (https://github.com/tigase/homebrew-tigase) or you can download them directly from GitHub releases (https://github.com/tigase/beagle-im/releases)

sideeffect42 commented 4 years ago

I tried the last release from GitHub releases (since I use MacPorts and not homebrew). It crashes when I try to launch it:

Exception Name: NSInternalInconsistencyException
Description: Invalid parameter not satisfying: bundleProxy != nil
User Info: (null)

0   CoreFoundation                      0x00007fff3379e9ad __exceptionPreprocess + 256
1   libobjc.A.dylib                     0x00007fff5debca17 objc_exception_throw + 48
2   CoreFoundation                      0x00007fff337b96ca +[NSException raise:format:arguments:] + 98
3   Foundation                          0x00007fff35a5b741 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
4   UserNotifications                   0x00007fff3f592328 -[UNUserNotificationCenter initWithBundleProxy:] + 292
5   UserNotifications                   0x00007fff3f592103 __53+[UNUserNotificationCenter currentNotificationCenter]_block_invoke + 81
6   libdispatch.dylib                   0x00007fff5f63e63d _dispatch_client_callout + 8
7   libdispatch.dylib                   0x00007fff5f63fd4b _dispatch_once_callout + 20
8   UserNotifications                   0x00007fff3f5920af +[UNUserNotificationCenter currentNotificationCenter] + 45
9   BeagleIM                            0x000000010e54646c BeagleIM + 1750124
10  BeagleIM                            0x000000010e54a4cd BeagleIM + 1766605
11  CoreFoundation                      0x00007fff3374b226 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
12  CoreFoundation                      0x00007fff3374b1a0 ___CFXRegistrationPost_block_invoke + 63
13  CoreFoundation                      0x00007fff3374b10a _CFXRegistrationPost + 404
14  CoreFoundation                      0x00007fff337535b8 ___CFXNotificationPost_block_invoke + 87
15  CoreFoundation                      0x00007fff336bbf44 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1642
16  CoreFoundation                      0x00007fff336bb2f7 _CFXNotificationPost + 732
17  Foundation                          0x00007fff35943a5b -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
18  AppKit                              0x00007fff30ce3fa4 -[NSApplication _postDidFinishNotification] + 312
19  AppKit                              0x00007fff30ce38f7 -[NSApplication _sendFinishLaunchingNotification] + 208
20  AppKit                              0x00007fff30ce1a4b -[NSApplication(NSAppleEventHandling) _handleAEOpenEvent:] + 552
21  AppKit                              0x00007fff30ce169b -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 688
22  Foundation                          0x00007fff3598d6b0 -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 286
23  Foundation                          0x00007fff3598d52d _NSAppleEventManagerGenericHandler + 102
24  AE                                  0x00007fff3490e397 _Z20aeDispatchAppleEventPK6AEDescPS_jPh + 1815
25  AE                                  0x00007fff3490dc29 _ZL25dispatchEventAndSendReplyPK6AEDescPS_ + 41
26  AE                                  0x00007fff3490db01 aeProcessAppleEvent + 414
27  HIToolbox                           0x00007fff3294f8b7 AEProcessAppleEvent + 54
28  AppKit                              0x00007fff30cdda9d _DPSNextEvent + 1935
29  AppKit                              0x00007fff30cdc46b -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1361
30  AppKit                              0x00007fff30cd6588 -[NSApplication run] + 699
31  AppKit                              0x00007fff30cc5ac8 NSApplicationMain + 777
32  BeagleIM                            0x000000010e39d1e9 BeagleIM + 8681
33  libdyld.dylib                       0x00007fff5f68b3d5 start + 1

Even though I don't speak Swift, I would try to debug it if I could build the project.
Do you have any idea what's causing this?

hantu85 commented 4 years ago

Could you paste full stacktrace? (there is a missing part, ie. header) which is required for analysis.

sideeffect42 commented 4 years ago

Sure, thanks for having a look at it: BeagleIM_2020-08-18-120552.crash.txt

hantu85 commented 4 years ago

I was able to pinpoint the crash to the following line:

UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { (result, error) in
    print("could not get authorization for notifications", result, error as Any);
}

This code is used for macOS 10.14 or newer (so 10.15 is using it without any issues as well).

It looks like there is an issue with initiation of UNUserNotificationCenter which is done in the call to current() function. An error is thrown in the UNUserNotificationCenter class which is delivered by Apple as part of the macOS SDK and I'm using it with this calls for quite some time (even when I've had 10.14 installed).

The question is, why it falls in your cases. I cannot tell from the crash log as the only details about issues similar to this one are for iOS and calling this method from a framework (which I'm not doing in this case).

You have BeagleIM 4.0b97 while we have released a b99 a few days ago, which may (may not) fix the issue.

hantu85 commented 4 years ago

I do recall having some issues (some time ago) with running BeagleIM when it was not inside Applications directory - the issue started to appear some time ago and then it was gone..

sideeffect42 commented 4 years ago

Oh, that's interesting. Maybe I can add some sample points to this.

I initially downloaded 3.7.1 from GitHub yesterday, unpacked and tried to launch it. It crashed, too.
So I concluded that maybe the GitHub builds were broken (not signed or whatever) and so I downloaded it from the Mac App Store. It started from there (but it was also installed in the Applications folder).
After it launched, it tried to read the XMPP Password that Psi+ has put there from the keychain and after getting authorized it automatically configured the XMPP account.

Now it gets interesting: after launching the version downloaded from MAS, the version in my Downloads folder started, too.

Then I downloaded 4.0b99 which crashed again. So I tried b97 with the same result (that's why you received the crash report from b97.)

After moving the beta to the Applications folder, it starts, too.

This code is used for macOS 10.14 or newer (so 10.15 is using it without any issues as well).

Are older versions of macOS supported by Beagle?

hantu85 commented 4 years ago

After moving the beta to the Applications folder, it starts, too.

It looks like a macOS 10.14 issue with not being able to start BeagleIM from other directory than Application.

Are older versions of macOS supported by Beagle?

They were supported at some point and code with some support is still there but it is not used anymore and lowest supported version is 10.14