bitwarden / mobile

Retired Bitwarden mobile app for iOS and Android (MAUI/Xamarin).
https://bitwarden.com
GNU General Public License v3.0
146 stars 23 forks source link

trouble compiling for iOS #466

Closed Drb0IENO7JegIkJTGpIJYLvQrCNw3l82v2wgPnJ closed 3 years ago

Drb0IENO7JegIkJTGpIJYLvQrCNw3l82v2wgPnJ commented 5 years ago

Hi,

I've been trying to compile the iOS app using Visual Studio on a Mac Pro running mojave.

For some reason when trying to compile it always breaks with the following error:

/mobile/src/iOS.Core/Controllers/ExtendedUITableViewController.cs(7,7): Error CS0246: The type or namespace name 'XLabs' could not be found (are you missing a using directive or an assembly reference?) (CS0246) (iOS.Core)

There are 32 more error messages referencing the same problem with SQLite, Plugin and others.

In VS I right-click bitwarden-mobile-master and then Restore NuGet Packages and I don't get any errors. But as soon as I try to build the app I get the 33 errors which seem to indicate the project can't find the NuGet packages.

Any idea what I'm doing wrong?

Thanks

Drb0IENO7JegIkJTGpIJYLvQrCNw3l82v2wgPnJ commented 5 years ago

Anyone else encounter this problem?

pPmnBRRYhIemiuiy3VBYULJIzQyZaEvWMbCPH1P commented 5 years ago

Unfortunately I am not sure. Xamarin is huge pain to get up and running in the beginning.

Drb0IENO7JegIkJTGpIJYLvQrCNw3l82v2wgPnJ commented 5 years ago

Thanks @kspearrin

I'll start again today from scratch and see how it goes

Drb0IENO7JegIkJTGpIJYLvQrCNw3l82v2wgPnJ commented 5 years ago

Well I'm almost there. Solved all the issues by installing the missing nougat packages into ios core but now I'm getting one last error:

mobile/src/iOS.Core/Controllers/LoginAddViewController.cs(16,16): Error CS0023: Operator '!' cannot be applied to operand of type 'method group' (CS0023) (iOS.Core)

This is in reference to line 124 in LoginAddViewController.cs

protected async Task SaveAsync() { if(!_connectivity.IsConnected) -----line 124 { AlertNoConnection(); return; }

Drb0IENO7JegIkJTGpIJYLvQrCNw3l82v2wgPnJ commented 5 years ago

@kspearrin any clue as to why I'm getting this error?

Operator '!' cannot be applied to operand of type 'method group'

It seems the last obstacle to a successful compilation.

Thanks

pPmnBRRYhIemiuiy3VBYULJIzQyZaEvWMbCPH1P commented 5 years ago

Sorry, but I have no idea what that means.

Drb0IENO7JegIkJTGpIJYLvQrCNw3l82v2wgPnJ commented 5 years ago

Ok, I'm pretty sure the problem is one of incompatibility between different nougat packages. All other packages seem to work ok in NETFramework,Version=v4.6.1 except those listed below:

Resolving conflicts for .NETStandard,Version=v2.0... Package 'HockeySDK.Xamarin 5.1.2' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project. Package 'PCLCrypto 2.0.147' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project. Package 'PInvoke.NCrypt 0.3.2' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project. Package 'Validation 2.2.8' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project. Package 'XLabs.IoC 2.0.5782' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project. Package 'ZXing.Net.Mobile 2.1.47' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project. Package 'ZXing.Net.Mobile.Forms 2.1.47' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.

Any clue on how to resolve this error? Is it possible to force nougat to use NETStandard,Version=v2.0?

If so, where do I set those settings?

Cheers

Drb0IENO7JegIkJTGpIJYLvQrCNw3l82v2wgPnJ commented 5 years ago

Also, iOS.Core seems to be missing all its nougat packages which obviously breaks compilation. Can you tell me which ones I need to download (and versions too please)?

Cheers

Drb0IENO7JegIkJTGpIJYLvQrCNw3l82v2wgPnJ commented 5 years ago

After adding all the missing packages manually I'm right back to the "Operator '!' cannot be applied to operand of type 'method group'" error message.

No clue as to why it's so hard to compile this app for iOS. Have you been able to compile it recently?

Drb0IENO7JegIkJTGpIJYLvQrCNw3l82v2wgPnJ commented 5 years ago

I've playing with this some more and I'm almost there. I now get the app to compile OK except it fails to get deployed because of certificates/entitlements.

ApplicationVerificationFailed: Failed to verify code signature of /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.7GYESw/extracted/BitwardeniOS.app/PlugIns/BitwardeniOSExtension.appex : 0xe8008016 (The executable was signed with invalid entitlements.) error MT1006: Could not install the application 'mobile/src/iOS/bin/iPhone/Debug/BitwardeniOS.app' on the device 'xr': Your code signing/provisioning profiles are not correctly configured. Probably you have an entitlement not supported by your current provisioning profile, or your device is not part of the current provisioning profile. Please check the iOS Device Log for details (error: 0xe8008016).

I know Xamarin/VS is a pain to get working with these certs and after much exploration I think I know the origin of the problem.

The three projects (iOS, iOS.Autofill and iOS.Extension) all require the Keychain Sharing entitlement but I can find no fields in Apple's Developer console to enable that specific entitlement since it's simply not there. All the other entitlements I was able to add manually there without an issue.

I also tried to let VS do automatic configuration of the certs and profiles but I still get the same error message when deploying. This is not surprising since VS states that some entitlements cannot be added automatically by Xamarin/VS, namely "Push Notifications, Game Center, In-App Purchase, Maps, Keychain Sharing, Associated Domains, and Data Protection capabilities are not currently supported. To add these capabilities, use manual provisioning and follow the steps" Taken from here https://docs.microsoft.com/en-us/xamarin/ios/deploy-test/provisioning/capabilities/?tabs=macos

So if VS can't add that Keychain Sharing entitlement automatically, and there's no place (that I can see and I looked everywhere) in the Apple Dev Console to add that entitlement to an App ID, I don't see how to add that entitlement which is almost certainly why my app can't be deployed even though it compiles ok.

Anyone have any clues?

tTDOaT36ZjvDSU4PZwhz4xOiRBvaY44uc0hdeWa commented 4 years ago

@pdarcos any solutions ?

EsFFw4jVumvhgkvyrpvN1rhWv0JIWwW1Va7fdrU commented 4 years ago

@pdarcos , have you popped open Xcode, ensured all necessary extensions and updates have been installed and that you have your Apple ID developer account provisioned, linked and appropriate local/test signing profile linked? You'll likely need to open a dummy Xcode iOS project in order to do so initially.

eliykat commented 3 years ago

Hi @pdarcos, it appears we've not heard from you about this issue in some time. While we are now closing this issue, if it continues to be a problem please feel free to re-open this issue and provide any further information that may be helpful in reproducing the problem or helping you further.