I'm trying to learn how to do bluetooth streaming on the iOS. In the sample code mentioned in Technical Q&A QA1753 there is a reference to another sample code called SRVResolver:
If you want the callbacks to run on a specific run loop, you can use DNSServiceRefSockFD to get the DNS-SD socket, wrap that in a CFSocket, and then schedule the CFSocket on the run loop. The SRVResolver sample code shows an example of this.
http://developer.apple.com/library/mac/#samplecode/SRVResolver/
However that link no longer exists on the apple dev site.. and I couldn't find an example of it any where else on the web.. can anyone direct me to where I can find it?
SRVResolver does not seem to exist in OS X 10.8 docset. It can be found in 10.6 and 10.7 docsets.
In 10.8, there's the DNSSDObjects example, which looks similar, but I didn't look exactly at what it does. QA1753 was updated to refer to this new sample.
Googling for SRVResolver filetype:m did not produce any results, but older docsets should still be available for download from within Xcode's Preferences.
Related
When we take a screen capture of a mobile device using the Appium app, We get a screenshot image file and a .uix file. Which can be viewed in the Appium software. I'm running an automation test and am currently taking the screenshot on failure, to know where the test fails. But sometimes the elements seem to be present in the screenshot. So it wud be helpful if I could get the .uix file too by using some API. So that I can view them in the Appium software to know what failure has exactly happened.
I found a discussion thread here which does exactly what you need. Check it out and give it a try and let us know here if that approach works.
While I'm exploring Playground Book sample code, like this one, I find it to be very tedious to get the code to run because of Playground Book's limitations in where the code can run: only on iPad's Swift Playground.
There is no way to debug the "Sources" / Auxiliary code in iOS's Swift Playground, since all the source files are shown in un-editable plain text. You have to open the source files in Xcode to edit them, but then you can't compile or run them!
This is especially tedious for the sample code above, which uses PlaygroundValue, a persistence API that requires Playground Book format, so I still couldn't get the code to run by separating all source code into a separate Playground file to run on the Mac.
Since the sample code above is outdated, I find it to be near impossible to debug it right and get the code to run. You'd have to:
Deploy the code on iPad. Run the Book.
See many error messages on iPad.
Go back to Xcode on Mac and debug them one by one, manually.
Deploy the code on iPad again to run. Repeat the process.
Even after all the errors are resolved, you can still be faced with cryptic "Problem Running Playground" without any further concrete explanation.
What's your workflow to productively debug and deploy code with Playground Book? Current workflow seems impractical to me I think there must be a better way, but I'm not familiar enough with Playground Book and my online research doesn't yield any reasonable workarounds.
From a bug report / suggestion I sent to Apple, I got the following reply:
We’ve actually built tools to help debug the auxilliary sources and we did a presentation at WWDC 2018 that demonstrates it. Please view the presentation and get access to the tools here: https://developer.apple.com/videos/play/wwdc2018/413/
Upon further research, I found that they have recently released a Playgrounds Author Template:
The Swift Playgrounds Author Template is a starter Xcode project that will help you create, debug, and produce a Playground book. Using the template you can step through the code for your live view as if it were an app so that you can identify bugs more easily and develop an efficient workflow for developing your Playground books.
This template, requiring Swift 4.1 to run, includes three different targets:
PlaygroundBook
Book_Sources
LiveViewTestApp
You can use the LiveViewTestApp to fully debug your Playground Book right on your Mac with Xcode.
I am not aware of any possibility that does not require you to test the Playground on an actual iPad.
Anyway, you can make developing Swift Playgrounds less tedious by
Using iCloud to synchronize your mac version with the iPad.
Embedding your Playground in an Xcode project as described in one of my previous answers. That way, you can at least achieve autocompletion during development.
Linking your source files to another target, so that compile errors can be caught before running the Playground.
Anyway, you will still encounter mysterious "Problem Running Playground" errors from time to time
Do anyone know how to enable code completion and quick documentation in AppCode(3.1.1) for swift?
I have updated Xcode I've downloaded documentation in Xcode preferences.
I set correct path to Xcode in my AppCode but still I got no support in AppCode regarding to completion and quick documentation.
This support is in XCode but I am java dev so for me better thing is to use Jetbrains tool instead of using Apple one.
Project that I've opened in AppCode was created in XCode.
I've downloaded this documentation in XCode.
I've searched a lot in the net but there are only slogans about features of AppCode
can do that this, is doing this and that
Only one thing related to path to XCode I found in this property
but none of those I can see... I believe that I haven't enabled it yet.
For me AppCode is more user friently tool because like I said I am used to Intellij for Java development and I am trying to use this tool because it is quicker for me to work with sth that I've used to than sth that is completly new for me(conceptually - XCode).
Do you have any advices about that?
I asked my quesetion to AppCode support. They responded:
Rafal, Your configuration seems correct. Please see comments
below: 1) regarding code completion in Swift - we have part of work
done in that area, and part of tasks still in progress. Can you share
a code snippet where you experience issues with completion? 2)
regarding quick documentation - this feature is not yet ready for
Swift. You can track its progress here.
This mean that I can not expect from AppCode features that was advertised in terms of swift language.
I downloaded this project to give it a try (http://www.hatzlaha.co.il/150842/Lucas-Kanade-Detection-for-the-iPhone). It also has a released version on AppStore.
When I downloaded the source and compiled, it gave compilation errors. I changed the compiler to LLVM GCC and it instantly compiled without any errors or warnings.
Further here is what I did:
Downloaded the app Lucas Kanade on personal iPhone. Runs as expected (ie. shows tracked points and video output).
Deployed the above compiled app on company iPad. Here is shows the tracked points (which means the application is getting the video frames) but not able to display the video output.
General app flow:
Grab a frame from the camera.
Process the frame (track points).
Output the frame, so the screen looks like its showing the camera feed, as expected.
Device details:
iPhone: OS 5.1.1 (9B206); iPhone 4;
iPad: OS 5.1 (9B176); iPad 2;
Questions
Is the video output problem occurring because of the different in OS versions or because of the GCC compiler being used?
If it is the compiler problem, would be be appropriate to put the compile errors here for resolution or do I need to start a separate Question?
I know this info might not be enough since there are a lot of unknowns, but trust me, getting into the details of the app would be a really exhaustive problem description. Let me know what more info is needed to guess the solution. I'll update it here.
Like you already said the info is not enough. I can just guess. The projects for tracking points uses generally their own driver for camera access. The reason, why it does not work with llvm compiler, might be that.
Just look in the project if you find any file specific to iPhone. They are mostly dat files. And maybe you find some preprocessor macros in the project like #ifdef target_iphone something like that. In that case you can contact the producer and request the driver for iPad.
I did not download and tried the project, but it is just a guess.
I've developed and application for iPhone. It works fine on os4 but it does not work on os3.1. In fact works but there are some problems; after splash screen a what screen appears. while I leaving the application I can see the application is opened successfully but just see while exiting.
So I wonder if there is a tool which says which apis have problems with os3.1? So I have a chance to replace them.
If you want to check a specific API, just run this in your code somewhere with an appropriate response. For example, to see if print is supported, run this...
if (NSClassFromString(#"UIPrintInfo")) {
}
Set your project's Base SDK to iphone-os-3-1, then build. All the error messages about classes, methods, and functions that don't exist must designate things added since iphone-os-3-1, since your project built and linked fine against the iphone-os-4-0 SDK.
If you don't have the iphone-os-3-1 SDK, try this instead:
Open your project's Build Settings.
Find the "Preprocessor Macros" setting.
Edit it and add __IPHONE_OS_VERSION_MAX_ALLOWED=30100
Now, try building. This should cause everything introduced after iOS 3.1 to be labeled unavailable, producing the same errors as if you had switched to the iphone-os-3-1 SDK.
It's a good idea to get a second installation of Xcode for this situation, in this case you need 3.2.1 with SDK 3.1.3 - I wish I could help you with a download link since it is no longer shown on Apple's page, but I have googled in the past and found direct, official download links which will work as long as you are signed in with your developer account, so good luck.
The annoying bit is that you need to go through your project files and set "Base SDK" to 3.1.3 and then back once you have completed the exercise. But it is the easiest way to flag what you can't do in 3.1.3. "sudo rm -rf" (I feel nervous even typing that) has an excellent method there but you need to have an inkling of what might be safe and what might not before you implement it or else you end up with code 10x the size it needs to be.
Apple really needs to sort out this issue - hopefully by flagging methods that are prior to your specified "Deployment Target", in the same way that deprecated methods are flagged.