Ошибка loop do как исправить

Ilin Andrian

0 / 0 / 0

Регистрация: 05.03.2022

Сообщений: 65

1

05.03.2022, 16:09. Показов 839. Ответов 7

Метки метка (Все метки)


Студворк — интернет-сервис помощи студентам

Когда я писал код для файла с расширением vbs – мне выдаёт такую ошибку, что делать?

Сценарий: CUsersUserDesktopvbs.vbs
Строка: 13
Символ: 1
Ошибка ‘loop’ вне ‘do’
Код: 800A040E
Источник: Ошибка компиляции Microsoft VBScript

Код:

Visual Basic
1
2
3
4
5
6
7
8
9
10
11
12
13
Do
msgbox"Это vbs файл",48,"vbs"
x = inputbox("Введите команду, если вы не знаете команд. То введите Список команд")
if (x = "Открой гугл") then
createobject("Wscript.Shell").run "cmd /c C:UsersUserDesktoptesttest1.bat", 0
if (x = "Список команд") then
createobject("Wscript.Shell").run "cmd /c C:UsersUserDesktoptestvbs.txt", 0
 
exit do
else
msgbox"Такой команды нету",48,"Ошибочка"
end if
loop



0



Programming

Эксперт

94731 / 64177 / 26122

Регистрация: 12.04.2006

Сообщений: 116,782

05.03.2022, 16:09

Ответы с готовыми решениями:

Ошибка: Индекс находился вне границ массива. В чём проблема?
Пишет ошибку в процедуре "zamena’.
Uses Crt;
Type matr=array of integer;
Var A,B,C:matr;

Проблема с функцией loop
(loop
for item in list
for i from 1 to 10
do (something))

EVFUN: Не найдена функция LOOPFOR…

проблема с командой loop
mov ebx,offset mas1
xor eax,eax
mov ecx,5
cikl1:
.if eax<
mov eax, …

Open Loop и Closed Loop системы, какие утверждения верны?
1) В системах Open Loop можно обойтись без измерения фактического значения.
2) В случае большой…

Найти среднее арифметическое отрицательных чисел, введенных с клавиатуры, используя do-loop while/do-loop until
Нужна помощь. Найти среднее арифметическое отрицательных чисел, введенных с клавиатуры, используя…

7

2875 / 1708 / 204

Регистрация: 28.10.2011

Сообщений: 6,354

Записей в блоге: 6

05.03.2022, 17:09

2

Цитата
Сообщение от Ilin Andrian
Посмотреть сообщение

мне выдаёт такую ошибку

Цитата
Сообщение от Ilin Andrian
Посмотреть сообщение

Ошибка ‘loop’ вне ‘do’

И что из этого непонятно?

Цитата
Сообщение от Ilin Andrian
Посмотреть сообщение

что делать?

Посчитайте число if и завершающих их end if.



0



0 / 0 / 0

Регистрация: 05.03.2022

Сообщений: 65

05.03.2022, 17:16

 [ТС]

3

Ничего не понял можно по подробней. Я просто ещё ничего не понимаю.



0



I can

bite

3679 / 3212 / 702

Регистрация: 13.04.2015

Сообщений: 7,493

05.03.2022, 17:28

4

Visual Basic
1
2
3
4
5
6
7
Do
msgbox "Это vbs файл",48,"vbs"
x = inputbox("Введите команду, если вы не знаете команд. То введите Список команд")
if (x = "Открой гугл") then createobject("Wscript.Shell").run "cmd /c C:UsersUserDesktoptesttest1.bat", 0:exit do
if (x = "Список команд") then createobject("Wscript.Shell").run "cmd /c C:UsersUserDesktoptestvbs.txt", 0:exit do
msgbox"Такой команды нету",48,"Ошибочка"
loop



1



Ilin Andrian

0 / 0 / 0

Регистрация: 05.03.2022

Сообщений: 65

05.03.2022, 17:32

 [ТС]

5

Пишу ещё раз. Что мне делать если выдаёт такую ошибку –

Сценарий: CUsersUserDesktopvbs.vbs
Строка: 13
Символ: 1
Ошибка ‘loop’ вне ‘do’
Код: 800A040E
Источник: Ошибка компиляции Microsoft VBScript

Код:

Visual Basic
1
2
3
4
5
6
7
8
9
10
11
12
13
Do
msgbox"Это vbs файл",48,"vbs"
x = inputbox("Введите команду, если вы не знаете команд. То введите Список команд")
if (x = "Открой гугл") then
createobject("Wscript.Shell").run "cmd /c C:UsersUserDesktoptesttest1.bat", 0
if (x = "Список команд") then
createobject("Wscript.Shell").run "cmd /c C:UsersUserDesktoptestvbs.txt", 0
 
exit do
else
msgbox"Такой команды нету",48,"Ошибочка"
end if
loop

Ну а если убрать –

Visual Basic
1
2
if (x = "Список команд") then
createobject("Wscript.Shell").run "cmd /c C:UsersUserDesktoptestvbs.txt", 0

То ошибка пропадает, но мне нужно сделать так что бы можно было вписать несколько текстов и открывались bat и текстовые файлы. Помогите пожалуйста!!



0



bite

3679 / 3212 / 702

Регистрация: 13.04.2015

Сообщений: 7,493

05.03.2022, 19:01

6

Цитата
Сообщение от Ilin Andrian
Посмотреть сообщение

То ошибка пропадает, но мне нужно сделать так что бы можно было вписать несколько текстов и открывались bat и текстовые файлы. Помогите пожалуйста!!

Я же дал код полностью. В чём проблема?

Добавлено через 6 минут

Цитата
Сообщение от Ilin Andrian
Посмотреть сообщение

Что мне делать если выдаёт такую ошибку –

End If ‘ написать между пятой и шестой строкой, или использовать мой пример.



0



2875 / 1708 / 204

Регистрация: 28.10.2011

Сообщений: 6,354

Записей в блоге: 6

05.03.2022, 19:59

7

Цитата
Сообщение от Ilin Andrian
Посмотреть сообщение

Ничего не понял можно по подробней.

Вы считать не умеете?
1+1-1 не равно 0, а должно быть равно 0. Вот сделайте так чтобы количество if было равно количеству end if.
Изучите язык на котором пишите, иначе ничего нормально не получится.



2



bite

3679 / 3212 / 702

Регистрация: 13.04.2015

Сообщений: 7,493

05.03.2022, 20:01

8

Цитата
Сообщение от locm
Посмотреть сообщение

Вы считать не умеете?

Он не считатель



2



IT_Exp

Эксперт

87844 / 49110 / 22898

Регистрация: 17.06.2006

Сообщений: 92,604

05.03.2022, 20:01

Помогаю со студенческими работами здесь

Как создать 4 варианта программы c For/Next,Do While / Loop, Do Loop /Until , If Then Goto
Создать 4 варианта программы c,m For/Next,Do While / Loop, Do Loop /Until , If Then Goto…

Нужно написать программу с циклом Do While.Loop или Do.Loop Until
Составить алгоритм и написать программу нахождения для введенных 15 чисел сумму, если число…

Как проверить подключен ли javascript или у меня другая ошибка,у меня на сайте этот код не работает
<p>
<select name="id_mon" id="select_mon">
<?php

$result =…

В чём у меня ошибка? Поправьте меня
Приветствую вас! Пишу небольшой движок и тут проблема в конфиге.
Вот код config.php

<?…

Warining For-loop variable ‘i’ may be undefined after loop
Что не так с кодом? При компиляции программы появляется предупреждение:" Unit1.pas(46):For-loop…

Warining For-loop variable ‘i’ may be undefined after loop
Как исправить код, что бы программа работала корректно.

var
Form1: TForm1;

implementation…

Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:

8

Доброго времени суток.  

  Задумка такова:  

  1. Установить счётчик строк на 38.  
2. Если ячейка в столбце А (строка – по счётчику) не пустая, выполнить п.3-5. Если пустая, остановить программу.  
3. Если ячейка в определённом столбце той же строки имеет значение “Оплачено”, изменить цвет шрифта в ячейке столбца А той же строки. Если нет, перейти к п.4.  
4. Увеличить счётчик строк на единицу.  
5. Перейти к п.2  

  Код:  

  Sub Hilight ()  
Dim taskcell as Integer  
taskcell = 38  
Do Until Range(“A” & taskcell).Value = “”  
If Range(“A” & taskcell).Offset(0, 2 + User) = (“Оплачено”) Then  
   Range(“A” & taskcell).Font.ColorIndex = 16  
   Else  
   taskcell = taskcell + 1  
Loop  
End Sub  

  При запуске выдаётся сообщение “Compile error: Loop without Do”. Помогите понять ошибку.

Перейти к контенту

Выдает ошибку «Loop without Do» хотя Do есть

Bamboo

Дата: Понедельник, 28.03.2016, 21:50 |
Сообщение № 1

Группа: Пользователи

Ранг: Участник

Сообщений: 99


Репутация:

0

±

Замечаний:
0% ±


Excel 2010

Странная ситуация, цикл исправно работал. А Потом появилась эта ошибка. Хотя Do есть.
Прошу не ругаться на код, это мой первый на VBA да еще и не отлаженный.
[vba]

Код

Function HighLevACC(ACC, DistMap)
Dim Array_DistMap()
Dim Array_SubHLACC()
Dim I As Integer, J As Integer, X As Integer, Y As Integer
Do
X = X + 1
If ACC.Cells(X, 1) = «Empty» And ThisCell.Address.Offset(X, 10) = «» Then      
Set vHLACC = ACC.Cells(X, -1)
Array_DistMap = DistMap.Value
  Counter_j = 0
For I = 1 To UBound(Array_DistMap)
If Array_DistMap(I, 1) = vHLACC Then
J = J + 1
ReDim Preserve Array_SubHLACC(1 To J)
Array_SubHLACC(J) = Array_DistMap(I, 2)
  MsgBox (Array_SubHLACC(J))
  End If
Next
HighLevACC = Array_SubHLACC(2)
HighLevACC.Offset(0, 9) = 1
ACC.Cells(Õ, 9) = «S»      
If ACC.Cells(Õ — 1, 10) = «C» Then       
vHLACC = ACC.Cells(X — 1, -1)
Counter_j = 0
For I = 1 To UBound(Array_DistMap)
If Array_DistMap(I, 1) = vHLACC Then
J = J + 1
ReDim Preserve Array_SubHLACC(0 To J)
Array_SubHLACC(J) = Array_DistMap(I, 2)
  End If
Next
Y = HighLevACC.Offcet(-1, 9)
Y = Y + 1
If Y <= J Then
HighLevACC = Array_SubHLACC(Y)
HighLevACC.Cells(0, 9) = Y
If Y = J Then
HighLevACC.Cells(0, 10) = «D»
End If
End If
End If
HighLevACC = ACC.Cells(X, 1)
Loop While (X < ACC.Count) Or (ACC.Cells(X, 1) = «Empty» And ThisCell.Address.Offset(X, 10) = «»)
End Function

[/vba]

 

Ответить

al-Ex

Дата: Понедельник, 28.03.2016, 22:00 |
Сообщение № 2

Группа: Проверенные

Ранг: Форумчанин

Сообщений: 190


Репутация:

59

±

Замечаний:
0% ±


Excel 2010


если цикл начинается с «For I =1 …» тогда уже внизу — «Next I», исправьте в двух местах.
и конструкции типа: If Then
Else
End If
так мудрёно лучше не делать.
Вряд-ли это будет работать именно так как Вы задумали.

Сообщение отредактировал al-ExПонедельник, 28.03.2016, 22:24

 

Ответить

Невилл

Дата: Понедельник, 28.03.2016, 22:09 |
Сообщение № 3

Группа: Пользователи

Ранг: Участник

Сообщений: 79


Репутация:

2

±

Замечаний:
0% ±


Excel 2007

Одно из If не закрыто.

Кстати, неплохо бы определять переменные и их типы сверху, пожалуй.

 

Ответить

Апострофф

Дата: Понедельник, 28.03.2016, 22:10 |
Сообщение № 4

Группа: Проверенные

Ранг: Обитатель

Сообщений: 416


Репутация:

117

±

Замечаний:
0% ±


Excel 1997

Учитесь оформлять код отступами — и проблем не будет
[vba]

Код

Function HighLevACC(ACC, DistMap)
Dim Array_DistMap()
Dim Array_SubHLACC()
Dim I As Integer, J As Integer, X As Integer, Y As Integer
Do
    X = X + 1
    If ACC.Cells(X, 1) = «Empty» And ThisCell.Address.Offset(X, 10) = «» Then
        Set vHLACC = ACC.Cells(X, -1)
        Array_DistMap = DistMap.Value
        Counter_j = 0
        For I = 1 To UBound(Array_DistMap)
            If Array_DistMap(I, 1) = vHLACC Then
                J = J + 1
                ReDim Preserve Array_SubHLACC(1 To J)
                Array_SubHLACC(J) = Array_DistMap(I, 2)
                MsgBox (Array_SubHLACC(J))
            End If
        Next
        HighLevACC = Array_SubHLACC(2)
        HighLevACC.Offset(0, 9) = 1
        ACC.Cells(O, 9) = «S»
        If ACC.Cells(O — 1, 10) = «C» Then
            vHLACC = ACC.Cells(X — 1, -1)
            Counter_j = 0
            For I = 1 To UBound(Array_DistMap)
                If Array_DistMap(I, 1) = vHLACC Then
                    J = J + 1
                    ReDim Preserve Array_SubHLACC(0 To J)
                    Array_SubHLACC(J) = Array_DistMap(I, 2)
                End If
            Next
            Y = HighLevACC.Offcet(-1, 9)
            Y = Y + 1
            If Y <= J Then
                HighLevACC = Array_SubHLACC(Y)
                HighLevACC.Cells(0, 9) = Y
                If Y = J Then
                    HighLevACC.Cells(0, 10) = «D»
                End If
            End If
        End If
    End If ‘НЕ ХВАТАЛО ЭТОГО.
    HighLevACC = ACC.Cells(X, 1)
Loop While (X < ACC.Count) Or (ACC.Cells(X, 1) = «Empty» And ThisCell.Address.Offset(X, 10) = «»)
End Function

[/vba]

Сообщение отредактировал АпостроффПонедельник, 28.03.2016, 22:18

 

Ответить

Bamboo

Дата: Понедельник, 28.03.2016, 22:48 |
Сообщение № 5

Группа: Пользователи

Ранг: Участник

Сообщений: 99


Репутация:

0

±

Замечаний:
0% ±


Excel 2010

Апострофф, Спасибо! Получилось! Насчет, отступов, это я поленился, а зря…

 

Ответить

_Boroda_

Дата: Понедельник, 28.03.2016, 23:02 |
Сообщение № 6

Группа: Модераторы

Ранг: Местный житель

Сообщений: 16563


Репутация:

6446

±

Замечаний:
0% ±


2003; 2007; 2010; 2013 RUS

Bamboo, Виталий, я, например, делаю вот так — когда пишу If … Then, то сразу же ДВА раза жму Ентер и пишу End If, затем возвращаюсь на строчку выше, жму Тав и пишу то, что хотел написать внутри Ифа.
Аналогично с циклами — For i = 1 to 5, ДВА раза Ентер, Next i, стрелка вверх, Тав и тело цикла. При таком стиле записи я уже не теряю закрытия циклов и Ifов.
Можно еще пользоваться облегчениями отсюда http://www.excelworld.ru/forum/10-22392-180576-16-1458977793
Кстати, вот это

если цикл начинается с «For I =1 …» тогда уже внизу — «Next I»

не обязательно. Можно писать просто Next, но, когда у Вас цикл в цикле и все это внутри цикла, то довольно легко запутаться, поэтому для облегчения понимания желательно указывать переменную, цикл по которой закрываем.

Насчет, отступов, это я поленился

Отступы легко делать Тавом или в VBA вывести панельку Edit, там есть специальные кнопочки — ими можно делать отступ сразу для нескольких строк (Тавом тоже можно).


Скажи мне, кудесник, любимец ба’гов…
Платная помощь:
Boroda_Excel@mail.ru
Яндекс-деньги: 41001632713405 | Webmoney: R289877159277; Z102172301748; E177867141995

 

Ответить

I’m trying to implement a simple Newton’s method iterative solver using Excel VB (I have never used VB.)

I keep getting the error loop without a Do and I can’t figure out what I’m doing wrong here.

I’m trying to find the roots of the function z^3 - z^2 - (B^2 + B - A)z - A*B called the compressibility factor.

My source MSN

Function zCalculation(ByVal temp As Double, ByVal press As Double) As Double

Dim tempCr As Double
Dim pressCr As Double
Dim A As Double
Dim B As Double

tempCr = temp / 238.5

pressCr = press / 547.424092

A = pressCr / tempCr
A = A / (9 * (2 ^ (1 / 3) - 1))
B = pressCr / tempCr
B = B * (2 ^ (1 / 3) - 1) / 3



Dim zNot As Double
Dim counter As Integer
counter = 0
zNot = 1#

Do
    counter = counter + 1

    zNot = zNot - (zNot ^ 3 - zNot ^ 2 - (B ^ 2 + B - A) * zNot - A * B) / (3 * zNot ^ 2 - 2 * zNot - (B ^ 2 + B - A))
    If counter > 1000 Then
       Exit Do

Loop Until eval(zNot, A, B) < 0.000001


zCalculation = zNot


End Function

break

Function eval(ByVal z As Double, ByVal A As Double, ByVal B As Double) As Double

    eval = z ^ 3 - z ^ 2 - (B ^ 2 + B - A) * z - A * B

End Function

Community's user avatar

asked Dec 9, 2013 at 16:58

Felix Castor's user avatar

Felix CastorFelix Castor

1,5691 gold badge17 silver badges38 bronze badges

You need an:

End If

in your code.

answered Dec 9, 2013 at 17:04

Gary's Student's user avatar

Gary’s StudentGary’s Student

95k9 gold badges58 silver badges97 bronze badges

2

You can try:

 Function zCalculation(ByVal temp As Double, ByVal press As Double) As Double

  Dim tempCr As Double
  Dim pressCr As Double
  Dim A As Double
  Dim B As Double

  tempCr = temp / 238.5

  pressCr = press / 0.546789

  A = pressCr / tempCr
  A = A / (9 * (2 ^ (1 / 3) - 1))
  B = pressCr / tempCr
  B = B * (2 ^ (1 / 3) - 1) / 3



  Dim zNot As Double
  Dim counter As Integer
  counter = 0
  zNot = 1#

  Do
      counter = counter + 1

      zNot = zNot - (zNot ^ 3 + zNot ^ 2 - (B ^ 2 + B - A) * zNot - A * B) / (3 * zNot ^ 2 + 2 * zNot - (B ^ 2 + B - A))
      If counter > 1000 Then
         Exit Do
      End if  ' <--- Here

  Loop Until eval(zNot, A, B) < 0.000001

  zCalculation = zNot
 End Function

answered Dec 9, 2013 at 17:06

Makah's user avatar

1

Sub datacalculationsandformat()
Dim row As Integer
row = 2
Do While Cells(row, 2) <> ""
Cells(row, 3).Value = Cells(row, 2).Value * 0.3
Cells(row, 4).Value = Cells(row, 2) * 0.1
Cells(row, 5).Value = Cells(row, 2).Value + Cells(row, 3).Value + Cells(row, 4).Value
If Cells(row, 5).Value >= 8000 Then
Worksheets("Sheet1").Cells(row, 5).Font.Bold = True
row = row + 1
Loop

slavoo's user avatar

slavoo

5,64864 gold badges36 silver badges39 bronze badges

answered Sep 21, 2017 at 5:11

user8646115's user avatar

zzoommmmmm

0 / 0 / 0

Регистрация: 13.12.2011

Сообщений: 6

1

13.12.2011, 17:58. Показов 6779. Ответов 3

Метки нет (Все метки)


Найти первый отрицательный член последовательности cos(ctg(n)) для n изменяющегося следующим образом: n = 1, 2, 3, … .

Visual Basic
1
2
3
4
5
6
7
8
9
10
11
12
13
Sub Tim()
Dim n As Integer
Dim Y As Integer
n = 1
Do
    Y = Cos(1 / Tan(n))
    If Y < 0 Then
    Debug.Print "n="; n, "Y="; Y: GoTo M
    Else
    n = n + 1
Loop While Y >= 0
M:     End If
End Sub

Помогите исправить код, пишет ошибку «Loop without Do». Заранее спасибо!)

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь

0

Programming

