Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localization update #40

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

Nomad00
Copy link

@Nomad00 Nomad00 commented Aug 26, 2019

Observed when using DMPasscode on a device with Face ID configured, the key was being returned from the custom NSLocalizedString macro (instead of the localized string). This was causing a Non-empty localizedReason must be provided error to be thrown. The remedy for this is found in the 3rd commit below; the first 2 clean things up.

localization-update - Project settings modernization.

  • Update iOS Deployment Target to iOS 8 (Minimum supported by Xcode 10).
  • Apply recommended settings for the DMPasscode & Pods project.
  • Enable Base Internationalization.
  • Migrate “English.lproj” (Deprecated).
  • Remove :exclusive => true from Podfile, as it is an unsupported option.
  • Add platform :ios, ‘8.0’ to Podfile to resolve CocoaPods warning.
  • Update podspec to version 2.1.0.
  • Run pod install from Example directory.

localization-update - Implicit self warning resolutions.

  • Add self -> in a number of places to resolve warnings.

localization-update - Resolve NSLocalizedString macro collision.

  • Remove NSLocalizedString macro, as it was causing issues when leveraged from Swift code.
  • Refactor calls to above macro to instead use NSLocalizedStringFromTableInBundle directly.
  • Add NSFaceIDUsageDescription to example app Info.plist.
  • Closes App is crashing #39
  • Closes would you mind to support Face ID? #38

Mike Stanziano added 3 commits August 26, 2019 14:37
- Update iOS Deployment Target to iOS 8 (Minimum supported by Xcode 10).
- Apply recommended settings for the `DMPasscode` & `Pods` project.
- Enable `Base Internationalization`.
- Migrate “English.lproj” (Deprecated).
- Remove `:exclusive => true` from `Podfile`, as it is an unsupported option.
- Add `platform :ios, ‘8.0’` to `Podfile` to resolve CocoaPods warning.
- Update `podspec` to version `2.1.0`.
- Run `pod install` from `Example` directory.
- Add `self ->` in a number of places to resolve warnings.
- Remove `NSLocalizedString` macro, as it was causing issues when leveraged from Swift code.
- Refactor calls to above macro to instead use `NSLocalizedStringFromTableInBundle` directly.
- Add `NSFaceIDUsageDescription` to example app `Info.plist`.
- Closes D-32#39
- Closes D-32#38
@@ -90,7 +86,8 @@ - (void)showPasscodeInViewController:(UIViewController *)viewController completi
_completion = completion;
LAContext* context = [[LAContext alloc] init];
if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:nil]) {
[context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:NSLocalizedString(@"dmpasscode_touchid_reason", nil) reply:^(BOOL success, NSError* error) {
NSBundle *bundle = [NSBundle bundleWithPath:[[NSBundle bundleForClass: [DMPasscode class]] pathForResource:@"DMPasscode" ofType:@"bundle"]];
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not of fan of getting the NSBundle this way, however when I attempted to get it the more clear(?) way, (NSBundle *bundle = [NSBundle bundleForClass: [DMPasscode class]];), the localized string lookup did not work.
This approach was found over on Medium.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

App is crashing would you mind to support Face ID?
1 participant