After updated Xcode 13, react-native run-ios command is not working successfully in my project.
When I run that command, Successfully launched the app on the simulator is shown in the terminal. no error message. The application is not built well and can't open.
But I can run successfully with Xcode.
My react-native version is "0.61.5". Anyone facing issues like me?
I had a similar problem. Though I had react-native version 59.10.
Solution was to use patch-package to alter react-native fishhook.c file:
`diff --git a/node_modules/react-native/Libraries/fishhook/fishhook.c
b/node_modules/react-native/Libraries/fishhook/fishhook.c
index 205ee82..d580178 100755
--- a/node_modules/react-native/Libraries/fishhook/fishhook.c
+++ b/node_modules/react-native/Libraries/fishhook/fishhook.c
## -21,15 +21,20 ##
-#import "fishhook.h"
+#include "fishhook.h"
-#import <dlfcn.h>
-#import <stdlib.h>
-#import <string.h>
-#import <sys/types.h>
-#import <mach-o/dyld.h>
-#import <mach-o/loader.h>
-#import <mach-o/nlist.h>
+#include <dlfcn.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <mach/mach.h>
+#include <mach/vm_map.h>
+#include <mach/vm_region.h>
+#include <mach-o/dyld.h>
+#include <mach-o/loader.h>
+#include <mach-o/nlist.h>
#ifdef __LP64__
typedef struct mach_header_64 mach_header_t;
## -76,6 +81,36 ## static int prepend_rebindings(struct rebindings_entry **rebindings_head,
return 0;
}
+#if 0
+static int get_protection(void *addr, vm_prot_t *prot, vm_prot_t
*max_prot) {
+ mach_port_t task = mach_task_self();
+ vm_size_t size = 0;
+ vm_address_t address = (vm_address_t)addr;
+ memory_object_name_t object;
+#ifdef __LP64__
+ mach_msg_type_number_t count = VM_REGION_BASIC_INFO_COUNT_64;
+ vm_region_basic_info_data_64_t info;
+ kern_return_t info_ret = vm_region_64(
+ task, &address, &size, VM_REGION_BASIC_INFO_64,(vm_region_info_64_t)&info, &count, &object);
+#else
+ mach_msg_type_number_t count = VM_REGION_BASIC_INFO_COUNT;
+ vm_region_basic_info_data_t info;
+ kern_return_t info_ret = vm_region(task, &address, &size, VM_REGION_BASIC_INFO, (vm_region_info_t)&info, &count, &object);
+#endif
+ if (info_ret == KERN_SUCCESS) {
+ if (prot != NULL)
+ *prot = info.protection;
+
+ if (max_prot != NULL)
+ *max_prot = info.max_protection;
+
+ return 0;
+ }
+
+ return -1;
+}
+#endif
+
## -84,6 +119,7 ## static void perform_rebinding_with_section(struct rebindings_entry *rebindings,
uint32_t *indirect_symtab) {
uint32_t *indirect_symbol_indices = indirect_symtab + section->reserved1;
void **indirect_symbol_bindings = (void **)((uintptr_t)slide + section->addr);
+
for (uint i = 0; i < section->size / sizeof(void *); i++) {
uint32_t symtab_index = indirect_symbol_indices[i];
if (symtab_index == INDIRECT_SYMBOL_ABS || symtab_index == INDIRECT_SYMBOL_LOCAL ||
## -92,18 +128,33 ## static void perform_rebinding_with_section(struct rebindings_entry *rebindings,
}
uint32_t strtab_offset = symtab[symtab_index].n_un.n_strx;
char *symbol_name = strtab + strtab_offset;
- if (strnlen(symbol_name, 2) < 2) {
- continue;
- }
+ bool symbol_name_longer_than_1 = symbol_name[0] && symbol_name[1];
struct rebindings_entry *cur = rebindings;
while (cur) {
for (uint j = 0; j < cur->rebindings_nel; j++) {
- if (strcmp(&symbol_name[1], cur->rebindings[j].name) == 0) {
- if (cur->rebindings[j].replaced != NULL &&
- indirect_symbol_bindings[i] != cur->rebindings[j].replacement) {
+ if (symbol_name_longer_than_1 && strcmp(&symbol_name[1], cur->rebindings[j].name) == 0) {
+ kern_return_t err;
+
+ if (cur->rebindings[j].replaced != NULL && indirect_symbol_bindings[i] != cur->rebindings[j].replacement)
*(cur->rebindings[j].replaced) = indirect_symbol_bindings[i];
+
+ /**
+ * 1. Moved the vm protection modifying codes to here to reduce the
+ * changing scope.
+ * 2. Adding VM_PROT_WRITE mode unconditionally because vm_region
+ * API on some iOS/Mac reports mismatch vm protection attributes.
+ * -- Lianfu Hao Jun 16th, 2021
+ **/
+ err = vm_protect (mach_task_self (),(uintptr_t)indirect_symbol_bindings, section->size, 0, VM_PROT_READ | VM_PROT_WRITE | VM_PROT_COPY);
+ if (err == KERN_SUCCESS) {
+ /**
+ * Once we failed to change the vm protection, we
+ * MUST NOT continue the following write actions!
+ * iOS 15 has corrected the const segments prot.
+ * -- Lionfore Hao Jun 11th, 2021
+ **/
+ indirect_symbol_bindings[i] = cur->rebindings[j].replacement;
}
- indirect_symbol_bindings[i] = cur->rebindings[j].replacement;
goto symbol_loop;
}
}
## -187,6 +238,9 ## int rebind_symbols_image(void *header,
struct rebindings_entry *rebindings_head = NULL;
int retval = prepend_rebindings(&rebindings_head, rebindings, rebindings_nel);
rebind_symbols_for_image(rebindings_head, (const struct mach_header *) header, slide);
+ if (rebindings_head) {
+ free(rebindings_head->rebindings);
+ }
free(rebindings_head);
return retval;
}
`
Source: https://github.com/facebook/fishhook/pull/87/files
Related
I am making a POST request with DirectX Backbuffer copy of a character. It's basically a screenshot that is cropped and sent over HTTPS. Here is the C++ code using httplib.h (with SSL) in my game client that is triggered on login and logout:
#ifdef __AZURIOM_IMAGES
if (m_Azuriom_SaveAvatar) {
LPCSTR token = g_dpCertified.GetAzuriomAccessToken();
IDirect3DSurface9* pDestTarget;
CRect rectCtrl;
rectCtrl.top = this->m_rectClient.top + lpFace->rect.top;
rectCtrl.bottom = this->m_rectClient.top + lpFace->rect.bottom;
rectCtrl.left = this->m_rectClient.left + lpFace->rect.left;
rectCtrl.right = this->m_rectClient.left + lpFace->rect.right;
pd3dDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_FORCE_DWORD, &pDestTarget);
LPD3DXBUFFER buffer;
D3DXSaveSurfaceToFileInMemory(&buffer, D3DXIFF_PNG, pDestTarget, NULL, &rectCtrl);
httplib::SSLClient cli(AZURIOM_WEBSITE, AZURIOM_WEBSITE_PORT);
httplib::Headers headers = {
{ "Content-Type", "multipart/form-data"},
{ "Accept", "application/json"}
};
httplib::MultipartFormDataItems items = {
{ "access_token", token},
{ "avatar", std::string((char*)buffer->GetBufferPointer(), buffer->GetBufferSize()), pMover->GetName(), "image/png"},
{ "playerName", pMover->GetName()}
};
auto res = cli.Post("/api/flyff/upload_avatar", headers, items);
std::cout << res;
buffer->Release();
m_Azuriom_SaveAvatar = FALSE;
}
#endif
I go to my apache2 Logs and see this in the access.log file when I Login and out of the game:
192.168.1.2 - - [21/Dec/2022:12:22:05 -0600] "POST /api/flyff/upload_avatar HTTP/1.1" 422 42
I go to debug the game...this is what I get in the debugger:
- headers { size=2 } std::multimap<std::string,std::string,httplib::detail::ci,std::allocator<std::pair<std::string const ,std::string>>>
+ [comparator] {...} std::_Compressed_pair<httplib::detail::ci,std::_Compressed_pair<std::allocator<std::_Tree_node<std::pair<std::string const ,std::string>,void *>>,std::_Tree_val<std::_Tree_simple_types<std::pair<std::string const ,std::string>>>,1>,1>
+ [allocator] allocator std::_Compressed_pair<std::allocator<std::_Tree_node<std::pair<std::string const ,std::string>,void *>>,std::_Tree_val<std::_Tree_simple_types<std::pair<std::string const ,std::string>>>,1>
+ ["Accept"] "application/json" std::pair<std::string const ,std::string>
+ ["Content-Type"] "multipart/form-data" std::pair<std::string const ,std::string>
+ [Raw View] {...} std::multimap<std::string,std::string,httplib::detail::ci,std::allocator<std::pair<std::string const ,std::string>>>
- items { size=3 } std::vector<httplib::MultipartFormData,std::allocator<httplib::MultipartFormData>>
[capacity] 3 unsigned int
+ [allocator] allocator std::_Compressed_pair<std::allocator<httplib::MultipartFormData>,std::_Vector_val<std::_Simple_types<httplib::MultipartFormData>>,1>
+ [0] {name="access_token" content="" filename="" ...} httplib::MultipartFormData
+ [1] {name="avatar" content="臼NG\r\n\x1a\n" filename="Ling" ...} httplib::MultipartFormData
+ [2] {name="playerName" content="Ling" filename="" ...} httplib::MultipartFormData
+ [Raw View] {_Mypair=allocator } std::vector<httplib::MultipartFormData,std::allocator<httplib::MultipartFormData>>
I want to make this 422 error go away...and just upload the image.
When I jump from FREERTOS App1 To FreeRTOS App2 the program is stuck in the default handler.
FreeRTOS App1 boundary - 0x0 To 0x14000
FreeRTOS App2 boundary - 0x15000 To 0x30000
#define FAPP2_ADDRESS ((uint32_t)0x15000)
#define FAPP2_SIZE ((uint32_t)0x15000)
#define MSP_SPMPU (0)
#define PSP_SPMPU (1)
void app_jumpTo(uint32_t jumpLocation)
{
if (jumpLocation != 0xFFFFFFFF)
{
__set_MSP (*(uint32_t*) jumpLocation);
__set_PC (*(uint32_t*) (jumpLocation + 4));
}
}
void jump_to_app2(void)
{
xTimerStop(g_rtos_timer0, 0);
R_IOPORT_Close (&g_ioport_ctrl);
__disable_irq ();
memset ((uint32_t*) NVIC->ICER, 0xFF, sizeof(NVIC->ICER));
memset ((uint32_t*) NVIC->ICPR, 0xFF, sizeof(NVIC->ICPR));
SysTick->CTRL = 0;
SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk;
SCB->VTOR = (uint32_t) FAPP2_ADDRESS;
/* Disable the HW Stack monitor for MSP and PSP */
R_MPU_SPMON->SP[MSP_SPMPU].PT = 0xA500;
R_MPU_SPMON->SP[PSP_SPMPU].PT = 0xA500;
R_MPU_SPMON->SP[MSP_SPMPU].CTL = 0x0000;
R_MPU_SPMON->SP[PSP_SPMPU].CTL = 0x0000;
//Jump to our application entry point
app_jumpTo ((uint32_t) FAPP2_ADDRESS);
}
Fault Status Windows shows
HFSR 0x40000000
MMFSR 0x0
UFSR 0x2
#include<stdio.h>
#include<conio.h>
#define FIRST_PART 7
#define LAST_PART 5
#define ALL_PARTS FIRST_PART+LAST_PART
int main()
{
printf ("The Square root of all parts is %d", ALL_PARTS * ALL_PARTS) ;
getch();
return(0);
}
In the above code the FIRST_PART is defined as 7
LAST_PART is defined as 5
and ALL_PARTS is initialized as FIRST_PART+LAST_PART (which is ideally 12)
but when i am printing ALL_PARTS * ALL_PARTS is giving me 47 as the output!(But i thought answer would be 144)
Please can anyone explain me how ?
The answer should be 47
FIRST_PART + LAST_PART * FIRST_PART + LAST_PART
MULTIPLICATION HAS MORE PRECEDENCE
SO 7 + 5 * 7 + 5
7 + 35 + 5
47
very new to the site
i have delphi pos
and want to add bar code to the tillslip template the bar code need to be at the bottom of the page and it will be the document ID
the barcode need to be EAN 128
HEADER]
SELECT * FROM SALES_TRANSACTION_HEADER
JOIN STORES ON (ST_ID=TH_STORE_ID)
LEFT OUTER JOIN USERS ON (US_STORE_ID=TH_STORE_ID AND US_ID=TH_USER_ID)
WHERE TH_ID=?DOCUMENT_ID AND TH_STORE_ID=?STORE_ID AND TH_TYPE=?DOCUMENT_TYPE
DETAIL]
SELECT * FROM SALES_TRANSACTION_DETAIL
JOIN PRINTER_CATEGORY ON (PRC_STORE_ID=?THIS_STORE_ID AND PRC_WORKSTATION_ID=?THIS_WORKSTATION_ID AND PRC_PRINTER_ID=?THIS_PRINTER_ID AND PRC_CATEGORY_ID=TD_CATEGORY_ID1)
JOIN STORES ON (ST_ID=TD_STORE_ID)
LEFT OUTER JOIN SALES_REPS ON (SR_ID=TD_SALESREP_ID AND ((ST_GLOBAL_REPS = 0 AND SR_STORE_ID=TD_STORE_ID) OR (ST_GLOBAL_REPS 0 AND SR_STORE_ID=(SELECT ST_ID FROM STORES WHERE ST_TYPE = 2))))
WHERE TD_DOCUMENT_ID=?DOCUMENT_ID AND TD_STORE_ID=?STORE_ID AND TD_TYPE=?DOCUMENT_TYPE
[SQL_PAYMENT]
SELECT * FROM SALES_TRANSACTION_PAYMENT
LEFT OUTER JOIN TENDER_TYPES ON (TT_ID=TP_TENDER_ID)
WHERE TP_DOCUMENT_ID=?DOCUMENT_ID AND TP_STORE_ID=?STORE_ID AND TP_TYPE=?DOCUMENT_TYPE
[HEADER]
+
+[PRINTLOGO]
+
+ TAX INVOICE
+
+CASH SALE
+Document ID: ~0ddddddd;
!TH_ID
#IF !TH_PRINTED_COUNT THEN
+ COPY ~D
!TH_PRINTED_COUNT
#ELSE
+
#ENDIF
+~SSSSSSSSS ~SSSSSSS
!TH_TRANSACTION_DATE,!TH_TRANSACTION_TIME
+
+~SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
!ST_COMPANYNAME
#IF !ST_PHYSICALADDR1 THEN
+~SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
!ST_PHYSICALADDR1
#ENDIF
#IF !ST_PHYSICALADDR2 THEN
+~SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
!ST_PHYSICALADDR2
#ENDIF
#IF !ST_PHYSICALADDR3 THEN
+~SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
!ST_PHYSICALADDR3
#ENDIF
#IF !ST_PHYSICALADDR4 THEN
+~SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
!ST_PHYSICALADDR4
#ENDIF
#IF !ST_PHYSICALADDR5 THEN
+~SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
!ST_PHYSICALADDR5
#ENDIF
#IF !ST_TELEPHONE1 THEN
+
+Telephone: ~SSSSSSSSSSSSSSSSSSS
!ST_TELEPHONE1
#ENDIF
#IF !ST_FAX THEN
+ Fax: ~SSSSSSSSSSSSSSSSSSS
!ST_FAX
#ENDIF
#IF !ST_TAX_NUMBER THEN
+VAT Reg #: ~SSSSSSSSSSSSSSSSSSSSSSS
!ST_TAX_NUMBER
#ENDIF
#IF !TH_CUSTOMER_NAME THEN
+
+To:~SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
!TH_CUSTOMER_NAME
#ENDIF
#IF !TH_ADDRESS_1 THEN
+ ~SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
!TH_ADDRESS_1
#ENDIF
#IF !TH_ADDRESS_2 THEN
+ ~SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
!TH_ADDRESS_2
#ENDIF
#IF !TH_ADDRESS_3 THEN
+ ~SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
!TH_ADDRESS_3
#ENDIF
#IF !TH_ADDRESS_4 THEN
+ ~SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
!TH_ADDRESS_4
#ENDIF
#IF !TH_ADDRESS_5 THEN
+ ~SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
!TH_ADDRESS_5
#ENDIF
#IF !TH_TELEPHONE THEN
+Telephone: ~SSSSSSSSSSSSSSSSSSS
!TH_TELEPHONE
#ENDIF
#IF !TH_ACCOUNTCODE THEN
+Account No: ~SSSSSSSSSSSSSSSSSSS
!TH_ACCOUNTCODE
#ENDIF
#IF !TH_EXEMPT_TAX_NUMBER THEN
+Tax Number:~SSSSSSSSSSSSSSSSSSSS
!TH_EXEMPT_TAX_NUMBER
#ENDIF
#IF !TH_ORDER_NUMBER THEN
+Order Number:~SSSSSSSSSSSSSSSSSSSS
!TH_ORDER_NUMBER
#ENDIF
+
+Description Unit
+Item Code Price Qty Nett
+---------------------------------------
[DETAIL]
#IF (!TD_ITEMTYPE 3) THEN
+~SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
!TD_DESCRIPTION
#ELSE
+~SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
!TD_DESCRIPTION
#ENDIF
+~SSSSSSSSSSSSSSS ~fff.ff ~ff.q ~ffff.ff;
!TD_PRODUCTCODE,!TD_RETAIL_PRICE,!TD_QTY,!TD_LINE_VALUE
#IF !TD_LINE_TAX_ID = 0 THEN
+*;
#ELSEIF !TD_LINE_TAX_ID = 2 THEN
+#;
#ENDIF
+
#IF !TD_DISCOUNT_AMOUNT 0 THEN
+ Discount on above line ~ffff.ff
!TD_DISCOUNT_AMOUNT
#ENDIF
#IF (!TD_ITEMTYPE = 2) AND (!TD_COLOUR_PACK_SERIAL '') THEN
+Colour/Size:~SSSSSSSSSSSSSSSSSSSSSSSSS
!TD_COLOUR_PACK_SERIAL
#ENDIF
#IF (!TD_ITEMTYPE = 3) AND (!TD_COLOUR_PACK_SERIAL '') THEN
+Serial #:~SSSSSSSSSSSSSSSSSSSSSSSSSSSS
!TD_COLOUR_PACK_SERIAL
#ENDIF
$COUNT=0
#WHILE $COUNT
[SUMMARY]
+---------------------------------------
#IF !TH_TRANSACTION_TAX_TYPE THEN
+ SUB-TOTAL: ~ffffffff.ff
!TH_TRANSACTION_TOTAL - !TH_TRANSACTION_TAX - !TH_ADMIN_FEE + !TH_OVERALL_DISCOUNT + !TH_ROUNDING_LOSS
#ELSEIF (!TH_ADMIN_FEE 0) OR (!TH_OVERALL_DISCOUNT 0) OR (!TH_ROUNDING_LOSS 0) THEN
+ SUB-TOTAL: ~ffffffff.ff
!TH_TRANSACTION_TOTAL - !TH_ADMIN_FEE + !TH_OVERALL_DISCOUNT + !TH_ROUNDING_LOSS
#ENDIF
#IF !TH_OVERALL_DISCOUNT THEN
+ ~sssssssssssssssssss: ~ffffffff.ff
'DISCOUNT (' + !TH_OVERALL_PERCENT + '%)', -!TH_OVERALL_DISCOUNT
#ENDIF
#IF !TH_ADMIN_FEE THEN
+ ADMIN CHARGE: ~ffffffff.ff
!TH_ADMIN_FEE
#ENDIF
#IF !TH_TRANSACTION_TAX_TYPE THEN
+ VAT: ~ffffffff.ff
!TH_TRANSACTION_TAX
#ELSE
+ VAT INCLUDED: ~ffffffff.ff
!TH_TRANSACTION_TAX
#ENDIF
#IF !TH_ROUNDING_LOSS 0 THEN
+ ROUNDING LOSS: ~ffffffff.ff
-!TH_ROUNDING_LOSS
#ENDIF
#IF (!TH_TRANSACTION_TAX_TYPE > 0) OR (!TH_ADMIN_FEE 0) OR (!TH_OVERALL_DISCOUNT 0) OR (!TH_ROUNDING_LOSS 0) THEN
+ ------------
#ENDIF
+ TOTAL: ~ffffffff.ff
!TH_TRANSACTION_TOTAL
#IF !TH_DEPOSIT_AMOUNT THEN
+ LESS DEPOSIT: ~ffffffff.ff
-!TH_DEPOSIT_AMOUNT
+ TOTAL AFTER DEPOSIT: ~ffffffff.ff
!TH_TRANSACTION_TOTAL - !TH_DEPOSIT_AMOUNT
#ENDIF
+ ------------
#IF $PAYMENTCOUNT > 0 THEN
$CHANGE = 0
$COUNTER = 0
&FIRSTPAYMENT
#WHILE $COUNTER 0 THEN
+~ssssssssssssssssssssssss: ~ffffffff.ff
!TT_NAME + ' CHANGE', -!TP_AMOUNT
#IF !TP_NUMBER THEN
+~ssssssssssssssssssssssssssssssssssssss
!TT_NAME + ' #: ' + !TP_NUMBER
#ENDIF
#ENDIF
$COUNTER = $COUNTER + 1
&NEXTPAYMENT
#ENDWHILE
#ENDIF
[FOOTER]
+---------------------------------------
+User: ~SSSSSSSSSSSSSSSSSSSSSSS Wks: ~DD
!US_NAME, !TH_WORKSTATION_ID
+ Rep: ~SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
!DETAIL.SR_NAME
#IF !TH_OUR_REFERENCE '' THEN
+ Our Reference: ~SSSSSSSSSSSSSSSSSSSSSS
!TH_OUR_REFERENCE
#ENDIF
#IF !TH_YOUR_REFERENCE '' THEN
+Your Reference: ~SSSSSSSSSSSSSSSSSSSSSS
!TH_YOUR_REFERENCE
#ENDIF
#IF $MESSAGE1 THEN
+~SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
$MESSAGE1
#ENDIF
#IF $MESSAGE2 THEN
+~SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
$MESSAGE2
#ENDIF
#IF $MESSAGE3 THEN
+~SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
$MESSAGE3
#ENDIF
#IF $MESSAGE4 THEN
+~SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
$MESSAGE4
#ENDIF
#IF $MESSAGE5 THEN
+~SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
$MESSAGE5
#ENDIF
I am processing raw IP data to process a video signal (ATSC-MH). However, I am having issues with some basic issue and I'm apparently fried at the moment and need another set of eyes.
This is the function that flips. Funny part is that it was working for a while and I can't rememeber what I changes. The line that is **d is the one that is referred to in the error log. I can't do much NSLog debugging because the stream comes from an accessory(so no direct debugging pipe :().
-(NSString*)reportSMT{
//NSString* ret = #"Not implemented yet";
__autoreleasing NSMutableString* ret = [[NSMutableString alloc] initWithFormat:#"\nSMT:\n SecSynInd:%# PriInd:%#\n SecLen:%d SMTMHProVer:%d\n EnID:%d VerNum:%d\n CurNxtInd:%# SecNum:%d\n lastSec#:%d #Servs:%d\n\n",(Header.section_syntax_indicator?#"YES":#"NO"),(Header.private_indicator?#"YES":#"NO"),Header.section_length,Header.SMT_MH_protocol_version,Header.ensemble_id,Header.version_number,(Header.current_next_indicator?#"YES":#"NO"), Header.section_number,Header.last_section_number,Header.num_MH_services];
[ret appendString:[NSString stringWithFormat:#"SMT Table:\n"]];
for (int i = 0; i<Header.num_MH_services; i++) {
**[ret appendString:[NSString stringWithFormat:#"Serv(%d):\n ServID:%d MultiEnServ:%d\n ServStat:%d ServSPInd:%#\n ServShotName:%#\n ServCat:%d\n source:%# dest:%#\n #MHServComps:%d\n",i,Services[i].MH_service_id,Services[i].multi_ensemble_service,Services[i].MH_service_status,(Services[i].SP_indicator?#"YES":#"NO"),[NSString stringWithUTF8String:(char*)Services[i].short_MH_service_name],(Services[i].service_source_IP_address_flag?[Utility ParseIP:Services[i].service_source_IP_address]:#"N/A"),(Services[i].service_destination_IP_address_flag?[Utility ParseIP:Services[i].service_destination_IP_address]:#"N/A"),Services[i].num_components]];**
for (int m=0; m<Services[i].num_components; m++) {
[ret appendString:[NSString stringWithFormat:#" Comp(%d)(essential:%#):\n port#count:%d compSource:%#\n compDest:%# destPort:%d\n",m,(Services[i].components[m].essential_component_indicator?#"YES":#"NO") ,Services[i].components[m].port_num_count,(Services[i].components[m].component_source_IP_address_flag?[Utility ParseIP:Services[i].components[m].component_source_IP_address]:#"N/A"),(Services[i].components[m].component_destination_IP_address_flag?[Utility ParseIP:Services[i].components[m].component_destination_IP_address]:#"N/A"),Services[i].components[m].component_destination_UDP_port_num]];
}
}
return [ret copy];
}
Here is that Utility parseIP function. Though it didn't change anything to comment the call to it and hardcode a value there:
+(NSString*)ParseIP:(long)ip{
__autoreleasing NSString* ret = nil;
if (ip) {
unsigned char* ipPtr = (unsigned char*)&ip;
unsigned char ipc[4];
for (int i=0; i<4; i++) {
ipc[i] = *(ipPtr+i);
}
ret = [NSString stringWithFormat:#"(%d.%d.%d.%d)",ipc[3],ipc[2],ipc[1],ipc[0]];
}
return ret;
}
Here is the structure for that part of the SMT:
struct SMTChunk{
unsigned int MH_service_id;//16
unsigned char multi_ensemble_service;//2
unsigned char MH_service_status;//2
bool SP_indicator;//1
unsigned char short_MH_service_name_length;//3 /* m */
unsigned char* short_MH_service_name;//16*m
unsigned char reserved2;//2 should be 11
unsigned char MH_service_category;//6
unsigned char num_components;//5
bool IP_version_flag;//1
bool service_source_IP_address_flag;//1
bool service_destination_IP_address_flag;//1
unsigned long service_source_IP_address;//32 if (service_source_IP_address_flag)
unsigned long service_destination_IP_address;//32 if (service_destination _IP_address_flag)
struct SMTComponent* components;
unsigned char reserved4;//4 1111(f)
unsigned char num_MH_service_level_descriptors;//4
struct SMTServiceDescriptor* descriptors;
};
Like I said this was working before, so I'm pretty sure the parser that fills the data structure is fine.
Device Log(important part):
Date/Time: 2012-03-06 00:56:40.480 -0600
OS Version: iPhone OS 5.0.1 (9A405)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000a
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x300e4fb6 objc_msgSend + 10
1 Foundation 0x30dd9d14 _NSDescriptionWithLocaleFunc + 44
2 CoreFoundation 0x335d699e __CFStringAppendFormatCore + 7998
3 CoreFoundation 0x33551210 _CFStringCreateWithFormatAndArgumentsAux + 68
4 Foundation 0x30dd9c3e +[NSString stringWithFormat:] + 54
5 APT-test 0x000c9630 -[SMT reportSMT] (SMT.m:178)
6 APT-test 0x000c54bc -[VideoViewController saveTimerFun:] (VideoViewController.mm:940)
7 Foundation 0x30e79616 __NSFireTimer + 138
It feels like I've been working on this app forever so any help or pointers you can give are welcome.
Thanks in advance!
The printf wildcards and arguments do not appear to be balanced properly:
[NSString stringWithFormat:#"1%d 2%d 3%d 4%d 5%# 6%# 7%d 8%# 9%# A%d",
/* 1 */i,
/* 2 */Services[i].MH_service_id,
/* 3 */Services[i].multi_ensemble_service,
/* 4 */Services[i].MH_service_status,
/* 5 */(Services[i].SP_indicator?#"YES":#"NO"),
/* 6 */[NSString stringWithUTF8String:(char*)Services[i].short_MH_service_name],
/* 7 */(Services[i].service_source_IP_address_flag?[Utility ParseIP:Services[i].service_source_IP_address]:#"N/A"),
/* 8 */(Services[i].service_destination_IP_address_flag?[Utility ParseIP:Services[i].service_destination_IP_address]:#"N/A"),
/* 9 */Services[i].num_components]];
It looks like you’re trying to match the %# specifier at position 9 with Services[i].num_components, which is quite probable to result in EXC_BAD_ACCESS. You would do best to rewrite the code so that it’s more readable, this mess is only asking for trouble.