Qt5 MediaPlayer setMedia use http in macos - macos

i want to play a mp3 using a http url,so i found Qt5 MediaPlayer. But i get a issue,when i set player->setMedia(QUrl('http://xxx'));.
2016-01-02 01:46:02.544 myPlayer[82519:5587404] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
i found this, but i don't know how to add NSAllowsArbitraryLoads to info.plist.

You should create info.plist file for your application. Then at your .pro file add this:
QMAKE_INFO_PLIST = Info.plist
From Qt documentation:
QMAKE_INFO_PLIST
Specifies the name of the property list file, .plist, you would like
to include in your OS X and iOS application bundle.
In the .plist file, you can define some variables, e.g., #EXECUTABLE#,
which qmake will replace with the actual executable name. Other
variables include #ICON#, #TYPEINFO#, #LIBRARY#, and #SHORT_VERSION#.

Related

Can I set the name of the generated IPA file?

I have a user-defined attribute that I set for CFBundleName:
<key>CFBundleName</key>
<string>$(APP_DISPLAY_NAME)</string>
APP_DISPLAY_NAME == THIS IS MY APP <-- it is the app name that I can see on my iPhone after I installed the app,
The problem is that also the IPA file name will be THIS IS MY APP.ipa. What is the problem with all the spaces while working with this file in the pipeline?
Is there a way to version this as my_app_prod_1_2_1 or my_app_dev_1_2_1 for the name of the file produced?
In your app's Build Settings, change the PRODUCT_NAME.

Building Xcode Project Using GNUstep Makefile Does Not Open Application Window, buildtool Can't Find English.lproj

I completed the CurrencyConverter example using Xcode 2.5 on Mac OS X Tiger 10.4.11, which I called CurrencyConverter2 since it was my second attempt. Since I've read that GNUstep is compatible with the Mac OS X Tiger version of Cocoa, I wanted to try building this Xcode project in GNUstep, which I am interested in learning.
I was able to install GNUstep on a VM running FreeBSD 12.0. I created a Makefile called GNUmakefile. Here are the contents of GNUmakefile:
include $(GNUSTEP_MAKEFILES)/common.make
APP_NAME = CurrencyConverter2
CurrencyConverter2_OBJC_FILES = main.m ConverterController.m Converter.m
CurrencyConverter2_RESOURCE_FILES = Info.plist English.lproj/MainMenu.nib
include $(GNUSTEP_MAKEFILES)/application.make
When building the program using gmake, it appears that everything was built correctly:
This is gnustep-make 2.7.0. Type 'gmake print-gnustep-make-help' for help.
Running in gnustep-make version 2 strict mode.
Making all for app CurrencyConverter2...
Creating CurrencyConverter2.app/....
gmake[3]: Warning: File 'main.m' has modification time 21869 s in the future
Compiling file main.m ...
Compiling file ConverterController.m ...
Compiling file Converter.m ...
Linking app CurrencyConverter2 ...
gmake[3]: warning: Clock skew detected. Your build may be incomplete.
Creating CurrencyConverter2.app/Resources...
Creating stamp file...
Creating CurrencyConverter2.app/Resources/Info-gnustep.plist...
Creating CurrencyConverter2.app/Resources/CurrencyConverter2.desktop...
Copying resources into the app wrapper...
However, when I try to open CurrencyConverter2.app, the main window does not show up at all.
My hunch is that for some reason my Makefile is not recognizing English.lproj/MainMenu.nib.
I also tried using a tool called buildtool that is able to build Xcode projects using GNUstep, but it complained that it couldn't find English.lproj even though it is in the directory that I ran buildtool.
When converting a Mac app to GNUstep, you need to make a GNUstep-specific Info-plist template that roughly mirrors Info.plist (which is Mac-only).
At build time, the Info-plist template is used to generate two files: Info-gnustep.plist, and the app's .desktop (freedesktop.org desktop entry) file.
Info-gnustep.plist contains Info entries used at loadtime/runtime, such as the name of the principal class, the main-menu nibfile to load, etc.
The app's .desktop file contains Info entries used for registering the app with the desktop-environment/file-browser, such as the app's desktop-menu category, the executable path, supported MIME types, etc. (Note: 'make install' currently doesn't register a GNUstep app with the desktop environment; In order for an installed GNUStep app to appear in the desktop menus, its .desktop file - found in its Resources folder - must be manually registered using the 'desktop-file-install' command-line tool.)
The Info-plist template should be named, "{APP_NAME}Info.plist", and can contain a standard XML-format plist, or a simple text-list format:
{
{KEY1} = {VALUE1};
{KEY2} = {VALUE2};
...
}
For CurrencyConverter2, create a textfile named "CurrencyConverter2Info.plist" in the same directory as the Makefile, with the contents:
{
ApplicationName = CurrencyConverter2;
FreeDesktopCategories = ("Utility", "X-GNUstep");
NSExecutable = "CurrencyConverter2";
NSMainNibFile = "MainMenu.nib";
NSPrincipalClass = NSApplication;
NSRole = Application;
}
GNUstep-make will automatically find CurrencyConverter2Info.plist, so it doesn't need an entry in the Makefile.
Unrelated to the Info-plist template issue, you can also make these changes to your Makefile:
Info.plist is Mac-only, so it can be removed from
CurrencyConverter2_RESOURCE_FILES
MainMenu.nib can be specified as a localized resource (so it no longer needs English.lproj in its pathname) by removing it from CurrencyConverter2_RESOURCE_FILES and adding these two lines to your Makefile:
CurrencyConverter2_LOCALIZED_RESOURCE_FILES = MainMenu.nib
CurrencyConverter2_LANGUAGES = English

failed to import bridging header swift 2

I was trying to use SocketIO and Alamofire using cocoapods and started facing this issue. Earlier I added these libraries manually which was working fine.
goto Project->Bulid Setting->Objective-C Bridging Header set "Header.h"... but full path insert
your header file into project group the full path... Like project group name is "XYZ",header file name "Header.h"..set "XYZ/Hrader.h" to Objective-C Bridging Header
There are 3 simple steps to follow,
Add a new Header file into project, using File - > New -> File -> iOS -> Source -> Header File.
Name the class 'your-project-name-Bridging-Header.h'
and press continue to save the file.
Go to Build Settings -> Objective-C Bridging Header and set as ‘your-project-name-Bridging-Header.h’.
If you are using the use_frameworks flag of Cocoapods (which you probably are, since you are using Swift), you have to import like this #import <Reachability/Reachability.h>.
A more general statement would be #import <MODULE/FILE>.

Use relative path in Firefox extension

I develop Firefox extension with bundled executable file which should be run on browser startup.
To run process I need get nsIFile or nsILocalFile instance which points to executable file.
I know one solution how to get it using directory service:
var file = Components.classes["#mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile);
file.append("extensions");
file.append("<extension id>");
file.append("<relative path>");
But this solution has two disadvantages:
It doesn't work in development mode, when instead of installed extension I have only text file with real extension path
I'm not sure that it will work on all Firefox configurations because of hardcoded "extensions" part of the path
So is there any nicer way to run executable file which comes with Firefox extension?
Thanks.
You are making way too many assumptions about the directory structure of the Firefox profile - don't. The Add-on Manager API lets you get the path of a file inside the extension, you should use it:
Components.utils.import("resource://gre/modules/AddonManager.jsm");
AddonManager.getAddonByID("<extension id>", function(addon)
{
var uri = addon.getResourceURI("<relative path>");
var file = uri.QueryInterface(Components.interfaces.nsIFileURL).file;
...
});
A restartless addon's startup function (in the bootstrap.js file) will receive, as its first parameter, the path where the addon is installed. You can then play various tricks to read files inside the .jar file, if any: see https://github.com/protz/GMail-Conversation-View/blob/master/bootstrap.js#L55 as an example.
In a non-restartless case, I must confess I don't have much of an idea :).
I found this thread looking for a way to reference a path to an image hosted in extension's directory from a content script. Here's a solution:
Include your files in web_accessible_resources in the extension's manifest.
"web_accessible_resources": [
"images/*"
]
Absolute paths to these resources contain randomly generated UUID, therefore we're using runtime.getUrl() giving it the path relative to manifest.json. Example:
let myImg = document.createElement('img');
myImg.src = browser.runtime.getURL("images/my-img.png")

Info.plist file missing/Unable to set & retrieve CFBundleVersion from my Cocoa project

I created a new cocoa project using the command-line tool template. I need to be able to set/retrieve the version from the bundle, but the infoDictionary in my mainBundle is only showing three basic items when I do po [[NSBundle mainBundle] infoDictionary]:
{
CFBundleExecutablePath = "...";
NSBundleInitialPath = "...";
NSBundleResolvePath = "...";
}
I do have a Common-Info.plist file, but changing values in here doesn't seem to affect anything. I've also tried to add an Info.plist to my project, but it's ignored.
Is there something special I need to do to get it using the right file?
This is Xcode 3.2.6
EDIT FOR FIX
The key was to add this to my 'Other linker flags' option in the target/get info:
-sectcreate __TEXT __info_plist Info.plist
You can embed the Info.plist file in a special section of your binary. Daniel Jalkut's blog has some good information on it. Check out the "Embedding Info.plist" section here: http://www.red-sweater.com/blog/2083/the-power-of-plist

Resources