简体   繁体   中英

Static Library works fine with debug,but does not with release

I have an iOS project which has a static library and in the library there is a encrypt method and in the method it refers a lot of system encrypt method about AES encryption. When I build the static library with release,it returned the correct data.But when I build with debug mode,it returns nil.

  • What's the differences between the two modes?
  • The same source code can build out different binary files that works differently?

Help me,thanks beforehand. This is where I choose the two modes.

在此处输入图片说明

The main difference is the level of compiler optimization. Select the project target and look at the Build Settings and compare Debug to Release.

One potential reason for the crash is that the code has some memory usage errors that by coincidence do not cause a crash with code optimization but do with no optimization. Or there are some other configuration difference. See the comment by @iDev.

A starting point is to fix all warnings, both compiler and Analyzer. The examine the crash log to understand the crash. If you need help with that add a crash report to your question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM