Could not find iPhone 6(or any other) simulator React-Native, nothing helps? - xcode

Can not run my project with iOS simulator
ISSUE,
Could not find iPhone 6(or X or any other) simulator
XCODE: 10.2
react-native: 0.52
react: ^16.0.0-alpha.12
Here is my findMatchingSimulator.js from nodemodules/react-native/local-cli/runIOS:
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.*
*/
'use strict';
/**
* Takes in a parsed simulator list and the desired name, and returns an object with the matching simulator.
*
* If the simulatorName argument is null, we'll go into default mode and return the currently booted simulator, or if
* none is booted, it will be the first in the list.
*
* #param Object simulators a parsed list from `xcrun simctl list --json devices` command
* #param String|null simulatorName the string with the name of desired simulator. If null, it will use the currently
* booted simulator, or if none are booted, the first in the list.
* #returns {Object} {udid, name, version}
*/
function findMatchingSimulator(simulators, simulatorName) {
if (!simulators.devices) {
return null;
}
const devices = simulators.devices;
var match;
for (let version in devices) {
// Making sure the version of the simulator is an iOS (Removes Apple Watch, etc)
if (version.indexOf('iOS') !== 0) {
continue;
}
for (let i in devices[version]) {
let simulator = devices[version][i];
// Skipping non-available simulator
if (simulator.availability !== '(available)') {
continue;
}
// If there is a booted simulator, we'll use that as instruments will not boot a second simulator
if (simulator.state === 'Booted') {
if (simulatorName !== null) {
console.warn("We couldn't boot your defined simulator due to an already booted simulator. We are limited to one simulator launched at a time.");
}
return {
udid: simulator.udid,
name: simulator.name,
version
};
}
if (simulator.name === simulatorName && !match) {
match = {
udid: simulator.udid,
name: simulator.name,
version
};
}
// Keeps track of the first available simulator for use if we can't find one above.
if (simulatorName === null && !match) {
match = {
udid: simulator.udid,
name: simulator.name,
version
};
}
}
}
if (match) {
return match;
}
return null;
}
module.exports = findMatchingSimulator;
I tried different methods, but nothing helps.
The list of available devices specifies iPhones as “unavailable”

Change this line:
if (version.indexOf('iOS') !== 0) {
to this:
if (version.indexOf('com.apple.CoreSimulator.SimRuntime.iOS') !== 0) {
There was a recent change to xcode, and the simulator names are now prefixed. This solved it for me.

Related

how to detect device type(android, ios, web) using laravel passport api?

I am trying to find device type (e.g. android, iOS or web browser) in my laravel Passport api for save record in database, but it seems impossible to do it. Please suggest me how to find device type.
Detecting This kinda type is a really complicated task, I would like to suggest you use MobileDetect or other Laravel packages for this.
composer require mobiledetect/mobiledetectlib
include the dependency in the composer.json file
{
"require": {
"mobiledetect/mobiledetectlib": "^2.8"
}
}
And the functionalities are -
// Include and instantiate the class.
require_once 'Mobile_Detect.php';
$detect = new Mobile_Detect;
// Any mobile device (phones or tablets).
if ( $detect->isMobile() ) {
}
// Any tablet device.
if( $detect->isTablet() ){
}
// Exclude tablets.
if( $detect->isMobile() && !$detect->isTablet() ){
}
// Check for a specific platform with the help of the magic methods:
if( $detect->isiOS() ){
}
if( $detect->isAndroidOS() ){
}
// Alternative method is() for checking specific properties.
// WARNING: this method is in BETA, some keyword properties will change in the future.
$detect->is('Chrome')
$detect->is('iOS')
$detect->is('UC Browser')
// [...]
// Batch mode using setUserAgent():
$userAgents = array(
'Mozilla/5.0 (Linux; Android 4.0.4; Desire HD Build/IMM76D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19',
'BlackBerry7100i/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/103',
// [...]
);
foreach($userAgents as $userAgent){
$detect->setUserAgent($userAgent);
$isMobile = $detect->isMobile();
$isTablet = $detect->isTablet();
// Use the force however you want.
}
// Get the version() of components.
// WARNING: this method is in BETA, some keyword properties will change in the future.
$detect->version('iPad'); // 4.3 (float)
$detect->version('iPhone') // 3.1 (float)
$detect->version('Android'); // 2.1 (float)
$detect->version('Opera Mini'); // 5.0 (float)
// [...]
See the documentation to learn more.

Error Couldn't find GPIOController

Hope to find some guidance on this one soon, I've added reference for Windows IoT UWT in my project but still getting the following error ?
An exception of type 'System.TypeLoadException' occurred in test_led_alljoyn.exe but was not handled in user code
Additional information: Could not find Windows Runtime type 'Windows.Devices.Gpio.GpioController'.
Has anyone come across this issue while compiling applications for Raspberry Pi on Windows IoT core, on it's own one of my sample push button app works fine. Here's my code
public IAsyncOperation<testlightbulbSwitchResult> SwitchAsync(AllJoynMessageInfo info, bool interfaceMemberOn)
{
return (Task.Run(() =>
{
SwitchLED(interfaceMemberOn);
return testlightbulbSwitchResult.CreateSuccessResult();
}).AsAsyncOperation());
}
private void SwitchLED (bool state)
{
_ledState = state;
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Devices.Gpio.GpioController"))
{
this.tController = GpioController.GetDefault();
if (this.tController == null)
{
//GpioStatus.Text = "There is no GPIO controller on this device.";
//return;
this.tPin = this.tController.OpenPin(5);
this.tPin.Write(GpioPinValue.High);
this.tPin.SetDriveMode(GpioPinDriveMode.Output);
}
this.tPin.Write(_ledState ? GpioPinValue.Low : GpioPinValue.High);
}
}
Solved. I had to set build platform target compile with .net native tool chain.

Simple AppIndicator with Vala application under Elementary OS

Yesterday I've been stuck on some hard things. Something that looks simple at first but who's not thrust me :/
Here is what i'm trying to have : An appindicator (statusicon ?) with a custom icon for my application.
Unfortunately, there is nothing I found inside valadoc, except this but it's deprecated and it says we should use Notifications which is really not the same thing
I've heard about .vapi Appindicator files, but this is no real documentation about how to use it
If someone can post code about integrating AppIndicator inside vala code, I would be thankful !
Thanks
Have you tried the Vala example included in libappindicator?
http://bazaar.launchpad.net/~indicator-applet-developers/libappindicator/trunk.15.10/view/head:/bindings/vala/examples/indicator-example.vala
/*
* Copyright 2011 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranties of
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authors:
* Marco Trevisan (Treviño) <mail#3v1n0.net>
*/
using Gtk;
using AppIndicator;
public class IndicatorExample {
public static int main(string[] args) {
Gtk.init(ref args);
var win = new Window();
win.title = "Indicator Test";
win.resize(200, 200);
win.destroy.connect(Gtk.main_quit);
var label = new Label("Hello, world!");
win.add(label);
var indicator = new Indicator(win.title, "indicator-messages",
IndicatorCategory.APPLICATION_STATUS);
if (!(indicator is Indicator)) return -1;
indicator.set_status(IndicatorStatus.ACTIVE);
indicator.set_attention_icon("indicator-messages-new");
var menu = new Gtk.Menu();
var item = new Gtk.MenuItem.with_label("Foo");
item.activate.connect(() => {
indicator.set_status(IndicatorStatus.ATTENTION);
});
item.show();
menu.append(item);
var bar = item = new Gtk.MenuItem.with_label("Bar");
item.show();
item.activate.connect(() => {
indicator.set_status(IndicatorStatus.ACTIVE);
});
menu.append(item);
indicator.set_menu(menu);
indicator.set_secondary_activate_target(bar);
win.show_all();
Gtk.main();
return 0;
}
}

Create java-like document for function in IOS (Xcode)

I'm beginner with IOS developing and I'm using Xcode. In java (android), I can create document for a function like below:
/**
* Get the index object in list of object and try to catch
* {#link IndexOutOfBoundsException}
*
* #param list
* of object: {#link List}
* #param index
* of ojbect: {#link Integer}
* #return Object or null if {#link IndexOutOfBoundsException} occurs
*/
public static <T> T getIndexObject(List<T> list, int index) {
T object = null;
try {
object = list.get(index);
} catch (IndexOutOfBoundsException e) {
return null;
}
return object;
}
When I create document as above (in Java), every time when I hover the mouse over the function (used in every where), I will see the document of that function. How's about IOS in Xcode? I know Doxygen, but It only generate HTML files (that not what I want). I want document like default document of every function that provided by Apple (when Ctrl + click on a function of IOS SDK)? Can I do it? And how? Thanks!!
Use AppleDoc. They have an article on their site that explains how to integrate with Xcode: http://gentlebytes.com/appledoc-docs-examples-xcode/, basically, you use:
appledoc
--project-name appledoc
--project-company "Gentle Bytes"
--company-id com.gentlebytes
--output ~/help
--logformat xcode
.
to generate the documents. You can also do the normal HTML in addition. It's free and looks a lot like Apple's documentation.

Titanium : Camera crashes the application

I am using Titanium sdk's openCamera function to capture an image and storing it to sdcard.
function captureImage() {
var capturedImg;
Titanium.Media.showCamera({
success : function(event) {
/* Holds the captured image */
capturedImg = event.media;
/* Condition to check the selected media */
if (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {
var window1 = Project.AddDocumentSaveView.init(capturedImg, docImgModel);
window1.oldWindow = win;
Project.UI.Common.CommonViews.addWindowToTabGroup(window1);
activityInd.hide();
}
},
cancel : function() {
},
error : function(error) {
/* called when there's an error */
var a = Titanium.UI.createAlertDialog({
titleid : Project.StringConstant.IMP_DOCS_CAMERA
});
if (error.code == Titanium.Media.NO_CAMERA) {
a.setMessage(Project.StringConstant.IMP_DOCS_ERROR_WITH_CAMERA);
} else {
a.setMessage(Project.StringConstant.UNEXPECTED_ERROR + error.message);
}
a.show();
}
});
}
It works fine in iphone and even samsung galaxy s2. But on one device, Motorola Milestone device, the application crashes when the picture is accepted after capturing.
Here is the log while the device was attached : Log for camera crash
I tried so many times but couldnt find the issue .I think its some memory issue but i am not sure.
Could someone look into it and help me find what the issue is.
Any help/suggestions will be appreciated.
Thanks
everything in this block should be done after the camera is close
if (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {
}
the camera is memory intensive and you are opening new windows and doing a bunch of other stuff... not good.
This is an aging issue on Titanium (TIMOB-12848
On some devices the native camera app (Titanium calls it using an Intent) cause Android to destroy our app.
When it tries to restart it, there's no recovering of the previous state so the intent callback is not called.
I've found a simple workaround to minimize this issue but doesn't resolve it. It just "mask" it somehow.
The workaround is discussed in the previous link and the full example code is here

Resources