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
sample code does not work (at least with a pod) #13
Comments
Note that while I did not put " around the ID, it still doesn't work, which is... well, damned if I can figure it out, but I started learning Swift about 3 hours ago. |
All fixed now based on the comment you left in #13. I thought I had included that piece of info, but I'm glad you got it up and running! |
Actually, it's still not working... Siren.sharedInstance works, but the compiler still claims siren.appID does not exist (along with .presentingViewController, .delegate, .debugEnabled, and even .checkVersion() |
what version of Xcode are you using? |
The latest from the app store, I hope! Version 6.2 (6C131e) |
try removing and re-adding the pod. |
To do that:
|
Exactly the same result. I also attempted a build while I had it uninstalled... same result, oddly enough. |
What version of CocoaPods do you have? |
0.36.3 |
Hmm, somehow I still have 0.36.1. Doubt that's the issue, but I'll try upgrading. However, you're saying the sample project doesn't work at all? Do you have Xcode 6.3 beta? If so, wonder if you can try it there. It works on both versions of Xcode for me (just tried it out). Also, maybe clean the DerivedData folder |
and restart xcode, after cleaning that folder Then clean, build, cross fingers :) |
Code taken from the sample project does not work. I'm not sure if the project itself works. I can install the beta, but that will take A While with my slow internet. |
Just updated Cocoapods on my end and uninstalling Siren via pods in a project of mine with the 0.36.3. then will reinstall. This will help rule out fi 0.36.3 is the culprit. |
hmm, I don't see a directory anywhere in my project called DerivedData, or anything close. Looking in a broader search. |
|
Restart xcode after doing that to flush anything else. |
That at least made it find out I did not have the pod installed. Trying now with an install. |
Same 6 errors. |
I can confirm the errors on my end. I wonder if the Cocoapods spec changed in what's needed in a |
That's possible, but it is very strange it finds the Siren class, but then instances of that class fail in some mysterious way. I'd almost blame Swift rather than Cocapods. |
Possibly. I'm experiencing this issue in Xcode 6.3b4, so that doesn't rule out Xcode, Swift, or CocoaPods. |
cc @getaaron - when you wake up, could you take a look? I'll look for a bit longer, but it's 3:30am here =p |
To replicate:
|
I'm not sure how Swift works exactly, but if it is being compiled to a .framework file, is it possible something in the Siren class needs to be marked as public? |
Believe it or not... changing the Siren.swift file to have this:
removes that one error. |
well there goes Swift's implicit referencing. I'll play around with it for a sec. |
here's the thing: the class is public already. Check line 91 |
I totally get that, and yet making the SirenDelegate protocol public, then adding 'public' in front of every non-private var or function I use makes the compiler happy. |
Might be time for a radar! Let me ping people on twitter tonight and tomorrow and see if anyone has an idea. |
It might be a different case where the source is available, vs when it is written to a framework. |
While confusing, https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/AccessControl.html seems to imply that frameworks need explicit public marking. |
It looks like, when you're building a framework, the "public class Siren" part means "make this part of the API" and the access internally is still "internal", so each entity inside that class must be marked as public or it won't make it through the framework. When it's included in the project directly, it shares the module, so the default still allows access. |
So it's only an issue because this is an external framework? That'll explain why it works if it's imported normally. Do me a favor, make a new file Add the following code in that file: #import <Foundation/Foundation.h>
FOUNDATION_EXPORT double SirenVersionNumber;
FOUNDATION_EXPORT const unsigned char SirenVersionString[]; See if that helps at all. Remove the public scoping keywords if you can as well during the test. |
(I don't think that code block will do much of anything, but I realized it's missing, and I think most Swift cocoapods have a Podname.h file to avoid certain framework issues) |
and those issues are usually with objc-swift interoperability, which this issue clearly isn't. Thinking out-loud here. Feel free to do a pull request with the added keywords, and myself and @getaaron will take a look at the issue more closely shortly before deciding what to do. Need sleep now =p |
No change when I added that file. |
I think the right answer is to just mark those fields and functions you want people to call as public, so they are reachable outside the Swift module (aka framework) |
Also marking the SirenDelegate class allows one to use it. :) I can submit a pull request tomorrow but there's no guarantee I will get all the cases right. |
Yup, I think you're right. Gonna ping cocoapods guys as well to get their thoughts. |
I think the scoping rules about modules comes into play here, and a framework is always its own module, so "internal" fails. Kinda nice really once it's understood. Night, it's 2:45am here in Central. |
3:45am here. I think you're right. Btw, that file I asked you to create already exists (apparently). Auto-generated by cocoapods. Pods > Siren > Supported Files > Pods-Siren-umbrella.h |
Pull request created. |
This is expected behaviour, see https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/AccessControl.html#//apple_ref/doc/uid/TP40014097-CH41-ID10:
Everything that is not explicitly |
@skandragon Thanks for your help! You were right on the money with the issue and the PR. Once I got some sleep and read over the access controls docs again, everything made sense. I accepted your PR and gave you credit in the README and CONTRIBUTORS files. @neonichu thanks for confirming the problem. |
The latter does not work as the compiler cannot find appID:
The text was updated successfully, but these errors were encountered: