Xcode Sanitizers and Runtime Issues

RSS for tag

Xcode Runtime Issues are reports of programming errors found at run time. Issues can be found by variety of tools, including Address Sanitizer (ASan), Main Thread Checker (MTC), Thread Sanitizer (TSan), and Undefined Behavior Sanitizer (UBSan).

Posts under Xcode Sanitizers and Runtime Issues tag

195 Posts

Post

Replies

Boosts

Views

Activity

How to use animation in iOS15?
I used animation in these codes, and there was warning like "'animation' was deprecated in iOS 15.0: Use withAnimation or animation(_:value:) instead." I am beginner, so please tell me how to fix it specifically. struct ContentView: View {     @State var image: Image?     @State var isPicking = false     var body: some View {         ZStack {             VStack {                 VStack {                         Spacer()                         image?                             .resizable()                             .scaledToFit()                         Spacer()                     }                 HStack {                     Spacer()                     Button(action: {                         self.isPicking = true                     }) {                         Image(systemName: "camera")                         Text("カメラ")                     }.padding()                 }             }             if isPicking {                 ImagePicker()                     .edgesIgnoringSafeArea(.all)                     .transition(.move(edge: .bottom))                     .animation(.easeInOut)             }         }     } } struct ContentView_Previews: PreviewProvider {     static var previews: some View {         ContentView()     } }
2
0
1.7k
Feb ’22
Xcode 13.2.1 version getting slim-build-frameworks.sh No such file or directory error
Hi, I am trying to do Flutter Run and I am keep getting this error bin/slim-build-frameworks.sh: No such file or directory command PhaseScriptExecution failed with a nonzero exit code error. This command used to work for me not, I am still in the learning phase of Flutter, any help is appreciated. If you need any further details please let me know.
1
0
600
Feb ’22
Unable to Start PacketTunnel Provider
While generating the Xcode build with Address Sanitizer enabled, I am unable to launch the PacketTunnelProvider provider. The process is getting killed by the Operating System with the below exception "Thread 1: EXC_RESOURCE RESOURCE_TYPE_MEMORY (limit=50 MB, unused=0x0)" I understood that since Packettunnel Provider extension has only a memory limit of 50 MB, Operating System is killing the process. Is there any other way, we can overcome this limitation and perform Address Sanitizer testing ?
1
0
1.4k
Feb ’22
boringssl_metrics_log_metric_block_invoke(151) Failed to log metrics
Just Created one Login screen and its UI, UI is custom reads all properties from the local JSON file, like color, button shape, background color, icon URL, etc. Used one Framework which I have created for my UI, and just drag and drop that framework (No API calls in that Framework) but when I run my project my UI gets stuck, Not able to click any button or text field. and I am getting the following error boringssl_metrics_log_metric_block_invoke(151) Failed to log metrics  also, My CPU use is 100% and my app is getting stuck (see screenshot) Memory is increasing to 6 to 7 GB. but the same thing is working fine in Xcode 10.2.1, right now I am using Xcode 13.2. If I run the same code in Xcode 10.2.1 then its works fine, but the same code not working in Xcode 13.2 can Anyone Help me?
3
0
2.9k
Feb ’22
Linking fails when enabling Address sanitizer (-rpath can only be used when creating a dynamic final linked image)
Hi, I can build my app normally, but enabling Address sanitizer in the app target's scheme (Edit scheme -> Run -> Diagnostic -> Address Sanitizer) make the linking step fails. The failure looks like this: Ld /Users/giober/Library/Developer/Xcode/DerivedData/xxxxxxxx-fsaitgomjihmgxhepmdwyfkrmmyu/Build/Products/Debug-iphoneos/libxxxxxMain.a normal (in target 'xxxxxMain' from project 'xxxxxxxx') cd /Users/giober/workspace/my-sdk /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -target arm64-apple-ios11.0 -r -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk -L/Users/giober/Library/Developer/Xcode/DerivedData/xxxxxxxx-fsaitgomjihmgxhepmdwyfkrmmyu/Build/Products/Debug-iphoneos -F/Users/giober/Library/Developer/Xcode/DerivedData/xxxxxxxx-fsaitgomjihmgxhepmdwyfkrmmyu/Build/Products/Debug-iphoneos -filelist /Users/giober/Library/Developer/Xcode/DerivedData/xxxxxxxx-fsaitgomjihmgxhepmdwyfkrmmyu/Build/Intermediates.noindex/xxxxxxxx.build/Debug-iphoneos/xxxxxMain.build/Objects-normal/arm64/xxxxxMain.LinkFileList -Xlinker -map -Xlinker /Users/giober/Library/Developer/Xcode/DerivedData/xxxxxxxx-fsaitgomjihmgxhepmdwyfkrmmyu/Build/Intermediates.noindex/xxxxxxxx.build/Debug-iphoneos/xxxxxMain.build/xxxxxMain-LinkMap-normal-arm64.txt -Xlinker -object_path_lto -Xlinker /Users/giober/Library/Developer/Xcode/DerivedData/xxxxxxxx-fsaitgomjihmgxhepmdwyfkrmmyu/Build/Intermediates.noindex/xxxxxxxx.build/Debug-iphoneos/xxxxxMain.build/Objects-normal-asan/arm64/xxxxxMain_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fembed-bitcode-marker -Xlinker -debug_variant -stdlib\=libc++ -fobjc-arc -fobjc-link-runtime -fsanitize\=address -ObjC -lrebrtc_multi -lxxxxxxxxxx -lxxxxxxxxxxxx -Xlinker -dependency_info -Xlinker /Users/giober/Library/Developer/Xcode/DerivedData/xxxxxxxx-fsaitgomjihmgxhepmdwyfkrmmyu/Build/Intermediates.noindex/xxxxxxxx.build/Debug-iphoneos/xxxxxMain.build/Objects-normal-asan/arm64/xxxxxMain_dependency_info.dat -o /Users/giober/Library/Developer/Xcode/DerivedData/xxxxxxxx-fsaitgomjihmgxhepmdwyfkrmmyu/Build/Products/Debug-iphoneos/libxxxxxMain.a ld: -rpath can only be used when creating a dynamic final linked image clang: error: linker command failed with exit code 1 (use -v to see invocation) I tried googling around, with no luck. I'm on XCode 13.1.
0
0
791
Feb ’22
BigSur fortran not compiling
I have updated to macOS Big Sur Version 11.6 . I am not able to compile simple fortran code now using  gfortran hello_world.F90  ld: unexpected token: !tapi-tbd file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd' for architecture x86_64 collect2: error: ld returned 1 exit status xxxx-MacBook-Pro-2:fortran xxxxx$ which gfortran /usr/local/bin/gfortran I found that it is the issue from macOS. I have tried many online forum suggestions but it didn't work. Is there a fix ?
2
0
1.1k
Feb ’22
React Native app doesn't load on IOS versions 11 and 12
When a user opens the app (from a physical device or a simulator) it just shows a blank screen and close (looks like a 0.5s flash, really fast). Testing it on browserstack simulator (https://www.browserstack.com/) it works on IOS versions greater or equal to 13, but not in 11 or 12. The iOS deployment target of the project is set to 11. All our dependencies also have their iOS deployment targets set to 11 or below; React Native version: 0.64.1 While debugging it (in browserstack) some errors looks common on all failure devices (all those in IOS version 11 or 12), for example (this is the most common and maybe even the root of the troubles): <Error>: _WifyCopyUnserialized: Invalid buffer/buffersize Complete log looks like the following in all failing versions: Someone there already faced something like it or similar? Any suggestion about actions to be done in this case (app not opening in specific IOS versions?
2
0
3.4k
Jan ’22
Not able to run Sanitizer on M1
I'm trying to run the Address Sanitizer on Xcode 13.2.1 and I receive the follow error. "Cannot find Thread Sanitizer runtime support library. Please specify it manually by setting DYLD_INSERT_LIBRARIES environment variable. I took a look on this, but I couldn't fix using this. I'm using Swift 5 and a Macbook Air M1. Has anyone managed to run the sanitizer in Xcode using a macbook with the m1 chipset and could help? Thanks
0
0
872
Jan ’22
Escaping closure captures mutating 'self' parameter
Hello, I am new to swift programming and I've been having this error "Escaping closure captures mutating 'self' parameter" at the first live of the code block that I don't know how to solve any help will be appreciated. Thank you!             let task = URLSession.shared.dataTask(with: url) { data, response, error in                 guard let data = data else {return}                 do {                     let JSONData = try JSONDecoder().decode([Memories].self, from: data)                     var Count = 0                     var List: [Card] = []                     for Data in JSONData                     {                         List.append(Card(id: Count, Image: Data.Image, Date: Data.Date, Description: Data.Description, expand: false))                         Count = Count + 1                     }                     Data_List = List                 } catch {                     let error = error                     print(String(describing: error))                 }             }             task.resume()
2
0
2.0k
Jan ’22
App crasher EXC_CRASH (SIGABRT)
Role: Foreground Parent Process: launchd [1] Coalition: com.economicon.ebdigitals [740] Date/Time: 2022-01-06 18:21:35.3279 +0300 Launch Time: 2022-01-06 18:21:24.1357 +0300 OS Version: iPhone OS 15.1 (19B74) Release Type: User Baseband Version: 5.00.00 Report Version: 104 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Triggered by Thread: 0 Last Exception Backtrace: 0 CoreFoundation 0x1826fdc9c __exceptionPreprocess + 216 (NSException.m:200) 1 libobjc.A.dylib 0x1998b1758 objc_exception_throw + 56 (objc-exception.mm:565) 2 FirebaseFirestore 0x10562bd2c firebase::firestore::util::ObjcThrowHandler(firebase::firestore::util::ExceptionType, char const*, char const*, int, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator<ch... + 344 (exception_apple.mm:67) 3 FirebaseFirestore 0x10562b7d0 firebase::firestore::util::Throw(firebase::firestore::util::ExceptionType, char const*, char const*, int, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) + 20 (exception.cc:93) 4 FirebaseFirestore 0x10560e3d8 void firebase::firestore::util::ThrowInvalidArgument<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, unsigned long>(char const*, std::__1::basic_string<char, ... + 48 (exception.h:94) 5 FirebaseFirestore 0x10561aabc firebase::firestore::api::DocumentReference::DocumentReference(firebase::firestore::model::ResourcePath, std::__1::shared_ptrfirebase::firestore::api::Firestore) + 300 (document_reference.cc:65) 6 FirebaseFirestore 0x10563d374 firebase::firestore::api::Firestore::GetDocument(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) + 80 (firestore.cc:160)
1
0
610
Jan ’22
Will TSAN or the Swift compiler identify possible Swift async-await race conditions?
I haven't followed the swift forums very closely, so perhaps there is news buried deep somewhere mentioning this. Will the swift compiler and/or TSAN at runtime in the future be able to identify possible race conditions associated with Swift async-await (excluding data races that are "erased" by async-await)? I suppose this could equate to proving a function is reentrant in some scenarios (from a compiler's perspective, though I'm not knowledgeable about compilers)? Consider, e.g. the scenario described in "Protect Mutable State with Swift Actors" around 9:15, where Dario talks about actor reentrancy, with the cache for the image URL
0
0
752
Jan ’22
Xcode 13.1 is super slow even when typing code
Anyone knows what's going on with Xcode 13.1? after upgrading to Xcode 13.1, it runs extremely slow, especially when I type code, roughly 5 times slower, I need to type and wait for the letters to pop up one by one (literally one by one popping). BTW, performance of compiling doesn't drop much, only the performance of editing drops, that is why this is especially unacceptable . My OS is Big Sur which has been upgraded for a while. and my Mac is pretty new (5 month? ) with 16 GB memory, 8 core i9, 1T SSD. So the hardware is not so bad at all. thanks
2
0
1.1k
Jan ’22
Module compiled with Swift 5.2.4 cannot be imported by the Swift 5.5.1 compiler, Xcode 13.1 Error
So basically I faced this error on Xcode 13.1 and tried building the 3.5 to 4.2 version but did not get built. Module compiled with Swift 5.2.4 cannot be imported by the Swift 5.5.1 compiler: /Users/Documents/Workspace/Project/Carthage/Build/iOS/ObjectMapper.framework/Modules/ObjectMapper.swiftmodule/x86_64-apple-ios-simulator.swiftmodule Currently same error with github "Hearst-DD/ObjectMapper" "3.5.3" to github "Hearst-DD/ObjectMapper" "4.2.0" System: macOSBigSur: 11.6 (20G165) Could anyone please help me on this? I tried a couple of StackOverflow answers but does not seem to be working. Tried with NEW BUILD SYSTEM vs LEGACY BUILD SYSTEM. and some options in build settings.
2
0
4.1k
Jan ’22
Application could not be uploaded to the device.
Im not able to deploy my app which I was working fine suddenly it started failing , giving following error Xamarin.Hosting.MobileDeviceException: Failed to communicate with the device. Please ensure the cable is properly connected, and try rebooting the device (error: 0xe8000065 kAMDMuxConnectError) at Xamarin.Hosting.RealDevice.Connect () [0x00021] in /Users/builder/azdo/_work/1/s/maccore/tools/mlaunch/Xamarin.Hosting/Xamarin.Hosting/RealDevice.cs:57 at Xamarin.Hosting.RealDevice..ctor (System.IntPtr am_device) [0x00022] in /Users/builder/azdo/_work/1/s/maccore/tools/mlaunch/Xamarin.Hosting/Xamarin.Hosting/RealDevice.cs:40 at Xamarin.Hosting.DeviceDiscovery+<>c__DisplayClass23_1.b__0 () [0x00007] in /Users/builder/azdo/_work/1/s/maccore/tools/mlaunch/Xamarin.Hosting/Xamarin.Hosting/DeviceDiscovery.cs:225 at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/thread.cs:74 at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:968 at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:910 at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:899 at System.Threading.ThreadHelper.ThreadStart () [0x00008] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/thread.cs:111 [ERROR] FATAL UNHANDLED EXCEPTION: Xamarin.Hosting.MobileDeviceException: Failed to communicate with the device. Please ensure the cable is properly connected, and try rebooting the device (error: 0xe8000065 kAMDMuxConnectError) at Xamarin.Hosting.RealDevice.Connect () [0x00021] in /Users/builder/azdo/_work/1/s/maccore/tools/mlaunch/Xamarin.Hosting/Xamarin.Hosting/RealDevice.cs:57 at Xamarin.Hosting.RealDevice..ctor (System.IntPtr am_device) [0x00022] in /Users/builder/azdo/_work/1/s/maccore/tools/mlaunch/Xamarin.Hosting/Xamarin.Hosting/RealDevice.cs:40 at Xamarin.Hosting.DeviceDiscovery+<>c__DisplayClass23_1.b__0 () [0x00007] in /Users/builder/azdo/_work/1/s/maccore/tools/mlaunch/Xamarin.Hosting/Xamarin.Hosting/DeviceDiscovery.cs:225 at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/thread.cs:74 at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:968 at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:910 at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:899 at System.Threading.ThreadHelper.ThreadStart () [0x00008] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/thread.cs:111 Tried deleting bin/obj but its not helping me. Please suggest any workaround.
1
0
2.4k
Jan ’22
Xcode Automatic signing fails
Hey guys, new kid on the bloc here. I'm trying to learn Xcode/swift but when I'm trying to test my app on an iPhone device I get a generic error "command CodeSign failed with a nonzero exit code". After clean build folder I get this error "The specified item could not be found in the keychain." Indeed when I look in keychain there is no certificate. It's trying to create one but fails and goes in an endless loop. Using another Apple ID to test, has no issues, it's just my main Apple ID.
2
0
812
Jan ’22
xCode Issue
Hi, This segment is from our "fishhook" about static void . I bolded the error message where we are getting the following "Thread 1: EXC_BAD_ACCESS (code=2, address=0x7fff8647d5c8)" Any recommendations? struct rebindings_entry {     struct rebinding *rebindings;     size_t rebindings_nel;     struct rebindings_entry *next; }; static struct rebindings_entry *_rebindings_head; static int prepend_rebindings(struct rebindings_entry **rebindings_head,                               struct rebinding rebindings[],                               size_t nel) {     struct rebindings_entry *new_entry = malloc(sizeof(struct rebindings_entry));     if (!new_entry) {         return -1;     }     new_entry->rebindings = malloc(sizeof(struct rebinding) * nel);     if (!new_entry->rebindings) {         free(new_entry);         return -1;     }     memcpy(new_entry->rebindings, rebindings, sizeof(struct rebinding) * nel);     new_entry->rebindings_nel = nel;     new_entry->next = *rebindings_head;     *rebindings_head = new_entry;     return 0; } static void perform_rebinding_with_section(struct rebindings_entry *rebindings,                                            section_t *section,                                            intptr_t slide,                                            nlist_t *symtab,                                            char *strtab,                                            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 ||             symtab_index == (INDIRECT_SYMBOL_LOCAL   | INDIRECT_SYMBOL_ABS)) {             continue;         }         uint32_t strtab_offset = symtab[symtab_index].n_un.n_strx;         char *symbol_name = strtab + strtab_offset;         struct rebindings_entry *cur = rebindings;         while (cur) {             for (uint j = 0; j < cur->rebindings_nel; j++) {                 if (strlen(symbol_name) > 1 &&                     strcmp(&symbol_name[1], cur->rebindings[j].name) == 0) {                     indirect_symbol_bindings[i] = cur->rebindings[j].replacement; =Thread 1: EXC_BAD_ACCESS (code=2, address=0x7fff8647d5c8)                     goto symbol_loop;                 }             }             cur = cur->next;         }     symbol_loop:;     } } static void rebind_symbols_for_image(struct rebindings_entry *rebindings,                                      const struct mach_header *header,                                      intptr_t slide) {     Dl_info info;     if (dladdr(header, &info) == 0) {         return;     }          segment_command_t *cur_seg_cmd;     segment_command_t *linkedit_segment = NULL;     struct symtab_command* symtab_cmd = NULL;     struct dysymtab_command* dysymtab_cmd = NULL;          uintptr_t cur = (uintptr_t)header + sizeof(mach_header_t);     for (uint i = 0; i < header->ncmds; i++, cur += cur_seg_cmd->cmdsize) {         cur_seg_cmd = (segment_command_t *)cur;         if (cur_seg_cmd->cmd == LC_SEGMENT_ARCH_DEPENDENT) {             if (strcmp(cur_seg_cmd->segname, SEG_LINKEDIT) == 0) {                 linkedit_segment = cur_seg_cmd;             }         } else if (cur_seg_cmd->cmd == LC_SYMTAB) {             symtab_cmd = (struct symtab_command*)cur_seg_cmd;         } else if (cur_seg_cmd->cmd == LC_DYSYMTAB) {             dysymtab_cmd = (struct dysymtab_command*)cur_seg_cmd;         }     }          if (!symtab_cmd || !dysymtab_cmd || !linkedit_segment ||         !dysymtab_cmd->nindirectsyms) {         return;     }          // Find base symbol/string table addresses     uintptr_t linkedit_base = (uintptr_t)slide + linkedit_segment->vmaddr - linkedit_segment->fileoff;     nlist_t *symtab = (nlist_t *)(linkedit_base + symtab_cmd->symoff);     char *strtab = (char *)(linkedit_base + symtab_cmd->stroff);          // Get indirect symbol table (array of uint32_t indices into symbol table)     uint32_t *indirect_symtab = (uint32_t *)(linkedit_base + dysymtab_cmd->indirectsymoff);          cur = (uintptr_t)header + sizeof(mach_header_t);     for (uint i = 0; i < header->ncmds; i++, cur += cur_seg_cmd->cmdsize) {         cur_seg_cmd = (segment_command_t *)cur;         if (cur_seg_cmd->cmd == LC_SEGMENT_ARCH_DEPENDENT) {             if (strcmp(cur_seg_cmd->segname, SEG_DATA) != 0 &&                 strcmp(cur_seg_cmd->segname, SEG_DATA_CONST) != 0) {                 continue;             }             for (uint j = 0; j < cur_seg_cmd->nsects; j++) {                 section_t *sect =                 (section_t *)(cur + sizeof(segment_command_t)) + j;                 if ((sect->flags & SECTION_TYPE) == S_LAZY_SYMBOL_POINTERS) {                     perform_rebinding_with_section(rebindings, sect, slide, symtab, strtab, indirect_symtab);                 }                 if ((sect->flags & SECTION_TYPE) == S_NON_LAZY_SYMBOL_POINTERS) {                     perform_rebinding_with_section(rebindings, sect, slide, symtab, strtab, indirect_symtab);                 }             }         }     } } static void _rebind_symbols_for_image(const struct mach_header *header,                                       intptr_t slide) {     rebind_symbols_for_image(_rebindings_head, header, slide); } int rebind_symbols_image(void *header,                          intptr_t slide,                          struct rebinding rebindings[],                          size_t rebindings_nel) {     struct rebindings_entry *rebindings_head = NULL;     int retval = prepend_rebindings(&rebindings_head, rebindings, rebindings_nel);     rebind_symbols_for_image(rebindings_head, header, slide);     free(rebindings_head);     return retval; } int rebind_symbols(struct rebinding rebindings[], size_t rebindings_nel) {     int retval = prepend_rebindings(&_rebindings_head, rebindings, rebindings_nel);     if (retval < 0) {         return retval;     }     // If this was the first call, register callback for image additions (which is also invoked for     // existing images, otherwise, just run on existing images     if (!_rebindings_head->next) {         _dyld_register_func_for_add_image(_rebind_symbols_for_image);     } else {         uint32_t c = _dyld_image_count();         for (uint32_t i = 0; i < c; i++) {             _rebind_symbols_for_image(_dyld_get_image_header(i), _dyld_get_image_vmaddr_slide(i));         }     }     return retval; }
5
0
1.2k
Jan ’22
XCode issue
Hi all, Just encountered an issue with XCode after I accidentally deleted some constraints for a button on a app I'm building for class--during this process, I accidentally removed the: main.storyboard file from the View file. In an attempt to reestablish it/finding the main.storyboard (I did not find a way to find/reestablish main.storyboard) I first: deleted the entire app project and then encountered an issue where XCode froze thus I restarted my MAC--no avail, XCode is no longer opening up. Ideas? Thank you so much for your time. yoliO
0
0
763
Jan ’22
xcode swift
I'm new to this coding thing and I came across this error saying "Cannot assign value of type 'ScanResult' to type 'String'" in the line "self.scannedCode = code" The attached is my code for reference import SwiftUI import CodeScanner struct print: View {   @State var isPresentingScanner = false   @State var scannedCode: String = "Scan QR code on mask box"       var scannerSheet : some View {     CodeScannerView(       codeTypes: [.qr],       completion: { result in         if case let .success(code) = result {           self.scannedCode = code           self.isPresentingScanner = false                     }       }                 )   }       var body: some View {     VStack(spacing: 10) {       Text(scannedCode)               Button ("Scan QR Code") {         self.isPresentingScanner = true       }               .sheet(isPresented: $isPresentingScanner) {         self.scannerSheet       }     }   } } struct ContentView_Previews: PreviewProvider {   static var previews: some View {     print()   } }
1
0
902
Jan ’22
How to use animation in iOS15?
I used animation in these codes, and there was warning like "'animation' was deprecated in iOS 15.0: Use withAnimation or animation(_:value:) instead." I am beginner, so please tell me how to fix it specifically. struct ContentView: View {     @State var image: Image?     @State var isPicking = false     var body: some View {         ZStack {             VStack {                 VStack {                         Spacer()                         image?                             .resizable()                             .scaledToFit()                         Spacer()                     }                 HStack {                     Spacer()                     Button(action: {                         self.isPicking = true                     }) {                         Image(systemName: "camera")                         Text("カメラ")                     }.padding()                 }             }             if isPicking {                 ImagePicker()                     .edgesIgnoringSafeArea(.all)                     .transition(.move(edge: .bottom))                     .animation(.easeInOut)             }         }     } } struct ContentView_Previews: PreviewProvider {     static var previews: some View {         ContentView()     } }
Replies
2
Boosts
0
Views
1.7k
Activity
Feb ’22
Xcode 13.2.1 version getting slim-build-frameworks.sh No such file or directory error
Hi, I am trying to do Flutter Run and I am keep getting this error bin/slim-build-frameworks.sh: No such file or directory command PhaseScriptExecution failed with a nonzero exit code error. This command used to work for me not, I am still in the learning phase of Flutter, any help is appreciated. If you need any further details please let me know.
Replies
1
Boosts
0
Views
600
Activity
Feb ’22
Problem with running python on Xcode
How can i solve this problem ?
Replies
0
Boosts
0
Views
405
Activity
Feb ’22
Unable to Start PacketTunnel Provider
While generating the Xcode build with Address Sanitizer enabled, I am unable to launch the PacketTunnelProvider provider. The process is getting killed by the Operating System with the below exception "Thread 1: EXC_RESOURCE RESOURCE_TYPE_MEMORY (limit=50 MB, unused=0x0)" I understood that since Packettunnel Provider extension has only a memory limit of 50 MB, Operating System is killing the process. Is there any other way, we can overcome this limitation and perform Address Sanitizer testing ?
Replies
1
Boosts
0
Views
1.4k
Activity
Feb ’22
boringssl_metrics_log_metric_block_invoke(151) Failed to log metrics
Just Created one Login screen and its UI, UI is custom reads all properties from the local JSON file, like color, button shape, background color, icon URL, etc. Used one Framework which I have created for my UI, and just drag and drop that framework (No API calls in that Framework) but when I run my project my UI gets stuck, Not able to click any button or text field. and I am getting the following error boringssl_metrics_log_metric_block_invoke(151) Failed to log metrics  also, My CPU use is 100% and my app is getting stuck (see screenshot) Memory is increasing to 6 to 7 GB. but the same thing is working fine in Xcode 10.2.1, right now I am using Xcode 13.2. If I run the same code in Xcode 10.2.1 then its works fine, but the same code not working in Xcode 13.2 can Anyone Help me?
Replies
3
Boosts
0
Views
2.9k
Activity
Feb ’22
Linking fails when enabling Address sanitizer (-rpath can only be used when creating a dynamic final linked image)
Hi, I can build my app normally, but enabling Address sanitizer in the app target's scheme (Edit scheme -> Run -> Diagnostic -> Address Sanitizer) make the linking step fails. The failure looks like this: Ld /Users/giober/Library/Developer/Xcode/DerivedData/xxxxxxxx-fsaitgomjihmgxhepmdwyfkrmmyu/Build/Products/Debug-iphoneos/libxxxxxMain.a normal (in target 'xxxxxMain' from project 'xxxxxxxx') cd /Users/giober/workspace/my-sdk /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -target arm64-apple-ios11.0 -r -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk -L/Users/giober/Library/Developer/Xcode/DerivedData/xxxxxxxx-fsaitgomjihmgxhepmdwyfkrmmyu/Build/Products/Debug-iphoneos -F/Users/giober/Library/Developer/Xcode/DerivedData/xxxxxxxx-fsaitgomjihmgxhepmdwyfkrmmyu/Build/Products/Debug-iphoneos -filelist /Users/giober/Library/Developer/Xcode/DerivedData/xxxxxxxx-fsaitgomjihmgxhepmdwyfkrmmyu/Build/Intermediates.noindex/xxxxxxxx.build/Debug-iphoneos/xxxxxMain.build/Objects-normal/arm64/xxxxxMain.LinkFileList -Xlinker -map -Xlinker /Users/giober/Library/Developer/Xcode/DerivedData/xxxxxxxx-fsaitgomjihmgxhepmdwyfkrmmyu/Build/Intermediates.noindex/xxxxxxxx.build/Debug-iphoneos/xxxxxMain.build/xxxxxMain-LinkMap-normal-arm64.txt -Xlinker -object_path_lto -Xlinker /Users/giober/Library/Developer/Xcode/DerivedData/xxxxxxxx-fsaitgomjihmgxhepmdwyfkrmmyu/Build/Intermediates.noindex/xxxxxxxx.build/Debug-iphoneos/xxxxxMain.build/Objects-normal-asan/arm64/xxxxxMain_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fembed-bitcode-marker -Xlinker -debug_variant -stdlib\=libc++ -fobjc-arc -fobjc-link-runtime -fsanitize\=address -ObjC -lrebrtc_multi -lxxxxxxxxxx -lxxxxxxxxxxxx -Xlinker -dependency_info -Xlinker /Users/giober/Library/Developer/Xcode/DerivedData/xxxxxxxx-fsaitgomjihmgxhepmdwyfkrmmyu/Build/Intermediates.noindex/xxxxxxxx.build/Debug-iphoneos/xxxxxMain.build/Objects-normal-asan/arm64/xxxxxMain_dependency_info.dat -o /Users/giober/Library/Developer/Xcode/DerivedData/xxxxxxxx-fsaitgomjihmgxhepmdwyfkrmmyu/Build/Products/Debug-iphoneos/libxxxxxMain.a ld: -rpath can only be used when creating a dynamic final linked image clang: error: linker command failed with exit code 1 (use -v to see invocation) I tried googling around, with no luck. I'm on XCode 13.1.
Replies
0
Boosts
0
Views
791
Activity
Feb ’22
BigSur fortran not compiling
I have updated to macOS Big Sur Version 11.6 . I am not able to compile simple fortran code now using  gfortran hello_world.F90  ld: unexpected token: !tapi-tbd file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd' for architecture x86_64 collect2: error: ld returned 1 exit status xxxx-MacBook-Pro-2:fortran xxxxx$ which gfortran /usr/local/bin/gfortran I found that it is the issue from macOS. I have tried many online forum suggestions but it didn't work. Is there a fix ?
Replies
2
Boosts
0
Views
1.1k
Activity
Feb ’22
React Native app doesn't load on IOS versions 11 and 12
When a user opens the app (from a physical device or a simulator) it just shows a blank screen and close (looks like a 0.5s flash, really fast). Testing it on browserstack simulator (https://www.browserstack.com/) it works on IOS versions greater or equal to 13, but not in 11 or 12. The iOS deployment target of the project is set to 11. All our dependencies also have their iOS deployment targets set to 11 or below; React Native version: 0.64.1 While debugging it (in browserstack) some errors looks common on all failure devices (all those in IOS version 11 or 12), for example (this is the most common and maybe even the root of the troubles): <Error>: _WifyCopyUnserialized: Invalid buffer/buffersize Complete log looks like the following in all failing versions: Someone there already faced something like it or similar? Any suggestion about actions to be done in this case (app not opening in specific IOS versions?
Replies
2
Boosts
0
Views
3.4k
Activity
Jan ’22
Not able to run Sanitizer on M1
I'm trying to run the Address Sanitizer on Xcode 13.2.1 and I receive the follow error. "Cannot find Thread Sanitizer runtime support library. Please specify it manually by setting DYLD_INSERT_LIBRARIES environment variable. I took a look on this, but I couldn't fix using this. I'm using Swift 5 and a Macbook Air M1. Has anyone managed to run the sanitizer in Xcode using a macbook with the m1 chipset and could help? Thanks
Replies
0
Boosts
0
Views
872
Activity
Jan ’22
Escaping closure captures mutating 'self' parameter
Hello, I am new to swift programming and I've been having this error "Escaping closure captures mutating 'self' parameter" at the first live of the code block that I don't know how to solve any help will be appreciated. Thank you!             let task = URLSession.shared.dataTask(with: url) { data, response, error in                 guard let data = data else {return}                 do {                     let JSONData = try JSONDecoder().decode([Memories].self, from: data)                     var Count = 0                     var List: [Card] = []                     for Data in JSONData                     {                         List.append(Card(id: Count, Image: Data.Image, Date: Data.Date, Description: Data.Description, expand: false))                         Count = Count + 1                     }                     Data_List = List                 } catch {                     let error = error                     print(String(describing: error))                 }             }             task.resume()
Replies
2
Boosts
0
Views
2.0k
Activity
Jan ’22
App crasher EXC_CRASH (SIGABRT)
Role: Foreground Parent Process: launchd [1] Coalition: com.economicon.ebdigitals [740] Date/Time: 2022-01-06 18:21:35.3279 +0300 Launch Time: 2022-01-06 18:21:24.1357 +0300 OS Version: iPhone OS 15.1 (19B74) Release Type: User Baseband Version: 5.00.00 Report Version: 104 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Triggered by Thread: 0 Last Exception Backtrace: 0 CoreFoundation 0x1826fdc9c __exceptionPreprocess + 216 (NSException.m:200) 1 libobjc.A.dylib 0x1998b1758 objc_exception_throw + 56 (objc-exception.mm:565) 2 FirebaseFirestore 0x10562bd2c firebase::firestore::util::ObjcThrowHandler(firebase::firestore::util::ExceptionType, char const*, char const*, int, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator<ch... + 344 (exception_apple.mm:67) 3 FirebaseFirestore 0x10562b7d0 firebase::firestore::util::Throw(firebase::firestore::util::ExceptionType, char const*, char const*, int, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) + 20 (exception.cc:93) 4 FirebaseFirestore 0x10560e3d8 void firebase::firestore::util::ThrowInvalidArgument<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, unsigned long>(char const*, std::__1::basic_string<char, ... + 48 (exception.h:94) 5 FirebaseFirestore 0x10561aabc firebase::firestore::api::DocumentReference::DocumentReference(firebase::firestore::model::ResourcePath, std::__1::shared_ptrfirebase::firestore::api::Firestore) + 300 (document_reference.cc:65) 6 FirebaseFirestore 0x10563d374 firebase::firestore::api::Firestore::GetDocument(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) + 80 (firestore.cc:160)
Replies
1
Boosts
0
Views
610
Activity
Jan ’22
Will TSAN or the Swift compiler identify possible Swift async-await race conditions?
I haven't followed the swift forums very closely, so perhaps there is news buried deep somewhere mentioning this. Will the swift compiler and/or TSAN at runtime in the future be able to identify possible race conditions associated with Swift async-await (excluding data races that are "erased" by async-await)? I suppose this could equate to proving a function is reentrant in some scenarios (from a compiler's perspective, though I'm not knowledgeable about compilers)? Consider, e.g. the scenario described in "Protect Mutable State with Swift Actors" around 9:15, where Dario talks about actor reentrancy, with the cache for the image URL
Replies
0
Boosts
0
Views
752
Activity
Jan ’22
Xcode 13.1 is super slow even when typing code
Anyone knows what's going on with Xcode 13.1? after upgrading to Xcode 13.1, it runs extremely slow, especially when I type code, roughly 5 times slower, I need to type and wait for the letters to pop up one by one (literally one by one popping). BTW, performance of compiling doesn't drop much, only the performance of editing drops, that is why this is especially unacceptable . My OS is Big Sur which has been upgraded for a while. and my Mac is pretty new (5 month? ) with 16 GB memory, 8 core i9, 1T SSD. So the hardware is not so bad at all. thanks
Replies
2
Boosts
0
Views
1.1k
Activity
Jan ’22
Module compiled with Swift 5.2.4 cannot be imported by the Swift 5.5.1 compiler, Xcode 13.1 Error
So basically I faced this error on Xcode 13.1 and tried building the 3.5 to 4.2 version but did not get built. Module compiled with Swift 5.2.4 cannot be imported by the Swift 5.5.1 compiler: /Users/Documents/Workspace/Project/Carthage/Build/iOS/ObjectMapper.framework/Modules/ObjectMapper.swiftmodule/x86_64-apple-ios-simulator.swiftmodule Currently same error with github "Hearst-DD/ObjectMapper" "3.5.3" to github "Hearst-DD/ObjectMapper" "4.2.0" System: macOSBigSur: 11.6 (20G165) Could anyone please help me on this? I tried a couple of StackOverflow answers but does not seem to be working. Tried with NEW BUILD SYSTEM vs LEGACY BUILD SYSTEM. and some options in build settings.
Replies
2
Boosts
0
Views
4.1k
Activity
Jan ’22
Fishhook for ios15
Hi, we are working on getting our app updated to the new iOS platforms. The 'fishhook' is not working appropriately. Anybody have a site where I can find the new fishhook (from facebook?)? Seems that most other issues have been resolved, but Xcode doesn't like the way fishhook is coded. thanks!
Replies
0
Boosts
0
Views
521
Activity
Jan ’22
Application could not be uploaded to the device.
Im not able to deploy my app which I was working fine suddenly it started failing , giving following error Xamarin.Hosting.MobileDeviceException: Failed to communicate with the device. Please ensure the cable is properly connected, and try rebooting the device (error: 0xe8000065 kAMDMuxConnectError) at Xamarin.Hosting.RealDevice.Connect () [0x00021] in /Users/builder/azdo/_work/1/s/maccore/tools/mlaunch/Xamarin.Hosting/Xamarin.Hosting/RealDevice.cs:57 at Xamarin.Hosting.RealDevice..ctor (System.IntPtr am_device) [0x00022] in /Users/builder/azdo/_work/1/s/maccore/tools/mlaunch/Xamarin.Hosting/Xamarin.Hosting/RealDevice.cs:40 at Xamarin.Hosting.DeviceDiscovery+<>c__DisplayClass23_1.b__0 () [0x00007] in /Users/builder/azdo/_work/1/s/maccore/tools/mlaunch/Xamarin.Hosting/Xamarin.Hosting/DeviceDiscovery.cs:225 at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/thread.cs:74 at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:968 at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:910 at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:899 at System.Threading.ThreadHelper.ThreadStart () [0x00008] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/thread.cs:111 [ERROR] FATAL UNHANDLED EXCEPTION: Xamarin.Hosting.MobileDeviceException: Failed to communicate with the device. Please ensure the cable is properly connected, and try rebooting the device (error: 0xe8000065 kAMDMuxConnectError) at Xamarin.Hosting.RealDevice.Connect () [0x00021] in /Users/builder/azdo/_work/1/s/maccore/tools/mlaunch/Xamarin.Hosting/Xamarin.Hosting/RealDevice.cs:57 at Xamarin.Hosting.RealDevice..ctor (System.IntPtr am_device) [0x00022] in /Users/builder/azdo/_work/1/s/maccore/tools/mlaunch/Xamarin.Hosting/Xamarin.Hosting/RealDevice.cs:40 at Xamarin.Hosting.DeviceDiscovery+<>c__DisplayClass23_1.b__0 () [0x00007] in /Users/builder/azdo/_work/1/s/maccore/tools/mlaunch/Xamarin.Hosting/Xamarin.Hosting/DeviceDiscovery.cs:225 at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/thread.cs:74 at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:968 at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:910 at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:899 at System.Threading.ThreadHelper.ThreadStart () [0x00008] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/threading/thread.cs:111 Tried deleting bin/obj but its not helping me. Please suggest any workaround.
Replies
1
Boosts
0
Views
2.4k
Activity
Jan ’22
Xcode Automatic signing fails
Hey guys, new kid on the bloc here. I'm trying to learn Xcode/swift but when I'm trying to test my app on an iPhone device I get a generic error "command CodeSign failed with a nonzero exit code". After clean build folder I get this error "The specified item could not be found in the keychain." Indeed when I look in keychain there is no certificate. It's trying to create one but fails and goes in an endless loop. Using another Apple ID to test, has no issues, it's just my main Apple ID.
Replies
2
Boosts
0
Views
812
Activity
Jan ’22
xCode Issue
Hi, This segment is from our "fishhook" about static void . I bolded the error message where we are getting the following "Thread 1: EXC_BAD_ACCESS (code=2, address=0x7fff8647d5c8)" Any recommendations? struct rebindings_entry {     struct rebinding *rebindings;     size_t rebindings_nel;     struct rebindings_entry *next; }; static struct rebindings_entry *_rebindings_head; static int prepend_rebindings(struct rebindings_entry **rebindings_head,                               struct rebinding rebindings[],                               size_t nel) {     struct rebindings_entry *new_entry = malloc(sizeof(struct rebindings_entry));     if (!new_entry) {         return -1;     }     new_entry->rebindings = malloc(sizeof(struct rebinding) * nel);     if (!new_entry->rebindings) {         free(new_entry);         return -1;     }     memcpy(new_entry->rebindings, rebindings, sizeof(struct rebinding) * nel);     new_entry->rebindings_nel = nel;     new_entry->next = *rebindings_head;     *rebindings_head = new_entry;     return 0; } static void perform_rebinding_with_section(struct rebindings_entry *rebindings,                                            section_t *section,                                            intptr_t slide,                                            nlist_t *symtab,                                            char *strtab,                                            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 ||             symtab_index == (INDIRECT_SYMBOL_LOCAL   | INDIRECT_SYMBOL_ABS)) {             continue;         }         uint32_t strtab_offset = symtab[symtab_index].n_un.n_strx;         char *symbol_name = strtab + strtab_offset;         struct rebindings_entry *cur = rebindings;         while (cur) {             for (uint j = 0; j < cur->rebindings_nel; j++) {                 if (strlen(symbol_name) > 1 &&                     strcmp(&symbol_name[1], cur->rebindings[j].name) == 0) {                     indirect_symbol_bindings[i] = cur->rebindings[j].replacement; =Thread 1: EXC_BAD_ACCESS (code=2, address=0x7fff8647d5c8)                     goto symbol_loop;                 }             }             cur = cur->next;         }     symbol_loop:;     } } static void rebind_symbols_for_image(struct rebindings_entry *rebindings,                                      const struct mach_header *header,                                      intptr_t slide) {     Dl_info info;     if (dladdr(header, &info) == 0) {         return;     }          segment_command_t *cur_seg_cmd;     segment_command_t *linkedit_segment = NULL;     struct symtab_command* symtab_cmd = NULL;     struct dysymtab_command* dysymtab_cmd = NULL;          uintptr_t cur = (uintptr_t)header + sizeof(mach_header_t);     for (uint i = 0; i < header->ncmds; i++, cur += cur_seg_cmd->cmdsize) {         cur_seg_cmd = (segment_command_t *)cur;         if (cur_seg_cmd->cmd == LC_SEGMENT_ARCH_DEPENDENT) {             if (strcmp(cur_seg_cmd->segname, SEG_LINKEDIT) == 0) {                 linkedit_segment = cur_seg_cmd;             }         } else if (cur_seg_cmd->cmd == LC_SYMTAB) {             symtab_cmd = (struct symtab_command*)cur_seg_cmd;         } else if (cur_seg_cmd->cmd == LC_DYSYMTAB) {             dysymtab_cmd = (struct dysymtab_command*)cur_seg_cmd;         }     }          if (!symtab_cmd || !dysymtab_cmd || !linkedit_segment ||         !dysymtab_cmd->nindirectsyms) {         return;     }          // Find base symbol/string table addresses     uintptr_t linkedit_base = (uintptr_t)slide + linkedit_segment->vmaddr - linkedit_segment->fileoff;     nlist_t *symtab = (nlist_t *)(linkedit_base + symtab_cmd->symoff);     char *strtab = (char *)(linkedit_base + symtab_cmd->stroff);          // Get indirect symbol table (array of uint32_t indices into symbol table)     uint32_t *indirect_symtab = (uint32_t *)(linkedit_base + dysymtab_cmd->indirectsymoff);          cur = (uintptr_t)header + sizeof(mach_header_t);     for (uint i = 0; i < header->ncmds; i++, cur += cur_seg_cmd->cmdsize) {         cur_seg_cmd = (segment_command_t *)cur;         if (cur_seg_cmd->cmd == LC_SEGMENT_ARCH_DEPENDENT) {             if (strcmp(cur_seg_cmd->segname, SEG_DATA) != 0 &&                 strcmp(cur_seg_cmd->segname, SEG_DATA_CONST) != 0) {                 continue;             }             for (uint j = 0; j < cur_seg_cmd->nsects; j++) {                 section_t *sect =                 (section_t *)(cur + sizeof(segment_command_t)) + j;                 if ((sect->flags & SECTION_TYPE) == S_LAZY_SYMBOL_POINTERS) {                     perform_rebinding_with_section(rebindings, sect, slide, symtab, strtab, indirect_symtab);                 }                 if ((sect->flags & SECTION_TYPE) == S_NON_LAZY_SYMBOL_POINTERS) {                     perform_rebinding_with_section(rebindings, sect, slide, symtab, strtab, indirect_symtab);                 }             }         }     } } static void _rebind_symbols_for_image(const struct mach_header *header,                                       intptr_t slide) {     rebind_symbols_for_image(_rebindings_head, header, slide); } int rebind_symbols_image(void *header,                          intptr_t slide,                          struct rebinding rebindings[],                          size_t rebindings_nel) {     struct rebindings_entry *rebindings_head = NULL;     int retval = prepend_rebindings(&rebindings_head, rebindings, rebindings_nel);     rebind_symbols_for_image(rebindings_head, header, slide);     free(rebindings_head);     return retval; } int rebind_symbols(struct rebinding rebindings[], size_t rebindings_nel) {     int retval = prepend_rebindings(&_rebindings_head, rebindings, rebindings_nel);     if (retval < 0) {         return retval;     }     // If this was the first call, register callback for image additions (which is also invoked for     // existing images, otherwise, just run on existing images     if (!_rebindings_head->next) {         _dyld_register_func_for_add_image(_rebind_symbols_for_image);     } else {         uint32_t c = _dyld_image_count();         for (uint32_t i = 0; i < c; i++) {             _rebind_symbols_for_image(_dyld_get_image_header(i), _dyld_get_image_vmaddr_slide(i));         }     }     return retval; }
Replies
5
Boosts
0
Views
1.2k
Activity
Jan ’22
XCode issue
Hi all, Just encountered an issue with XCode after I accidentally deleted some constraints for a button on a app I'm building for class--during this process, I accidentally removed the: main.storyboard file from the View file. In an attempt to reestablish it/finding the main.storyboard (I did not find a way to find/reestablish main.storyboard) I first: deleted the entire app project and then encountered an issue where XCode froze thus I restarted my MAC--no avail, XCode is no longer opening up. Ideas? Thank you so much for your time. yoliO
Replies
0
Boosts
0
Views
763
Activity
Jan ’22
xcode swift
I'm new to this coding thing and I came across this error saying "Cannot assign value of type 'ScanResult' to type 'String'" in the line "self.scannedCode = code" The attached is my code for reference import SwiftUI import CodeScanner struct print: View {   @State var isPresentingScanner = false   @State var scannedCode: String = "Scan QR code on mask box"       var scannerSheet : some View {     CodeScannerView(       codeTypes: [.qr],       completion: { result in         if case let .success(code) = result {           self.scannedCode = code           self.isPresentingScanner = false                     }       }                 )   }       var body: some View {     VStack(spacing: 10) {       Text(scannedCode)               Button ("Scan QR Code") {         self.isPresentingScanner = true       }               .sheet(isPresented: $isPresentingScanner) {         self.scannerSheet       }     }   } } struct ContentView_Previews: PreviewProvider {   static var previews: some View {     print()   } }
Replies
1
Boosts
0
Views
902
Activity
Jan ’22