Эксперт

94731 / 64177 / 26122

Регистрация: 12.04.2006

Сообщений: 116,782

13.12.2011, 17:58

Ответы с готовыми решениями:

Почему в коде указано, что » кнопка 1 » и » кнопка 2 » добавлены в центр, а они добавляются «по умолчанию»?
Вот мой код:

import java.awt.*;

import javax.swing.*;

@SuppressWarnings(&quot;serial&quot;)…

В строке все буквы «а» заменить буквой «б» и наоборот, если они есть
В строке все буквы &quot;а&quot; заменить буквой &quot;б&quot; и наоборот, если они есть

Составьте программу, выясняющую, есть ли в слове Х хотя бы одна из букв «о» или «а»
1. Составьте программу, выясняющую, есть ли в слове Х хотя бы одна из букв &quot;о&quot; или &quot;а&quot;.
2….

Выясните, есть ли в слове X хотя бы одна из букв «к» или «м»
Выясните, есть ли в слове X хотя бы одна из букв &quot;к&quot; или &quot;м&quot;.

3

es geht mir gut

11264 / 4746 / 1183

Регистрация: 27.07.2011

Сообщений: 11,437

13.12.2011, 18:20

2

11 и 12 строку поменяй местами, у меня был точно такой же случай.
А в 8 поставь не Go To M, а Exit Do

1

Alex77755

11464 / 3757 / 675

Регистрация: 13.02.2009

Сообщений: 11,098

13.12.2011, 18:25

3

Цитата
Сообщение от SoftIce.net
Посмотреть сообщение

11 и 12 строку поменяй местами, у меня был точно такой же случай.
А в 8 поставь не Go To M, а Exit Do

Вообще убери. Уже есть условие

Visual Basic
1
While Y >= 0

1

0 / 0 / 0

Регистрация: 13.12.2011

Сообщений: 6

13.12.2011, 18:25

 [ТС]

4

Цитата
Сообщение от SoftIce.net
Посмотреть сообщение

11 и 12 строку поменяй местами, у меня был точно такой же случай.
А в 8 поставь не Go To M, а Exit Do

Спасибо, помогло)

0

IT_Exp

Эксперт

87844 / 49110 / 22898

Регистрация: 17.06.2006

Сообщений: 92,604

13.12.2011, 18:25

Помогаю со студенческими работами здесь

Выясните, есть ли в слове Х хотя бы одна из букв «о» или «а»
№1) Выясните, есть ли в слове Х хотя бы одна из букв &quot;о&quot; или &quot;а&quot;.

Дана строка, состоящая из слов, разделенных пробелом. Определить количество слов, в которых есть хотя бы одна буква «а», или «А»
Дана строка, состоящая из слов, разделенных пробелом. Определить количество слов, в которых есть…

Непонятная ошибка » For loop control variable must have ordinal type»
unit Unit3;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,…

Патерн «прототип» не работает, выдаёт ошибку «недопустимый вызов нестатической ф-ции», где я в коде ошибка?
Вот мой код…

#include &lt;iostream&gt;
#include &lt;Windows.h&gt;
#include &lt;vector&gt;
#define vrom…

Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:

4

  1. Mar 8th, 2011, 03:27 PM

    #1

    tribeorange is offline

    Thread Starter


    New Member


    Resolved [RESOLVED] Compile Error:Loop Without Do

    I get a compile error saying,
    Loop Without do. I really have no idea what that means. I’d appreciate any help i could get.

    Code:

    ' ok?
    If ((WeekdayName(Weekday(LoanExpiryDate - 1)) = "Saturday") Or (WeekdayName(Weekday(LoanExpiryDate - 1)) = "Sunday") Or (libraryopendate = False)) Then
    ' no good! either the date we're trying is in a weekend or its when the library is open, add one onto the date and try again
    LoanExpiryDate = LoanExpiryDate + 1
    Else
    dateok = True
    End If
    Loop
    End Sub

  2. Mar 8th, 2011, 03:36 PM

    #2

    Re: Compile Error:Loop Without Do

    Welcome to VBForums.

    You need a Do to go along with the loop. I’m not sure where you want it to be but this would compile:

    Code:

    Do
    If ((WeekdayName(Weekday(LoanExpiryDate - 1)) = "Saturday") Or (WeekdayName(Weekday(LoanExpiryDate - 1)) = "Sunday") Or (libraryopendate = False)) Then
    ' no good! either the date we're trying is in a weekend or its when the library is open, add one onto the date and try again
    LoanExpiryDate = LoanExpiryDate + 1
    Else
    dateok = True
    End If
    Loop

  3. Mar 8th, 2011, 04:08 PM

    #3

    tribeorange is offline

    Thread Starter


    New Member


    Re: Compile Error:Loop Without Do

    Thank you very much for the reply. is there anyway to PM you on here? perhaps by email? MSN?


  4. Mar 8th, 2011, 04:10 PM

    #4

    Re: Compile Error:Loop Without Do

    Beware that it will land you into an endless loop.. ultimately crashing your program.
    For it to work successfully, you need to provide some exit condition from the loop
    e.g.

    Code:

    'Method 1
    Do While (condition)
    ...
    Loop
    
    'Method 2
    Do
    ...
    Loop While (condition)
    
    'Method 3
    Do
    ...
    If (some condition) Then Exit Do
    ...
    Loop

    There are more ways, but one of these three should suffice.


  5. Mar 8th, 2011, 04:14 PM

    #5

    tribeorange is offline

    Thread Starter


    New Member


    Re: Compile Error:Loop Without Do

    Thanks for the reply Pradeep. Really appreciate it. Check your PM when you get a chance


  6. Mar 8th, 2011, 04:32 PM

    #6

    Re: Compile Error:Loop Without Do

    Sorry I don’t answer coding questions via PM. It defeats the purpose of this forum.
    Please post your question here and I’ll help you in whatever way I can.


  7. Mar 8th, 2011, 04:48 PM

    #7

    tribeorange is offline

    Thread Starter


    New Member


    Re: Compile Error:Loop Without Do


  8. Mar 8th, 2011, 05:04 PM

    #8

    Re: Compile Error:Loop Without Do

    Is this what you’re trying to do?

    Code:

    Do Until dateok = True
        ' ok?
        If ((WeekdayName(Weekday(LoanExpiryDate - 1)) = "Saturday") Or (WeekdayName(Weekday(LoanExpiryDate - 1)) = "Sunday") Or (libraryopendate = False)) Then
            ' no good! either the date we're trying is in a weekend or its when the library is open, add one onto the date and try again
            LoanExpiryDate = LoanExpiryDate + 1
        Else
            dateok = True
        End If
    Loop

Build Errors¶

These are only relevant when building with a Mac and Xcode.

For GitHub (Browser Build) errors, please see: GitHub Errors

There are two types of build indications that may be seen: they are warnings (yellow or purple icons) and red errors. You’ll see the warnings and errors in the left-hand column of the Xcode window.

