nstack-io / nstack-ios-sdk Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
If you call getContentResponse<T: Codable>(_ slug: String, key: String? = nil, completion: @escaping Completion<T>)
and you provide a slug
String that is not configered in the NStack console, the SDK crashes instead of returning some error.
Hi guys!
I see development of new features taking place, and the working SPM branch is lying dormant falling behind. As we are using the SDK in a government critical app I really need to know that SPM support won't be forgotten. Whether it is my SPM adaptation or something else is of no importance, but since SPM is now the official package manager of the platform, I hope support will be prioritised, such that optimisations, features and bug fixes will find their way into the SPM version as well.
Is this something we can rely on? 😬 @chriscombs @pbodsk @mariusc
Br
Jakob
Hi. I was trying to use \n in my stack localization values. However, the stack doesn't support that. Is it on purpose?
It would be nice to have a Demo project that showcased all of the features you can find in NStack.
When starting the app using the SwiftUI App
protocol, alerts presented from NStack are not displayed in app. If you initialise your app with a UIHostingController in a UIWindow, it works as expected.
Eg;
@main
struct DemoApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
// MARK: Scenes
var body: some Scene {
WindowGroup {
AppCoordinatorView(coordinator: appDelegate.coordinator)
}
}
}
Does not work
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var coordinator = AppCoordinator()
let window = UIWindow(frame: UIScreen.main.bounds)
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
coordinator.start(options: launchOptions)
let appView = AppCoordinatorView(coordinator: coordinator)
self.window.rootViewController = UIHostingController(rootView: appView)
self.window.makeKeyAndVisible()
return true
}
}
Works as expected.
I suspect its something to do with using SwiftUI instead of UIKit and UIWindow specifically but not entirely sure.
The SDK needs to implement the new version of rate reminder, where you can register user "points"
See more in the NStack docs
Got the following issue from a user:
Multiple commands produce ‘/Users/monstar/Library/Developer/Xcode/DerivedData/<redacted>.app/Frameworks/Alamofire.framework’:
1) Target ‘<redacted>‘ has copy command from ‘/Users/monstar/Desktop/<redacted>/Carthage/Build/iOS/Alamofire.framework’ to ‘/Users/monstar/Library/Developer/Xcode/DerivedData/<redacted>cgfwysyghhpbpigcaowgzymuwjnj/Build/Products/Debug-iphonesimulator/<redacted>.app/Frameworks/Alamofire.framework’
2) That command depends on command in Target ‘<redacted>‘ script phase “[CP] Embed Pods Frameworks”
I think this is because NStack and Moya both use Alamofire. How can I solve this problem?
Alamofire isn't used in NStack anymore, so we probably forgot to push to trunk the latest releases with CocoaPods
I tried to set up Nstack with cocoapods on Xcode 14.3 on the M2 apple silicon.
My cocoapods version 1.12.0
Here is how I tried to integrate in the podfile
pod 'NStackSDK', '~> 5.1.4'
I am trying to configure nstack like this below:
import NStackSDK
class NStackConfigurator: AppConfigurationProtocol {
func setup(withApplication application: UIApplication, launchOptions: [UIApplication.LaunchOptionsKey : Any]?) {
var nStackConfig = Configuration(plistName: "NStack",
environment: .production,
localizationClass: Localizations.self)
nStackConfig.updateOptions = [.onDidBecomeActive]
NStack.start(configuration: nStackConfig, launchOptions: launchOptions)
NStack.sharedInstance.localizationManager?.updateLocalizations()
}
}
But getting the following error. Please check the screenshot:
Under the above circumstances, what could be the possible way to use nstack in Xcode 14.3? I have tried with carthage but that is also not working. Please help me here.
I don't know if it is supposed to be used for translations, but if not it would be nice to add to the documentation, as I was hunting this crash for a while before it occurred to me to use the other type
So this works:
let config = NStackSDK.Configuration(appId: "xx", restAPIKey: "xx", localizationClass: Localizations.self, environment: .debug)
This crashes
let config = NStackSDK.Configuration(appId: "xx", restAPIKey: "xx", localizationClass: SKLocalizations.self, environment: .debug)
Would be great to get watchOS support for NStack. Currently, we have only one watchOS app afaik - Vitality - but more might be coming.
NStack.sharedInstance.geographyManager?.languages(completion: { languages in
print("languages - \(languages)")
})
prints this in the console
languages - failure(Swift.DecodingError.keyNotFound(CodingKeys(stringValue: "is_default", intValue: nil), Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "data", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0)], debugDescription: "No value associated with key CodingKeys(stringValue: \"is_default\", intValue: nil) (\"is_default\").", underlyingError: nil)))
Issue can be see in #81
The feedback feature needs to be implemented. The DOT project implemented it manually, but it should be added as a feature to the SDK.
Users should be able to shake the phone to display a dialogue that allows them to enter feedback, which is then sent to the backend.
We should be able to disable this after the first prompt, in case the user doesn't want to send feedback.
Format:
SDK-Version: ios-3.0.0
If a key contains a space at the beginning of it key
, this space won't be removed when generating the coding keys, causing the app to fail to compile
public override subscript(key: String) -> String? {
switch key {
case CodingKeys. key.stringValue: return value
}
}
Hi!
Localization on neither my iOS nor Android app updates in the production environment. We need to compile the apps for being able to change the text.
Are you aware of that problem?
Thanks in advance,
Denise
Most of our projects use NStack together with its subdependency, LocalizationsManager. However, some projects need to be able to use LocalizationsManager without using NStack.
The current solution, where LocalizationsManager is a separate framework in a separate repo makes it hard to work on NStackSDK and makes it hard to support different dependency managers. According to Chris, it's kind of expected of NStack to use the same dependency manager as the projects that import NStack.
Let's see if we can have LocalizationsManager in the same repo and have the dependency managers we support for NStack (in order of desired priority: SPM, CocoaPods, Carthage) build and expose 2 frameworks from the same repo. Try and get some inspiration from Firebase, if possible
See #76
Can be reproduced from that branch in the PR. Run the app, go to Alert Types, Tap on Open URL Alert and tap the Open URL button. It will open a webpage in safari. Go back and do that again. The app will crash
2020-11-10 11:38:44.646099+0100 NStackDemo[93925:1246807] [] nw_protocol_get_quic_image_block_invoke dlopen libquic failed
Url Opened - https://www.hackingwithswift.com/
Url Opened - https://www.hackingwithswift.com/
2020-11-10 11:53:24.478593+0100 NStackDemo[93925:1246606] *** Assertion failure in -[BSServiceConnectionEndpointMonitor dealloc], BSServiceConnectionEndpointMonitor.m:58
2020-11-10 11:53:24.482040+0100 NStackDemo[93925:1246606] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'must call invalidate before dealloc'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff2043a126 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff20177f78 objc_exception_throw + 48
2 CoreFoundation 0x00007fff20439f4f +[NSException raise:format:] + 0
3 Foundation 0x00007fff207881ca -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
4 BoardServices 0x00007fff2576cb0e -[BSServiceConnectionEndpointMonitor dealloc] + 174
5 libobjc.A.dylib 0x00007fff2018f7f4 _ZN11objc_object17sidetable_releaseEbb + 174
6 UIKitCore 0x00007fff246894a0 -[UIApplication .cxx_destruct] + 60
7 libobjc.A.dylib 0x00007fff201771f0 _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class + 83
8 libobjc.A.dylib 0x00007fff20189011 objc_destructInstance + 64
9 libobjc.A.dylib 0x00007fff2018ef6c -[NSObject dealloc] + 21
10 UIKitCore 0x00007fff24694429 -[UIResponder dealloc] + 145
11 UIKit 0x0000000110b7a507 -[UIResponderAccessibility dealloc] + 55
12 UIKitCore 0x00007fff2465a075 -[UIApplication dealloc] + 330
13 UIKit 0x0000000110b2c30b -[UIApplicationAccessibility dealloc] + 206
14 libobjc.A.dylib 0x00007fff2018f7f4 _ZN11objc_object17sidetable_releaseEbb + 174
15 libsystem_blocks.dylib 0x00007fff2007f42f _Block_release + 128
16 QuartzCore 0x00007fff279c7394 _ZN2CA11Transaction19run_commit_handlersE18CATransactionPhase + 100
17 QuartzCore 0x00007fff279930dc _ZN2CA7Context18commit_transactionEPNS_11TransactionEdPd + 12884
18 QuartzCore 0x00007fff279c6e13 _ZN2CA11Transaction6commitEv + 783
19 QuartzCore 0x00007fff279c7fcf _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 79
20 CoreFoundation 0x00007fff203a76b3 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
21 CoreFoundation 0x00007fff203a1f3f __CFRunLoopDoObservers + 547
22 CoreFoundation 0x00007fff203a24e2 __CFRunLoopRun + 1113
23 CoreFoundation 0x00007fff203a1b9e CFRunLoopRunSpecific + 567
24 GraphicsServices 0x00007fff2b773db3 GSEventRunModal + 139
25 UIKitCore 0x00007fff24660af3 -[UIApplication _run] + 912
26 UIKitCore 0x00007fff24665a04 UIApplicationMain + 101
27 libswiftUIKit.dylib 0x00007fff539f37b2 $s5UIKit17UIApplicationMainys5Int32VAD_SpySpys4Int8VGGSgSSSgAJtF + 98
28 NStackDemo 0x000000010e53a30a $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ + 122
29 NStackDemo 0x000000010e53a27e $s10NStackDemo11AppDelegateC5$mainyyFZ + 46
30 NStackDemo 0x000000010e53a359 main + 41
31 libdyld.dylib 0x00007fff20257415 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'must call invalidate before dealloc'
terminating with uncaught exception of type NSException
CoreSimulator 732.17 - Device: iPhone 11 (D2040475-F00F-4C3C-AF0C-A26F6CA547BB) - Runtime: iOS 14.0 (18A372) - DeviceType: iPhone 11
On a more or less related note: why would anyone use alerts like this? Why present alerts through NStack when you can do it much easily with the UIAlertController directly. Shouldn't AlertManager be private to NStack and only used by the SDK to show app update prompts or messages?
Alerts are not displaying properly on iOS 13 (Version control for example)
HI guys,
My snapshot-tests especially but also unit tests rely somewhat on proper non-empty strings being used when running the tests targets. When the app code accesses the static tr/lo variable an empty Localizations object is returned, which causes my snapshots to render empty string and also unit tests which rely on a piece of state which uses strings from NStack, e.g. for interpolation, to fail, due to state not working as expected.
I am not sure when an empty Localizations()-object would be desirable, except if the generated object had default values corresponding to the json it was generated from.
I think we need a way to make the tr/lo variable return an object instantiated from json that we control in order for this to be fully testable. One could always wrap the tr/lo in client code to be able to return a controlled Localizations
object, but it would be nicer if this was supported out of the box.
Is something like this in the works? @chriscombs @pbodsk
Hi I know it's too early to say anything definite about how real this issue is, since it only happens in Xcode Beta, but I think it is worth it to investigate, to make sure this won't present an issue when Xcode 12.5 is released, or to already fix it now if possible. I have only tried it in the SPM-support branch, but it is likely also happening in the main branch version.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.