I'm converting the obj-c framework to the Swift one.
I need to convert this line:
__attribute__((weak)) extern NSString *sdkVersion = 0;
to Swift similar one. Spend a lot of time on google, but didn't find the answer.
Predicting your questions, what I'm trying to achieve... in short words, this global variable is defined in an optional framework. My Swift function should print this version in case if our SDK is linked with that framework.
I know, I can create a wrapper (another objc framework), add necessary getters there, and then link it with the main framework. But may be there is a more simple solution?
Thanks in advance.
First coding question ever!
So I'm totally new at coding and I'm taking a course in Lynda.com
The course is for swift 4 but there are certain commands that are not working or I have to write it different in order for it to work.
For example
Course says: activeQuest.sorted() Does not work
activeQuest.sort() Does work
Course says: activeQuest.intersection(completedQuests) Does not work
activeQuest.intersect(completedQuests) Does work
.symmetricDifference does not work and couldn't find any other way to write it
Why is this? Thank you!
Why is this?
It’s because the course is for Swift 4 but you are using an earlier version of Swift.
I am learning Swift by myself on MacOS. When following the tutorial and practicing the array function: <array_name>.sort(), I can get it executed but I always wonder how it works and what is the actual algorithm inside it.
So is there any way to check the certain function definitions?
If you want to check the declaration of the function/class, you can command-click on it. If you want the documentation, you can either option-click it or check it on the API reference page. If you want to see the implementation details of the Swift standard library, check the source code here at GitHub. If the implementation you are checking is in a non open-source APIs though, you can't quite check it.
I was wondering if you can write inline assembly in Swift.
I know that in Objective-C you could use something like this:
inline void assemblyFunc() {
__asm__(/*Assembly*/);
}
But in Swift it seems that you can't use __asm__(/*Assembly*/).
Does anyone know how to use __asm__() if its even possible.
I haven't found anything about it, so I thought it would be a good question to ask.
There isn't a way in Swift itself. If you need this, probably a good opportunity to take advantage of Swift-ObjC interop.
To expand on what Robert Levy said, you can just use the Swift/Obj-C interop feature, and write an Obj-C class that does the ASM stuff, which you can then call from Swift.
It's an annoying workaround, but it should work nonetheless.
You can read more about how to do it [here]
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am new to this technology.
I am getting following warning while uploading application from Application Loaded.
Warning says "The app references non-public selectors in "App Name" instance, viewController"
Please help me solve this warning.
Thanks in advance!
EDIT
Image :-
EDIT :-
Will my application get approve?
Use App Scanner. It analyzes your .app file for private API method usage.
It will catch methods that have been named the same as a private API method, even if it has it's own implementation. Also, it'll catch #selectors inside methods (just like the official iOS automated checker).
App Scanner doesn't catch the case when performSelector: is called with a selector that is a private method. However, Apple's tools do catch that case.
Another Alternative APP Kit, though I haven't used it. Give it a try.
Check out this Q&A, if you haven't. How does Apple know you are using private API?. Looks Helpful.
What was the last thing you added to the code before you got this error? The error means you have a private API call, as my link above notes.
If you dont think it was your code, then it might be any of the included code.
#iPhoneDev: i guess your application will not be rejected due to this reason. Because i have faced this warning in one of my app, and it was accepted successfully. So no need to worry
I think you might have a function named instance somewhere in your code, such as:
+(id)instance{
return something;
}
.. maybe a singleton implementation? If this is the case, just rename it.
I've seen apps approved despite the fact that they triggered similar alarms, but why would you want to risk a rejection?
Search for viewController in your entire project and search if there is any singleton implementation.
Even if Apple approve you application, its not good to have non-public sectors in your application.
You can also use App Scanner
Hope it helps you
Almost certainly get rejected for this.
Just a guess, but search for "viewController" and see if you are referencing a private instance method, or perhaps a private instance variable via dot notation: .viewController
No, your app will be rejected like this. Definitely. Apple review team uses the same checks as Xcode plus a few more.