Yellow and Purple warnings do not cause the build to fail, those are just warnings. You will often see yellow and purple icons. Ignore those. Do not try to do anything to fix those.

Red errors will have to be resolved before you can successfully build the Loop app. The steps below explain how to resolve them based on the messages you are seeing.

Xcode Not Responding¶

Sometimes, Xcode stops responding. You have to fix this before any of the other steps on this page will help. The signature is that Xcode shows a colorful spinning icon and does not respond to anything you do.

This can happen sometimes. You just need to force quit Xcode. Sometimes rebooting the Mac may be required, but start with force quit. Then just open up Xcode again and keep going.

  • Hold down these 3 keys Option+Cmd+Esc (or Alt+Cmd+Esc), until the Force Quit menu appears (should be fast)
  • Select Xcode and tap on the Force Quit button

menu to select application to force quit

Start with The Obvious Error Causes¶

New Loop Builders

This page contains build error help for people updating their Loop app as well as brand new Loop app builders. Review the “obvious” errors causes first. If that doesn’t help, then, skim the page until you reach Find Your Error Message or search the page (Cmd+F) or search LoopDocs for your error. Once you’ve identified your error message, try to resolve it. Still stuck? Read Posting for Help

Before you start trying to resolve your red errors, start with the most obvious things that can cause a red error message:

  1. For older builds, before 3.2.0, you had to select Loop(WorkSpace) The first time you build after downloading new code, you had to manually select Loop (Workspace) instead of Loop in Xcode.

    • Starting with Loop 3.2.0 and newer versions, the target name and xcworkspace file names are now automatically LoopWorkspace – no special action needed when building.
  2. Did you check that you have the minumum Xcode version for your iOS? This is critical. If you are updating your Loop app, please review the iOS driven requirements for minimum version of macOS and Xcode.

  3. Did you check your Apple developer account for new license agreement? Periodically, Apple will release a new developer license agreement that you need to sign before you can build new apps. You will get a build failure if there is a pending license agreement to sign. Login to your Apple developer account to check if there’s a new license agreement.

  4. Do you have a new computer, never used to build Loop? Did you Add Apple ID to Xcode?

  5. Did you reboot, i.e., restart, your computer after updating Xcode? You should reboot following Xcode installation or update and you must make sure your command line tools match the version of Xcode you just installed. Xcode Command Line Tools

  6. Did you get a fresh download of Loop code? If you tried to build with an old download that you used a long time ago, that old version may not be compatible with the new iOS and Xcode versions. Check also, that you are actually using the new download in Xcode. When you use the Build Select Script, it automatically opens Xcode using the new download.

    If you want to build using a recent download, this section tells you how to Find My Downloaded Loop Code.

  7. Are you are using a free developer account? Make sure you finished the removal of Siri and Push Notification capabilities described in the Free Account link.

  8. DO NOT USE BETA VERSIONS If you are using an iOS beta version or an Xcode beta version, Loop might not build. Deleting iOS beta from a phone is a pain…so don’t install it unless you know what you are doing.

Fix 95% of errors¶

If you have checked all those steps above and think you have a true build error, here’s a tip that resolves 95% of all build errors when updating Loop code.

  1. Open your project in Xcode as normal. Then go to the menu bar at the top of the screen and find the Product menu item. Use the drop down selection for Clean Build Folder or press Shift+Cmd+K. Either will work the same. Wait for the clean to finish before trying to build again.
  2. On the far right, next to the name Full Path is the folder name that Xcode will be using to build. Make sure it is the new code you just downloaded and not an older folder.
  3. If you are updating Loop and did not Delete Old Provisioning Profiles, do it now
  4. Return to Xcode and try building your app again.
  5. Still failing for phone or watch or both? Try the Unpair and Reboot procedure.

Unpair and Reboot¶

This is reported to fix a variety of watch building errors and cannot prepare phone for development errors:

  1. Open Xcode (if not already open)
  2. Plug phone into computer and make sure it is unlocked
  3. Using the Xcode menu, select
    • Windows
    • Devices and Simulators
    • On left side, Right-Click (or Control-Click) on your phone
    • Choose Unpair Device

It may not be necessary, but the suggestion is to reboot phone, (watch) and Mac – in other words, you can try to build without rebooting, but if that fails, repeat the steps and reboot before trying again.

unpair device from xcode

The next time you plug this phone into your computer, you will be asked to trust the computer on the phone (and watch). Note this is unpairing the device from Xcode and your computer, not the same as, and much faster than, unpairing your watch from your phone.

If the build fails again, look through the list below and see if you can match your error message with one of the error messages listed later in this page. If you really can’t find your solution, then post for help. But help us help you.

  • Ignore yellow and purple warning messages – those are not errors – do not try to fix them
  • Confirm it really is an error not already on this page; read this page carefully, including all the circled bits in the images in the Specific Error Messages section
  • Follow the steps in the Posting for Help section
  • WE CANNOT HELP without version numbers and screenshots
  • Do not take pictures of your computer screen with your phone, use screenshots

New with Xcode 14¶

This may change, but for now, the watchOS simulator is not automatically included with the Xcode 14.x download and install. Some version of the watchOS simulator is required to build Loop, independent of whether you use a watch.

You will be asked if you want to download & install. Make sure watchOS is selected.

query about watchOS simulators

If you are getting watch errors or having trouble with your watch, try this:

Tap on the Xcode name on the menu bar and select Settings (used to be called Preferences).

Choose the Platform tab. If there is a missing watchOS simulator that you think might help, then download it using the GET button. Use the minus icon (bottom left) to remove simulators that are no longer being used. (The watchOS 9.0 is required to build with Xcode 14.0.1. The watchOS 9.1 was downloaded with a release candidate for Xcode 14.1 – your screens may look different.)

look for missing simulators

Posting for help¶

STOP!! Read this section! Important!

Before you post in a Loop Social Media site asking for help with build errors, do your work first. The build errors listed below (and the checks listed above) will fix most of problems you may encounter. PLEASE READ THIS PAGE. The volunteers answering questions online would love to spend more time helping people use Loop and less time answering questions that can be addressed by using this page.

Therefore, try to resolve your build error yourself. Then, if you need to post for help, please include enough information with the post so the volunteers know where you are in your troubleshooting attempts.

Your Post Must Include:

  • The version of Xcode you are using
  • The version of Loop you are building with
  • The version of iOS on your Loop iPhone
  • Free or paid account, and if free, confirmation that you deleted Siri and Push Notification capabilities
  • Confirmation that you are not using an Xcode beta or iOS beta version (so we don’t have to ask, please actually type “I am not using beta versions”)
  • Screenshots of your WHOLE Xcode window and/or Terminal window showing your error and any messages you’ve seen while working through the build errors/solutions. Do NOT use phone photographs of your computer screen. See below for instructions on how to capture a screenshot.
  • State which fixes from the list below you have already tried AND post the screenshots of the results of those fix attempts.

Screenshots¶

