question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AppleSettings : Unresolved reference

See original GitHub issue

Hello

I am trying to use AppleSettings constructor, but it seems to me as Unresolved reference.

 val commonMain by getting {
           dependencies {
               implementation("com.russhwolf:multiplatform-settings:0.7.1")
           }
       }

I have added its dependencies like the code above and into module shared:iosMain I try to use the following:

val delegate: NSUserDefaults // ...
val settings: Settings = AppleSettings(delegate)

However the AppleSettings constructor is not available.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
russhwolfcommented, May 15, 2021

There’s different issues being conflated here and I want to differentiate what people are asking for better.

One issue is, the library builds but there’s red code in the IDE. This is probably from using a shared iOS source-set (often, from the ios() target builder) when the library doesn’t declare the HMPP gradle properties. I’ve been wary of adding that because I don’t want to break consumers who aren’t using those flags yet, and also I’ve had build issues in the past when enabling it. It’s probably worth re-examining at some point, but it’s been a lower priority for me because it doesn’t block your build and it likely only impacts one file where you’re initializing your iOS Settings instance.

Another issue is, the project doesn’t build at all. That’s what @afaucogney seems to be reporting… That’s a bigger issue that I’d like to understand better, but I’ve never seen it in action in any of my own projects, so I could use some help here with a full project that reproduces it.

@krottv your sample appears to be only a single module from a larger project and doesn’t build on its own, so it doesn’t help me. But I’m also not clear on which of those two buckets you fall into

@cmota brings up a further confounding factor in the new M1 macs. I haven’t used one myself yet so I don’t have a good sense of how it impacts this whole story. If multiplatform-swiftpackage gives you what you need, then that sounds great. I suspect doing an ad-hoc target declaration similar to the sample project would also work, but I’m not sure that’s a solution that scales great for large multimodule projects. In any event, I don’t think there’s anything that makes sense to add at the library level to help here. Packaging is a concern that should really be handled at the application level.

0reactions
russhwolfcommented, Aug 28, 2021

You should now be able to resolve AppleSettings in the IDE in shared iOS sourcesets in version 0.8

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - Unresolved reference: Platform, in multiplatform project
I have created a kotlin shared library project (using Android Studio on Windows), the android side of things work fine, but for some...
Read more >
Creating a simple Kotlin Multiplatform project based on moko ...
settings: AppleSettings(delegate: UserDefaults.standard), antilog: DebugAntilog(defaultTag: "MPP"), baseUrl: "https://api.giphy.com/v1/",
Read more >
Unresolved reference "platform" when using the "ios" target ...
Create a new class under iosMain and attempt to reference a class in the CocoaTouch framework (such as NSString ).
Read more >
Bring Your Own iPhone | Switch to Cricket
1. Go to Settings and select General. Apple Settings · 2. Tap Software Update to see if your software is up to date....
Read more >
Reference - Resource Watch API - GitHub Pages
This section of the documentation contains technical reference information ... 404, Relationship between undefined and dataset - <dataset id> and dataset: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found