Please take screenshots of your issue and use them in your posts. On an Apple computer, press Shift+Cmd+4 keys at the same time followed by pressing the space bar Space and then click on the window of interest. The screenshot will be saved to your desktop with a file name starting with the name “Screen Shot”. Use screenshots instead of cell phone images or words whenever possible. Screenshots are higher resolution and easier to read.

Use the whole Xcode window screenshot when posting for build help.

Find Your Error Message(s)¶

To begin fixing the error, use the Report Navigator view to find your error message.

img/report-nav.png

The key is to (1) READ THE ERROR MESSAGE and then (2) FIND YOUR MESSAGE IN ONE OF THE TOPICS BELOW.

Here’s a super tip: Merely seeing the “exit code” in Xcode is not enough information to discern what error is causing your build to fail; some exit codes have multiple causes. Look at the detailed message to guide your search for the matching solution.

Notice the screenshots below have red circles highlighting certain error messages. Read your error message(s) from your screen, being guided by the red circles in the screenshots. Once you find your error message (hint: not “exit code”), you can either:

  • Take the error message from your Xcode screen and use LoopDoc’s search function to enter in some of that phrase to bring up the appropriate solution topic, or

  • Take the error message from your Xcode screen and read through EACH OF THE TOPICS BELOW. Check each of the red circles to see if you have a match. Kind of like a matching puzzle.

For example, if you see “Invalid active developer path (/Library/Developer/CommandLineTools)” in your error message, use the search tool in LoopDocs with “invalid active”. You will get a couple of links and one is the Command Line Tools fix for that error message. Click on the link and you’ll find the solution.

img/search-errors.png

Specific Error Messages¶

Run Destination is Not Valid; Failed to Prepare the Device¶

Error Message:

The run destination for name’s phone is not valid for running the scheme “Loop (Workspace)”

run destination not valid

Solution:

First make sure your Xcode version is new enough to work with your phone iOS version and make sure developer mode is turned on for iOS 16 or newer. If so, then try this procedure:

  • Follow the link for the Unpair and Reboot procedure.

Package.resolved file corrupted or malformed¶

Error Message:

Package.resolved file is corrupted or malformed; fix or delete the file to continue: unsupported schema version 2

package corrupted or malformed error

This error is new with Loop 3, which uses Package Dependencies.

There are 2 problems shown here

  1. The version of Xcode is out of date
  2. The graphic was acquired using a camera instead of a screenshot, and yes – that was a joke – using a camera does not cause a build error

Solution:

Update Xcode, which may require you to update macOS.

Couldn’t Get Revision for Package Dependency¶

Many Search 1.4.3 for this Error¶

This error is new with Loop 3, which uses Package Dependencies.

  • If you notice a red x in Xcode (as circled in the graphic below)
    • Click on the red x to show the error in the left pane
    • Alternatively, you can click on the icon shown with the red square to see the same information

Error Message:

package dependency error

Text in error:

  • Uncategorized
    • Couldn’t get revision . . .

Solution:

Refer to the graphic below

  1. Click on the folder icon (indicated by red square)
  2. Hold down the Control-Key and click the Package Dependencies row to display the dropdown menu (shown in the inset)
  3. Select Reset Package Caches from the dropdown menu and wait for Xcode to finish the reset process
  4. Once the package reset completes (updates in upper right of xcode will stop or say indexing), the red x should vanish
  5. You can start the build as soon as the Indexing message appears

package dependency solution

Unable To Read Included File¶

This error has been seen with Loop 3. The permanent xcconfig file, created by the build script and used to sign targets, is written to a folder where the user does not have read permission.

Error Message:

unable to read error

Text in error:

  • unable to read included file path inserted here

Solution:

No need to quit Xcode. If your build script terminal is still open, use it. Otherwise, open a new terminal window.

Copy the lines below that start with ls -l by hovering the mouse near the right side of the text and clicking the copy icon (should say Copy to Clipboard when you hover over it). When you click the icon, a message that says Copied to Clipboard will appear on your screen.

Copy and Paste to add read permissions to xcconfig file

ls -l ~/Downloads/BuildLoop/LoopConfigOverride.xcconfig
chmod +r ~/Downloads/BuildLoop/LoopConfigOverride.xcconfig
ls -l ~/Downloads/BuildLoop/LoopConfigOverride.xcconfig

Paste the lines into the terminal. The response to the first line will be something like this:

--w-------  1 marion  staff  490 Nov  8 04:58 /Users/marion/Downloads/BuildLoop/LoopConfigOverride.xcconfig

There will be no response after the second line – although if an error is reported, please grab a screen shot.

The response to the last line will be something like this:

-rw-r--r--  1 marion  staff  490 Nov  8 04:58 /Users/marion/Downloads/BuildLoop/LoopConfigOverride.xcconfig

The addition of r where there used to be - on the left side, means you now have permission to read that file.

Final step is to return to Xcode and clean the build folder. Otherwise Xcode remembers it could not read the file and it won’t try again.

  1. From the Product menu (of Xcode), select Clean Build Folder
  2. Press the Build Button (play icon)

Cycle Dependency¶

This error is new with Xcode 13.3 (late Sep 2021) which has a new requirement

  • For those who care: the new requirement is that for a certain type of instruction file, the line with the Headers keyword must be located before the line with the Sources keyword
  • There used to be many repositories that did not have lines in that order
  • If you are seeing this error, you are building with an older copy and should consider updating

Error Message:

cycle dependencies error

Text in error:

  • Left window (the exact target names are not important):

    • Cycle in dependencies between targets . . .
  • Middle window:

    • Target build order preserved because “Build Order” is set to “Manual Order” in the scheme settings

Solution:

No need to quit Xcode – follow these steps using the Xcode Menu bar. (It’s possible that only Step 1 is required, but sometimes all steps are needed.)

  1. From the Product menu (of Xcode), select Clean Build Folder
  2. From the File menu, select Close Workspace
  3. From the File menu, select Open Recent and choose the top line
  4. Press the Build Button (play icon)

Entitlements Error¶

Error Message:

watchapp entitlements error

Text in error message can be either of these:

Entitlements file “WatchApp Extension.entitlements” was modified . . .

or

Entitlements file “Loop.entitlements” was modified . . .

Solution:

No need to quit Xcode – follow these numbered steps as indicated in the graphic below.

  1. Click on the Loop icon under PROJECT
  2. From the Product menu (of Xcode), select Clean Build Folder
  3. Press the Build Button (play icon)

Xcode screen showing updated entitlements fix

It turns out that

  • You can start building before indexing completes – just make sure it has started
  • The behavior causing this in Xcode has been reported to Apple

CompileAssetCatalog Error¶

This error is found when there is a space embedded in the path name to your LoopWorspace folder. The good news is that LoopWorkspace seems to be able to build from an iCloud or Dropbox drive.

CompileAssetCatalog error

Text in error message:

Command CompileAssetCatalog failed with a nonzero exit code. . .

Solution:

This is very similar to the steps for the WatchApp Entitlements Error but you need to repeat it for 2 targets: Loop and WatchApp – the graphic below matches the step numbers in the list.

  1. Click on Loop folder
  2. Click on Loop target
  3. Click on the General tab
  4. Click on the App Icons Source dropdown menu
  5. Click on the item already selected (the line will change from red to blank)

fix for CompileAssetCatalog error

  • Repeat the App Icons Source dropdown menu selection for the WatchApp target
  • (Optional) Clear the Build Error (Menu at top of Xcode: Select Product->Clean Build Folder)
  • Press build

Carthage Error¶

For older builds only. With Loop 3.2.0 and newer, the default selection is already LoopWorkspace.

You should not see carthage errors, but if you do, you probably did not select Loop (Workspace) at the top of the Xcode window. Review the graphic from the Prepare to Build Instructions.

Or maybe you are trying to build using an old download; some older versions did require carthage. Best practice is to download new code.

Error Message:

Wrong Version of Carthage Error

Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: one of -create, -thin , -extract , -remove , -replace , -verify_arch … , -archs, -info, or -detailed_info must be specified.

Solution: Download fresh code with Build Select Script.

Could Not Locate Device Support Files¶

Error Message: “Could not locate device support files.” That message is telling you that your iOS on the Loop phone requires you to get a newer version of Xcode to be able to build Loop onto that phone.

Solution: Update your Xcode version; this may also require a macOS update. Please review the phone iOS driven requirements for Xcode and macOS.

img/device-support-files.jpg

No Such Module ‘LoopKit’ or Similar Message¶

Error Message: If you see a Cartfile failure and several other red errors (in particular saying there is “no such module ‘LoopKit'”).

Solution: Read the Carthage Error section above.

Developer License Update (PLA Update)¶

Error message: “The Apple Developer Program License Agreement has been updated, In order to access certain membership resources, you must accept the latest license agreement”. Or you may see “Unable to process request – PLA Update available. You currently don’t have access to this membership resource. To resolve this issue, agree to the latest Program License Agreement in your developer account.”

Solution: You’ll need to log onto your developer account at developer.apple.com and accept the latest license agreement.

img/license.png

Could Not Get a Container Directory URL

Error message: “Could not get a container directory URL. Please ensure App Groups are set up correctly in entitlements.”

img/container-1.png

Solution: To resolve this error, you will need to click on the Loop target’s signing area and then the plus-sign in the App Groups area under the signing. Copy and paste the bundle indentifier into the new container that starts with group. and then add Group to the end of the name. Click OK to save. Note, the line will start with lower case group. followed by your bundle identifier and an upper case Group added to the end of the bundle identifier.

img/container-2.png

The final App Group should now have a blue check box, the name should start with group and end with LoopGroup. See the screenshot as an example. Click the build button after your App Group is setup similarly and you should be good.

img/container-3.png

Missing Command Line Tools¶

Error message: “Invalid active developer path (/Library/Developer/CommandLineTools)”

img/command-line-error-1.jpg

Solution: Go to your Xcode -> Preferences (or Settings) and under the Locations tab, select your Xcode version (the figure shows 14.0.1 – yours should match your Xcode version) in the dropdown menu for Command Line Tools.

img/command-line-error-3.png

Device Management Could Not Launch Loop¶

Error message: “Could not launch “Loop”. Verify the Developer App certificate for your account is trusted on your device. Open Settings and navigate to General -> Device Management, then select your Developer App certificate to trust it.”

img/trust_device.jpg

New Solution First try the Unpair and Reboot process above. If that doesn’t work, then try the solution listed below.

Solution: If you get this message and are unable to find the Device Management option in your phone settings, then we need to do a little extra step to clear out some old info.

  1. Plug the phone into the computer and open Xcode
  2. Click the “Window” menu item in Xcode and then choose “Devices and Simulators”
  3. Right click your phone on the left and pick “Show Provisioning Profiles”
  4. Delete all of the items in the list that have Loop in the name
  5. Go to your four signing targets and change the signing team back to “None” for a quick bit, and then change back to your regular signing team name again.
  6. Rebuild Loop

That should clear the out, problematic profiles and allow a successful build.

If your problem persists after that, then you might need to do total reset of your phone to clear out the pesky problem. Before you do this, you may want to Post for Help to make sure it is really necessary:

  1. Wipe the iPhone clean and set it up as a new device
    • FIRST – write down or screenshot all your settings
    • Pod users – you will have to start a fresh pod after this
    • If you want your old pod to continue giving you basal rate, don’t replace the pod before wiping your phone. Once the phone is reset and a new Loop app is added, you must start a new pod. The old pod should have the sound connection broken before being discarded because you won’t be able to deactivate the pod.
  2. Delete all certificates from your Developer account (you’ll need to login to your Developer account to do that)
  3. Delete your old Loop code download and get a new one.
  4. Rebuild Loop on the phone with the new download of Loop code.
  5. Start a new pod with the new Loop app on the reset phone.

Pending Certificate Request¶

Error message: “You already have a current iOS Development certificate or a pending certificate request.”

img/pending_certification_request.jpg

Solution: This error message has recently started to appear for some new Loop builders. To resolve the issue, please log in to your Developer account at developer.apple.com and then click on “Certificates, Identifiers & Profiles”. Under that screen, you will see “Development” under the “Certificates” section in the column on the left. You will need to click on the certificates, and choose “revoke” from the options that show after you click on the certificate. Confirm the warning message that will appear asking “Do you want to revoke the certificate?”

img/revoke1.png

After you do that, return to Xcode and open up Xcode -> Preferences (or Settings) and choose the Accounts tab. Highlight your Apple ID and click on the minus sign to delete your Apple ID.

img/account.png

Re-enter your Apple ID (yes…add that account right back that you literally just deleted), return to your Loop’s target signing areas in Xcode and your error message should have resolved as a new certificate will have been issued and a provisioning profile should have been created automatically.

You can verify the iOS development certificates are working by clicking on “Manage Certificates” in Xcode -> Preferences (or Settings), Accounts tab and viewing the iOS Development Certificates. You should have one for your account that has a clean status similar to the screenshot below.

img/verify_cert.png

Command CodeSign Failed¶

Error message: “errSecInternalComponent, Command CodeSign failed with a nonzero exit code”

img/errsecinternal.jpg

Solution: This error message is likely due to inadvertently saying “no” to allowing Keychain Access or changing your computer or AppleID password. Regardless, the solution is as follows:

  1. Close Xcode
  2. Open your Keychain Access application (found in Applications within the Utilities folder)
  3. In the upper left corner of keychain access, make sure you have the keychain login highlighted and then right-click the lock next to the login. Click the lock closed, and then click the lock to open it again. You will be prompted for a password. Enter your computer admin password. Close Keychain Access app.

img/keychain4.png

  1. Open your Loop project again in Xcode.
  2. In the main Xcode menu (grey menu bar at the very top of your Apple display area), select Product and then select the option for Clean. (Keyboard shortcut is Shift+Cmd+K)
  3. Now try rebuilding your Loop app. If you ever get prompted again to allow Xcode access to Keychain, make sure to click on the option to Always Allow.

Unrecognized Arguments¶

Error message: “Unrecognized arguments: –cache-builds”

img/cache-builds.png

img/exit-code-1-cartfile.jpg

Solution: This is a homebrew / carthage error, so I don’t think you’ll see this. If you do, download a fresh copy of Loop code and try again. If it repeats, it is time to request assistance. Please read Posting for Help.

Abort with Payload¶

Error message:Abort with payload” Your app will only open briefly with a white screen and then close, if you build with this error.

img/abort_payload.png

Solution: This error message is caused by having the Loop download folder in an iCloud mapped drive when doing the zip download. Move your Loop download folder back to the Downloads folder, then rebuild. LoopWorkspace builds with Xcode 13 appear to work fine with an iCloud drive. You may run into the spaces in your path name problem – which has a different solution.

Apple Watch Issues¶

Apple Watch: Loop App Not Appearing¶

Error: Apple watch app is not appearing.

Solution: This error usually appears because you have not updated the watchOS prior to building Loop, or you didn’t have your Apple watch paired at the time of building Loop.

Don’t forget to open the iPhone’s Watch app, select My Watch tab on the bottom left, scroll all the way down, and click Install for the Loop app listed at the very bottom under “available apps”.

Apple Watch: Loop App Not Installing¶

Before trying this solution, see if the Unpair and Reboot procedure works.

Error: The Loop app appears on the list of apps available to install on the watch, but when you press “install”, and it goes through the animation of filling in the circle while it’s installing, but then at the end it just toggles back to saying “INSTALL”.

Solution: Plug your iPhone into the computer and start Xcode. On your watch, look for a prompt that says “Trust this computer”. Scroll down on the watch face and select the “Trust” button. In Xcode, go to the top menu bar and select “Clean Build Folder” from the Product menu option, and then rebuild your Loop app.

If the watch app still fails to install properly, the next section should work.

Apple Watch: Loop App Not Running on Watch¶

Error: Tapping the Loop app icon on the watch results in flash of the watch screen and then return to the Loop app icon or a brief display of the watch interface and then return to the Loop app icon.

Solution: Plug in your iPhone, with the watch already paired, into the computer and start Xcode with your current build folder. In Xcode, from the list of schemes where you normally choose Loop (Workspace) (with Loop 3.2.x and newer, LoopWorkspace is the default), choose the WatchApp scheme (near the bottom of the list) and then select your watch (not a simulator) from the device list, see the graphics below. Press the play button to build and deploy the WatchApp directly to your watch. It will launch correctly and will not crash when you subsequently launch it from the complication or your watch Home Screen..

xcode screen display the selection for direct build of watchapp

additional details for the direct build of watchapp

Warning: Make sure your watchOS is up to date with respect to your phone iOS. If not, you may need to update to be successful. On pressing clicking build/play, some people report receiving an error stating “iPhone/Apple Watch are ineligible because the OS on the watch doesn’t support WatchKit App Products” or similar wording. This is a known issue with some Mac USB ports. Fixes in preference order are: 1) swap which USB port is in use; 2) unplug and replug the USB cable from both the iPhone and Mac; or 3) as a last resort, reboot the iPhone and Mac.

Don’t forget to select Loop(Workspace) after building to the watch before trying to build to a phone.

I’m trying to implement a simple Newton’s method iterative solver using Excel VB (I have never used VB.)

I keep getting the error loop without a Do and I can’t figure out what I’m doing wrong here.

I’m trying to find the roots of the function z^3 - z^2 - (B^2 + B - A)z - A*B called the compressibility factor.

My source MSN

Function zCalculation(ByVal temp As Double, ByVal press As Double) As Double

Dim tempCr As Double
Dim pressCr As Double
Dim A As Double
Dim B As Double

tempCr = temp / 238.5

pressCr = press / 547.424092

A = pressCr / tempCr
A = A / (9 * (2 ^ (1 / 3) - 1))
B = pressCr / tempCr
B = B * (2 ^ (1 / 3) - 1) / 3



Dim zNot As Double
Dim counter As Integer
counter = 0
zNot = 1#

Do
    counter = counter + 1

    zNot = zNot - (zNot ^ 3 - zNot ^ 2 - (B ^ 2 + B - A) * zNot - A * B) / (3 * zNot ^ 2 - 2 * zNot - (B ^ 2 + B - A))
    If counter > 1000 Then
       Exit Do

Loop Until eval(zNot, A, B) < 0.000001


zCalculation = zNot


End Function

break

Function eval(ByVal z As Double, ByVal A As Double, ByVal B As Double) As Double

    eval = z ^ 3 - z ^ 2 - (B ^ 2 + B - A) * z - A * B

End Function

Community's user avatar

asked Dec 9, 2013 at 16:58

Felix Castor's user avatar

Felix CastorFelix Castor

1,5381 gold badge18 silver badges39 bronze badges

You need an:

End If

in your code.

answered Dec 9, 2013 at 17:04

Gary's Student's user avatar

Gary’s StudentGary’s Student

95.4k9 gold badges58 silver badges99 bronze badges

2

You can try:

 Function zCalculation(ByVal temp As Double, ByVal press As Double) As Double

  Dim tempCr As Double
  Dim pressCr As Double
  Dim A As Double
  Dim B As Double

  tempCr = temp / 238.5

  pressCr = press / 0.546789

  A = pressCr / tempCr
  A = A / (9 * (2 ^ (1 / 3) - 1))
  B = pressCr / tempCr
  B = B * (2 ^ (1 / 3) - 1) / 3



  Dim zNot As Double
  Dim counter As Integer
  counter = 0
  zNot = 1#

  Do
      counter = counter + 1

      zNot = zNot - (zNot ^ 3 + zNot ^ 2 - (B ^ 2 + B - A) * zNot - A * B) / (3 * zNot ^ 2 + 2 * zNot - (B ^ 2 + B - A))
      If counter > 1000 Then
         Exit Do
      End if  ' <--- Here

  Loop Until eval(zNot, A, B) < 0.000001

  zCalculation = zNot
 End Function

answered Dec 9, 2013 at 17:06

Makah's user avatar

1

Sub datacalculationsandformat()
Dim row As Integer
row = 2
Do While Cells(row, 2) <> ""
Cells(row, 3).Value = Cells(row, 2).Value * 0.3
Cells(row, 4).Value = Cells(row, 2) * 0.1
Cells(row, 5).Value = Cells(row, 2).Value + Cells(row, 3).Value + Cells(row, 4).Value
If Cells(row, 5).Value >= 8000 Then
Worksheets("Sheet1").Cells(row, 5).Font.Bold = True
row = row + 1
Loop

slavoo's user avatar

slavoo

5,76864 gold badges36 silver badges39 bronze badges

answered Sep 21, 2017 at 5:11

user8646115's user avatar

Добавить комментарий